}
private void showCreateFavoriteWizardInternal(Program program, String actor,
String topic) {
Window parent = UiUtilities.getLastModalChildOf(MainFrame.getInstance());
Favorite favorite;
if (isUsingExpertMode()) {
favorite = new AdvancedFavorite(program != null ? program.getTitle() : "");
EditFavoriteDialog dlg = new EditFavoriteDialog(parent, favorite);
UiUtilities.centerAndShow(dlg);
if (!dlg.getOkWasPressed()) {
favorite = null;
}
} else {
WizardHandler handler;
TypeWizardStep initialStep = new TypeWizardStep(program);
if (topic != null) {
initialStep.setTopic(topic);
} else if (actor != null) {
initialStep.setActor(actor);
}
handler = new WizardHandler(parent, initialStep);
favorite = (tvbrowser.extras.favoritesplugin.core.Favorite)handler.show();
}
if (favorite != null) {
try {
favorite.updatePrograms();
FavoriteTreeModel.getInstance().addFavorite(favorite);
if(ManageFavoritesDialog.getInstance() != null) {
ManageFavoritesDialog.getInstance().addFavorite(favorite, null);
}
}catch (TvBrowserException exc) {
ErrorHandler.handle(mLocalizer.msg("couldNotUpdateFavorites","Could not update favorites."), exc);
}
if (program != null && favorite.getPrograms().length == 0 && !favorite.isRemindAfterDownload()) {
Object[] options = {mLocalizer.msg("btn.notifyMe","Notify Me"), mLocalizer.msg("btn.editFavorite","Edit Favorite"), mLocalizer.msg("btn.ignore","Ignore")};
int option = JOptionPane.showOptionDialog(parent, mLocalizer.msg("dlg.noMatchingPrograms","Currently no program matches the newly created favorite.\n\nDo you want TV-Browser to notify you when any program matches this favorite?"),
mLocalizer.msg("dlg.title.information","Information"),
JOptionPane.YES_NO_OPTION,
JOptionPane.INFORMATION_MESSAGE,
null,
options,
options[0]);
if (option == JOptionPane.YES_OPTION) {
favorite.setRemindAfterDownload(true);
}
else if (option == JOptionPane.NO_OPTION) {
editFavorite(favorite);
}
}
else if (program != null && !favorite.contains(program)) {
// only show a warning for non matching favorites if the program is older than today
if (program.getDate().compareTo(new devplugin.Date()) >= 0) {
Object[] options = {mLocalizer.msg("btn.editFavorite","Edit Favorite"), mLocalizer.msg("btn.ignore","Ignore")};
if (JOptionPane.showOptionDialog(parent, mLocalizer.msg("dlg.programDoesntMatch","The currently selected program does not belong to the newly created favorite.\n\nDo you want to edit the favorite?"),
mLocalizer.msg("dlg.title.warning","Warning"),