}
private void createConfigModel() {
final SubscriptionManager subs_man = SubscriptionManagerFactory.getSingleton();
BasicPluginConfigModel configModel = ui_manager.createBasicPluginConfigModel(
ConfigSection.SECTION_ROOT, "Subscriptions");
final IntParameter max_results =
configModel.addIntParameter2(
"subscriptions.config.maxresults",
"subscriptions.config.maxresults",
subs_man.getMaxNonDeletedResults());
// search
final BooleanParameter search_enable =
configModel.addBooleanParameter2(
"subscriptions.search.enable", "subscriptions.search.enable",
subs_man.isSearchEnabled());
search_enable.addListener(
new ParameterListener()
{
public void
parameterChanged(
Parameter param)
{
subs_man.setSearchEnabled( search_enable.getValue());
}
});
// download subs enable
final BooleanParameter download_subs_enable =
configModel.addBooleanParameter2(
"subscriptions.dl_subs.enable", "subscriptions.dl_subs.enable",
subs_man.isSubsDownloadEnabled());
download_subs_enable.addListener(
new ParameterListener()
{
public void
parameterChanged(
Parameter param)
{
subs_man.setSubsDownloadEnabled( download_subs_enable.getValue());
}
});
// auto
final BooleanParameter auto_start = configModel.addBooleanParameter2(
"subscriptions.config.autostartdls",
"subscriptions.config.autostartdls",
subs_man.getAutoStartDownloads());
auto_start.addListener(
new ParameterListener()
{
public void
parameterChanged(
Parameter param )
{
subs_man.setAutoStartDownloads( auto_start.getValue());
}
});
final IntParameter min_auto_start_size =
configModel.addIntParameter2(
"subscriptions.config.autostart.min",
"subscriptions.config.autostart.min",
subs_man.getAutoStartMinMB());
final IntParameter max_auto_start_size =
configModel.addIntParameter2(
"subscriptions.config.autostart.max",
"subscriptions.config.autostart.max",
subs_man.getAutoStartMaxMB());
auto_start.addEnabledOnSelection( min_auto_start_size );
auto_start.addEnabledOnSelection( max_auto_start_size );
configModel.createGroup(
"subscriptions.config.auto",
new Parameter[]{
auto_start,
min_auto_start_size,
max_auto_start_size,
});
// int param fires intermediate events so we have to rely on the save :(
default_pi.getPluginconfig().addListener(
new PluginConfigListener()
{
public void
configSaved()
{
subs_man.setMaxNonDeletedResults(max_results.getValue());
subs_man.setAutoStartMinMB(min_auto_start_size.getValue());
subs_man.setAutoStartMaxMB(max_auto_start_size.getValue());
}
});
// rss
final BooleanParameter rss_enable =
configModel.addBooleanParameter2(
"subscriptions.rss.enable", "subscriptions.rss.enable",
subs_man.isRSSPublishEnabled());
rss_enable.addListener(
new ParameterListener()
{
public void
parameterChanged(
Parameter param)
{
subs_man.setRSSPublishEnabled( rss_enable.getValue());
}
});
HyperlinkParameter rss_view =
configModel.addHyperlinkParameter2(
"device.rss.view", subs_man.getRSSLink());
rss_enable.addEnabledOnSelection( rss_view );
configModel.createGroup(
"device.rss.group",
new Parameter[]
{
rss_enable, rss_view,
});