*
* @param feed feed to watch and change.
*/
private void showQueryFeedProperties(QueryFeed feed)
{
GlobalController controller = GlobalController.SINGLETON;
QueryFeedPropertiesDialog dialog =
new QueryFeedPropertiesDialog(feed, controller.getMainFrame());
// Read-in the properties
String title = feed.getBaseTitle();
QueryType queryType = feed.getQueryType();
int purgeLimit = feed.getPurgeLimit();
String parameter = feed.getParameter();
boolean dedupEnabled = feed.isDedupEnabled();
int dedupFrom = feed.getDedupFrom();
int dedupTo = feed.getDedupTo();
// Show dialog and check if something has been changed and accepted
if (queryType == null)
{
JOptionPane.showMessageDialog(controller.getMainFrame(),
Strings.message("show.feed.properties.dialog.text.unsupported.type"),
Strings.message("show.feed.properties.dialog.title"),
JOptionPane.INFORMATION_MESSAGE);
} else if (dialog.open(title, queryType, purgeLimit, parameter, dedupEnabled, dedupFrom, dedupTo))
{
// Accepted
feed.setBaseTitle(dialog.getFeedTitle());
feed.setPurgeLimit(dialog.getFeedArticlesLimit());
boolean dedupChanged = feed.setDedupProperties(dialog.isDedupEnabled(),
dialog.getDedupFrom(), dialog.getDedupTo());
boolean paramChanged = feed.changeParameter(dialog.getFeedParameter());
if (paramChanged) controller.getPoller().update(feed, true, true); else
if (dedupChanged) feed.reviewArticles();
}
}