Search in sources :

Example 1 with JournalFilterManager

use of de.janrufmonitor.ui.jface.application.journal.JournalFilterManager 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;
}
Also used : IFilterManager(de.janrufmonitor.ui.jface.application.IFilterManager) IFilter(de.janrufmonitor.repository.filter.IFilter) JournalFilterManager(de.janrufmonitor.ui.jface.application.journal.JournalFilterManager)

Example 2 with JournalFilterManager

use of de.janrufmonitor.ui.jface.application.journal.JournalFilterManager 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;
}
Also used : IFilterManager(de.janrufmonitor.ui.jface.application.IFilterManager) IFilter(de.janrufmonitor.repository.filter.IFilter) JournalFilterManager(de.janrufmonitor.ui.jface.application.journal.JournalFilterManager)

Example 3 with JournalFilterManager

use of de.janrufmonitor.ui.jface.application.journal.JournalFilterManager 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;
}
Also used : ICip(de.janrufmonitor.framework.ICip) FilterNamePage(de.janrufmonitor.ui.jface.wizards.pages.FilterNamePage) ArrayList(java.util.ArrayList) FilterDatePage(de.janrufmonitor.ui.jface.wizards.pages.FilterDatePage) JournalFilterManager(de.janrufmonitor.ui.jface.application.journal.JournalFilterManager) Date(java.util.Date) CipFilter(de.janrufmonitor.repository.filter.CipFilter) FilterPhonesPage(de.janrufmonitor.ui.jface.wizards.pages.FilterPhonesPage) FilterItemCountPage(de.janrufmonitor.ui.jface.wizards.pages.FilterItemCountPage) FilterMsnPage(de.janrufmonitor.ui.jface.wizards.pages.FilterMsnPage) ItemCountFilter(de.janrufmonitor.repository.filter.ItemCountFilter) IFilterManager(de.janrufmonitor.ui.jface.application.IFilterManager) FilterCipPage(de.janrufmonitor.ui.jface.wizards.pages.FilterCipPage) MsnFilter(de.janrufmonitor.repository.filter.MsnFilter) FilterCallTypePage(de.janrufmonitor.ui.jface.wizards.pages.FilterCallTypePage) AttributeFilter(de.janrufmonitor.repository.filter.AttributeFilter) IAttributeMap(de.janrufmonitor.framework.IAttributeMap) ArrayList(java.util.ArrayList) List(java.util.List) IMsn(de.janrufmonitor.framework.IMsn) IPhonenumber(de.janrufmonitor.framework.IPhonenumber)

Example 4 with JournalFilterManager

use of de.janrufmonitor.ui.jface.application.journal.JournalFilterManager in project janrufmonitor by tbrandt77.

the class History method getConfiguration.

public Properties getConfiguration() {
    Properties saved = super.getConfiguration();
    Properties journalConfig = this.getRuntime().getConfigManagerFactory().getConfigManager().getProperties(Journal.NAMESPACE);
    if (journalConfig != null && journalConfig.size() > 0) {
        saved.setProperty(JournalConfigConst.CFG_REPOSITORY, journalConfig.getProperty(JournalConfigConst.CFG_REPOSITORY));
    }
    IFilter[] filters = null;
    if (this.m_caller instanceof IMultiPhoneCaller) {
        filters = new IFilter[((IMultiPhoneCaller) this.m_caller).getPhonenumbers().size()];
        for (int i = 0, j = ((IMultiPhoneCaller) this.m_caller).getPhonenumbers().size(); i < j; i++) {
            filters[i] = new PhonenumberFilter((IPhonenumber) ((IMultiPhoneCaller) this.m_caller).getPhonenumbers().get(i));
        }
    } else {
        filters = new IFilter[1];
        if (this.m_caller != null)
            filters[0] = new PhonenumberFilter(this.m_caller.getPhoneNumber());
    }
    saved.setProperty("filter", new JournalFilterManager().getFiltersToString(filters));
    return saved;
}
Also used : IFilter(de.janrufmonitor.repository.filter.IFilter) PhonenumberFilter(de.janrufmonitor.repository.filter.PhonenumberFilter) IMultiPhoneCaller(de.janrufmonitor.framework.IMultiPhoneCaller) JournalFilterManager(de.janrufmonitor.ui.jface.application.journal.JournalFilterManager) Properties(java.util.Properties) IPhonenumber(de.janrufmonitor.framework.IPhonenumber)

Example 5 with JournalFilterManager

use of de.janrufmonitor.ui.jface.application.journal.JournalFilterManager 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);
}
Also used : ArrayList(java.util.ArrayList) JournalFilterManager(de.janrufmonitor.ui.jface.application.journal.JournalFilterManager) Properties(java.util.Properties) ComboFieldEditor(org.eclipse.jface.preference.ComboFieldEditor) Comparator(java.util.Comparator) StringFieldEditor(org.eclipse.jface.preference.StringFieldEditor) IFilterManager(de.janrufmonitor.ui.jface.application.IFilterManager) IFilter(de.janrufmonitor.repository.filter.IFilter) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

JournalFilterManager (de.janrufmonitor.ui.jface.application.journal.JournalFilterManager)6 IFilter (de.janrufmonitor.repository.filter.IFilter)5 IFilterManager (de.janrufmonitor.ui.jface.application.IFilterManager)4 Properties (java.util.Properties)3 IPhonenumber (de.janrufmonitor.framework.IPhonenumber)2 ItemCountFilter (de.janrufmonitor.repository.filter.ItemCountFilter)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 IAttributeMap (de.janrufmonitor.framework.IAttributeMap)1 ICip (de.janrufmonitor.framework.ICip)1 IMsn (de.janrufmonitor.framework.IMsn)1 IMultiPhoneCaller (de.janrufmonitor.framework.IMultiPhoneCaller)1 AttributeFilter (de.janrufmonitor.repository.filter.AttributeFilter)1 CipFilter (de.janrufmonitor.repository.filter.CipFilter)1 MsnFilter (de.janrufmonitor.repository.filter.MsnFilter)1 PhonenumberFilter (de.janrufmonitor.repository.filter.PhonenumberFilter)1 FilterCallTypePage (de.janrufmonitor.ui.jface.wizards.pages.FilterCallTypePage)1 FilterCipPage (de.janrufmonitor.ui.jface.wizards.pages.FilterCipPage)1 FilterDatePage (de.janrufmonitor.ui.jface.wizards.pages.FilterDatePage)1 FilterItemCountPage (de.janrufmonitor.ui.jface.wizards.pages.FilterItemCountPage)1