Search in sources :

Example 31 with IMultiPhoneCaller

use of de.janrufmonitor.framework.IMultiPhoneCaller in project janrufmonitor by tbrandt77.

the class CallerReaderFactory method unMultiPhoneCaller.

private ICallerList unMultiPhoneCaller(ICallerList cl, List managers) {
    ICallerList l = PIMRuntime.getInstance().getCallerFactory().createCallerList(cl.size());
    ICaller c = null;
    ICaller nc = null;
    for (int i = 0, j = cl.size(); i < j; i++) {
        c = cl.get(i);
        if (c instanceof IMultiPhoneCaller) {
            List phones = ((IMultiPhoneCaller) c).getPhonenumbers();
            IPhonenumber pn = null;
            for (int k = 0; k < phones.size(); k++) {
                pn = (IPhonenumber) phones.get(k);
                // removed due to performance issues: c = this.getCaller(pn, managers);
                nc = PIMRuntime.getInstance().getCallerFactory().createCaller(null, pn, c.getAttributes());
                if (nc != null) {
                    l.add(nc);
                }
            }
        } else
            l.add(c);
    }
    return l;
}
Also used : ICaller(de.janrufmonitor.framework.ICaller) ICallerList(de.janrufmonitor.framework.ICallerList) IMultiPhoneCaller(de.janrufmonitor.framework.IMultiPhoneCaller) List(java.util.List) ICallerList(de.janrufmonitor.framework.ICallerList) ArrayList(java.util.ArrayList) IPhonenumber(de.janrufmonitor.framework.IPhonenumber)

Example 32 with IMultiPhoneCaller

use of de.janrufmonitor.framework.IMultiPhoneCaller in project janrufmonitor by tbrandt77.

the class CallerCombinePage method createControl.

public void createControl(Composite parent) {
    setTitle(this.m_i18n.getString(getNamespace(), "title", "label", this.m_language));
    setDescription(this.m_i18n.getString(getNamespace(), "description", "label", this.m_language));
    Composite nameComposite = new Composite(parent, SWT.NONE);
    nameComposite.setLayout(new GridLayout(1, false));
    nameComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    Label ln = new Label(nameComposite, SWT.LEFT);
    ln.setText(this.m_i18n.getString(this.getNamespace(), "name", "label", this.m_language));
    final Combo callerCombo = new Combo(nameComposite, SWT.READ_ONLY);
    String[] callers = new String[m_l.size()];
    ICaller c = null;
    for (int i = 0; i < callers.length; i++) {
        c = m_l.get(i);
        callers[i] = getFormatter().parse("%a:ln%, %a:fn% (%a:add%)", c);
        callerCombo.setData(callers[i], c);
    }
    callerCombo.setItems(callers);
    callerCombo.select(0);
    String callerString = callerCombo.getItem(callerCombo.getSelectionIndex());
    this.m_c = ((IMultiPhoneCaller) callerCombo.getData(callerString));
    this.m_c.setPhonenumbers(this.m_phones);
    // Add the handler to update the name based on input
    callerCombo.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent event) {
            String callerString = callerCombo.getItem(callerCombo.getSelectionIndex());
            IMultiPhoneCaller m = (IMultiPhoneCaller) callerCombo.getData(callerString);
            try {
                m_c = (IMultiPhoneCaller) m.clone();
                m_c.setPhonenumbers(m_phones);
            } catch (CloneNotSupportedException e) {
                m_logger.log(Level.SEVERE, e.getMessage(), e);
            }
            setPageComplete(isComplete());
        }
    });
    setPageComplete(isComplete());
    setControl(nameComposite);
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) Label(org.eclipse.swt.widgets.Label) Combo(org.eclipse.swt.widgets.Combo) ICaller(de.janrufmonitor.framework.ICaller) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) GridData(org.eclipse.swt.layout.GridData) IMultiPhoneCaller(de.janrufmonitor.framework.IMultiPhoneCaller)

Aggregations

IMultiPhoneCaller (de.janrufmonitor.framework.IMultiPhoneCaller)32 ICaller (de.janrufmonitor.framework.ICaller)25 ICallerList (de.janrufmonitor.framework.ICallerList)25 IPhonenumber (de.janrufmonitor.framework.IPhonenumber)25 List (java.util.List)25 ArrayList (java.util.ArrayList)20 SQLException (java.sql.SQLException)15 IAttribute (de.janrufmonitor.framework.IAttribute)14 IAttributeMap (de.janrufmonitor.framework.IAttributeMap)8 IOException (java.io.IOException)8 UUID (de.janrufmonitor.util.uuid.UUID)6 File (java.io.File)5 Properties (java.util.Properties)5 ContactsService (com.google.gdata.client.contacts.ContactsService)4 ContactEntry (com.google.gdata.data.contacts.ContactEntry)4 ServiceException (com.google.gdata.util.ServiceException)4 MalformedURLException (java.net.MalformedURLException)4 URL (java.net.URL)4 Iterator (java.util.Iterator)4 ComFailException (com.jacob.com.ComFailException)3