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;
}
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);
}
Aggregations