Search in sources :

Example 51 with ICall

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

the class Etiquet method renderAsText.

public String renderAsText() {
    if (this.m_o != null) {
        if (this.m_o instanceof ICall) {
            this.m_o = ((ICall) this.m_o).getCaller();
        }
        if (this.m_o instanceof ICaller) {
            this.m_o = new TreeItemCallerData(((ICaller) this.m_o).getAttributes(), ((ICaller) this.m_o).getPhoneNumber());
        }
        if (this.m_o instanceof ITreeItemCallerData) {
            IAttributeMap m = ((ITreeItemCallerData) m_o).getAttributes();
            IPhonenumber pn = ((ITreeItemCallerData) m_o).getPhone();
            if (m.contains(IMacAddressBookNumberMapping.MAPPING_ATTTRIBUTE_ID + pn.getTelephoneNumber())) {
                IAttribute type = m.get(IMacAddressBookNumberMapping.MAPPING_ATTTRIBUTE_ID + pn.getTelephoneNumber());
                if (type != null) {
                    return PIMRuntime.getInstance().getI18nManagerFactory().getI18nManager().getString(NAMESPACE, type.getValue(), "label", getLanguage());
                }
            }
        }
    }
    return "";
}
Also used : ICaller(de.janrufmonitor.framework.ICaller) ICall(de.janrufmonitor.framework.ICall) IAttribute(de.janrufmonitor.framework.IAttribute) IAttributeMap(de.janrufmonitor.framework.IAttributeMap) ITreeItemCallerData(de.janrufmonitor.ui.jface.application.ITreeItemCallerData) ITreeItemCallerData(de.janrufmonitor.ui.jface.application.ITreeItemCallerData) IPhonenumber(de.janrufmonitor.framework.IPhonenumber)

Example 52 with ICall

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

the class MySQLCallEventLogger method receivedIdentifiedCall.

public void receivedIdentifiedCall(IEvent event) {
    super.receivedIdentifiedCall(event);
    ICall aCall = (ICall) event.getData();
    if (aCall != null) {
        if (getRuntime().getRuleEngine().validate(this.getID(), aCall.getMSN(), aCall.getCIP(), aCall.getCaller().getPhoneNumber())) {
            try {
                this.getDatabaseHandler().insertCall(aCall);
            } catch (SQLException e) {
                this.m_logger.log(Level.SEVERE, e.getMessage(), e);
            }
        } else {
            this.m_logger.info("No rule assigned to execute this service for call: " + aCall);
        }
    }
}
Also used : ICall(de.janrufmonitor.framework.ICall) SQLException(java.sql.SQLException)

Example 53 with ICall

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

the class ChangeAction method run.

public void run() {
    Viewer v = this.m_app.getApplication().getViewer();
    if (v != null) {
        IStructuredSelection selection = (IStructuredSelection) v.getSelection();
        if (!selection.isEmpty()) {
            Object o = selection.getFirstElement();
            if (o instanceof ICall) {
                o = ((ICall) o).getCaller();
            }
            if (o instanceof ICaller) {
                if (((ICaller) o).getPhoneNumber().isClired())
                    return;
                IAttribute att = ((ICaller) o).getAttribute(SoundConst.ATTRIBUTE_USER_SOUNDFILE);
                if (att == null) {
                    att = this.getRuntime().getCallerFactory().createAttribute(SoundConst.ATTRIBUTE_USER_SOUNDFILE, "");
                }
                // Create the dialog
                WizardDialog.setDefaultImage(SWTImageManager.getInstance(this.getRuntime()).get(IJAMConst.IMAGE_KEY_PIM_ICON));
                SoundDataWizard sdoW = new SoundDataWizard(att.getValue());
                WizardDialog dlg = new WizardDialog(new Shell(DisplayManager.getDefaultDisplay()), sdoW);
                dlg.open();
                if (dlg.getReturnCode() == WizardDialog.OK) {
                    att.setValue(sdoW.getResult());
                    ((ICaller) o).setAttribute(att);
                    this.m_app.getController().updateElement(o);
                    this.m_app.updateViews(false);
                }
            }
        }
    }
}
Also used : ICaller(de.janrufmonitor.framework.ICaller) Shell(org.eclipse.swt.widgets.Shell) ICall(de.janrufmonitor.framework.ICall) IAttribute(de.janrufmonitor.framework.IAttribute) Viewer(org.eclipse.jface.viewers.Viewer) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Example 54 with ICall

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

the class TableCellModifier method modify.

public void modify(Object element, String column, Object value) {
    if (element instanceof Item)
        element = ((Item) element).getData();
    ITableCellRenderer r = RendererRegistry.getInstance().getRenderer(column);
    if (r instanceof ITableAttributeCellEditorRenderer && ((ITableAttributeCellEditorRenderer) r).getAttribute() != null) {
        if (element instanceof ICall) {
            ICall c = ((ICall) element);
            IAttribute cAtt = c.getAttribute(((ITableAttributeCellEditorRenderer) r).getAttribute().getName());
            if (cAtt != null && value instanceof String) {
                if (cAtt.getValue().equalsIgnoreCase((String) value)) {
                    return;
                }
            }
            IAttribute att = ((ITableAttributeCellEditorRenderer) r).getAttribute();
            ((ITableAttributeCellEditorRenderer) r).applyAttributeChanges(c, att, value);
            if (this.m_ac.getController() instanceof IExtendedApplicationController) {
                ((IExtendedApplicationController) this.m_ac.getController()).updateElement(c, false);
            } else {
                this.m_ac.getController().updateElement(c);
            }
        }
        if (element instanceof ICaller) {
            ICaller c = ((ICaller) element);
            IAttribute cAtt = c.getAttribute(((ITableAttributeCellEditorRenderer) r).getAttribute().getName());
            if (cAtt != null && value instanceof String) {
                if (cAtt.getValue().equalsIgnoreCase((String) value)) {
                    return;
                }
            }
            IAttribute att = ((ITableAttributeCellEditorRenderer) r).getAttribute();
            ((ITableAttributeCellEditorRenderer) r).applyAttributeChanges(c, att, value);
            if (this.m_ac.getController() instanceof IExtendedApplicationController) {
                ((IExtendedApplicationController) this.m_ac.getController()).updateElement(c, false);
            } else {
                this.m_ac.getController().updateElement(c);
            }
        }
    }
    this.m_v.refresh();
}
Also used : Item(org.eclipse.swt.widgets.Item) ITableCellRenderer(de.janrufmonitor.ui.jface.application.rendering.ITableCellRenderer) ICaller(de.janrufmonitor.framework.ICaller) ICall(de.janrufmonitor.framework.ICall) IAttribute(de.janrufmonitor.framework.IAttribute) ITableAttributeCellEditorRenderer(de.janrufmonitor.ui.jface.application.rendering.ITableAttributeCellEditorRenderer)

Example 55 with ICall

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

the class TextCellLabelProvider method getBackground.

public Color getBackground(Object o) {
    if (o instanceof ICall)
        o = ((ICall) o).getCaller();
    if (o instanceof ICaller) {
        if (((ICaller) o).getAttributes().contains(IJAMConst.ATTRIBUTE_NAME_SPAM_COLOR)) {
            String color = ((ICaller) o).getAttribute(IJAMConst.ATTRIBUTE_NAME_SPAM_COLOR).getValue();
            StringTokenizer cs = new StringTokenizer(color, ",");
            if (cs.countTokens() == 3)
                return new Color(DisplayManager.getDefaultDisplay(), Integer.parseInt(cs.nextToken()), Integer.parseInt(cs.nextToken()), Integer.parseInt(cs.nextToken()));
        }
    }
    return null;
}
Also used : ICaller(de.janrufmonitor.framework.ICaller) StringTokenizer(java.util.StringTokenizer) ICall(de.janrufmonitor.framework.ICall) Color(org.eclipse.swt.graphics.Color)

Aggregations

ICall (de.janrufmonitor.framework.ICall)89 ICaller (de.janrufmonitor.framework.ICaller)41 List (java.util.List)23 Viewer (org.eclipse.jface.viewers.Viewer)20 IPhonenumber (de.janrufmonitor.framework.IPhonenumber)19 ArrayList (java.util.ArrayList)19 IAttribute (de.janrufmonitor.framework.IAttribute)18 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)18 ICallList (de.janrufmonitor.framework.ICallList)17 IOException (java.io.IOException)14 Properties (java.util.Properties)14 Date (java.util.Date)13 Iterator (java.util.Iterator)13 Shell (org.eclipse.swt.widgets.Shell)13 File (java.io.File)12 InvocationTargetException (java.lang.reflect.InvocationTargetException)12 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)11 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)11 ICip (de.janrufmonitor.framework.ICip)10 ProgressMonitorDialog (org.eclipse.jface.dialogs.ProgressMonitorDialog)10