use of de.janrufmonitor.ui.jface.application.IFilterManager in project janrufmonitor by tbrandt77.
the class AbstractStatisticAction method getDescription.
public String getDescription() {
IFilterManager fm = new JournalFilterManager();
IFilter[] f = fm.getFiltersFromString(this.m_app.getApplication().getConfiguration().getProperty(CFG_FILTER, ""));
String activeFilter = getFilterLabel(fm, f);
String description = getI18nManager().getString(getNamespace(), "dialogtitle", "description", getLanguage());
description = StringUtils.replaceString(description, "{%1}", activeFilter);
return description;
}
use of de.janrufmonitor.ui.jface.application.IFilterManager in project janrufmonitor by tbrandt77.
the class AbstractStatisticAction method getMessage.
public String getMessage() {
IFilterManager fm = new JournalFilterManager();
IFilter[] f = fm.getFiltersFromString(this.m_app.getApplication().getConfiguration().getProperty(CFG_FILTER, ""));
String activeFilter = getFilterLabel(fm, f);
String description = getI18nManager().getString(getNamespace(), "current", "label", getLanguage());
description = StringUtils.replaceString(description, "{%1}", activeFilter);
return description;
}
use of de.janrufmonitor.ui.jface.application.IFilterManager in project janrufmonitor by tbrandt77.
the class FilterWizard method performFinish.
public boolean performFinish() {
if (this.m_pages[0].isPageComplete() && this.m_pages[1].isPageComplete() && this.m_pages[2].isPageComplete() && this.m_pages[3].isPageComplete() && this.m_pages[4].isPageComplete() && this.m_pages[5].isPageComplete() && this.m_pages[6].isPageComplete()) {
List filterList = new ArrayList();
IPhonenumber[] phones = ((FilterPhonesPage) this.m_pages[3]).getResult();
if (phones != null) {
filterList.addAll(this.getCallerFilters(phones));
}
Date[] dates = ((FilterDatePage) this.m_pages[2]).getResult();
if (dates != null && dates.length > 0) {
filterList.add(this.getDateFilter(dates));
}
IMsn msn = ((FilterMsnPage) this.m_pages[0]).getResult();
if (msn != null) {
if (!msn.getMSN().equalsIgnoreCase("*"))
filterList.add(new MsnFilter(new IMsn[] { msn }));
}
int limit = ((FilterItemCountPage) this.m_pages[4]).getResult();
if (limit > 0) {
filterList.add(new ItemCountFilter(limit));
}
IAttributeMap m = ((FilterCallTypePage) this.m_pages[5]).getResult();
if (m != null && m.size() > 0) {
filterList.add(new AttributeFilter(m));
}
ICip cip = ((FilterCipPage) this.m_pages[1]).getResult();
if (cip != null)
if (!cip.getCIP().equalsIgnoreCase("*"))
filterList.add(new CipFilter(cip));
this.m_filters = new IFilter[filterList.size()];
for (int i = 0; i < filterList.size(); i++) {
this.m_filters[i] = (IFilter) filterList.get(i);
}
String name = ((FilterNamePage) this.m_pages[6]).getResult();
IFilterManager fm = new JournalFilterManager();
if (name != null && name.trim().length() > 0) {
this.getRuntime().getConfigManagerFactory().getConfigManager().setProperty(Journal.NAMESPACE, "filtername_" + fm.getFiltersToString(getResult()), name);
this.getRuntime().getConfigManagerFactory().getConfigManager().saveConfiguration();
} else {
this.getRuntime().getConfigManagerFactory().getConfigManager().removeProperty(Journal.NAMESPACE, "filtername_" + fm.getFiltersToString(getResult()));
this.getRuntime().getConfigManagerFactory().getConfigManager().saveConfiguration();
}
return true;
}
this.m_filters = null;
return false;
}
use of de.janrufmonitor.ui.jface.application.IFilterManager in project janrufmonitor by tbrandt77.
the class Journal method createFieldEditors.
protected void createFieldEditors() {
this.setTitle(this.m_i18n.getString(this.getNamespace(), "title", "label", this.m_language));
this.noDefaultAndApplyButton();
List l = new ArrayList();
l.add(new IFilter[0]);
IFilterManager jfm = new JournalFilterManager();
Properties c = getRuntime().getConfigManagerFactory().getConfigManager().getProperties(this.getConfigNamespace());
Iterator iter = c.keySet().iterator();
String key = null;
while (iter.hasNext()) {
key = (String) iter.next();
if (key.startsWith("filter_")) {
String filter = c.getProperty(key);
l.add(jfm.getFiltersFromString(filter));
}
}
// added 2015/04/03: added runtime filters
if (jfm.hasRuntimeFilters()) {
IFilter[][] rf = jfm.getRuntimeFilters();
if (rf != null && rf.length > 0) {
for (int i = 0; i < rf.length; i++) l.add(rf[i]);
}
}
// added 2015/04/01: sort filter list
Collections.sort(l, new Comparator() {
public int compare(Object f1, Object f2) {
if (f1 != null && f2 != null && f1 instanceof IFilter[] && f2 instanceof IFilter[]) {
if (((IFilter[]) f1).length == ((IFilter[]) f2).length) {
return (((IFilter[]) f2)[0].toString().compareTo(((IFilter[]) f1)[0].toString()));
}
if (((IFilter[]) f1).length < ((IFilter[]) f2).length)
return -1;
return 1;
}
return 0;
}
});
String[][] filters = new String[l.size()][2];
for (int i = 0; i < l.size(); i++) {
filters[i][0] = getFilterLabel(jfm, (IFilter[]) l.get(i));
filters[i][1] = jfm.getFiltersToString((IFilter[]) l.get(i));
}
ComboFieldEditor cfe = new ComboFieldEditor(this.getConfigNamespace() + SEPARATOR + "filter", this.m_i18n.getString(getNamespace(), "filter", "label", this.m_language), filters, this.getFieldEditorParent());
addField(cfe);
StringFieldEditor sfe = new StringFieldEditor(getConfigNamespace() + SEPARATOR + "rt_filters_years", this.m_i18n.getString(this.getNamespace(), "rt_filters_years", "label", this.m_language), 2, this.getFieldEditorParent());
sfe.setTextLimit(2);
addField(sfe);
}
Aggregations