Search in sources :

Example 86 with ICall

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

the class ReIdentifyAction method run.

public void run() {
    Viewer v = this.m_app.getApplication().getViewer();
    if (v != null && v instanceof TableViewer) {
        IStructuredSelection selection = (IStructuredSelection) v.getSelection();
        if (!selection.isEmpty()) {
            final ICall call = (ICall) selection.getFirstElement();
            ICaller caller = call.getCaller();
            if (caller.getPhoneNumber().isClired()) {
                new SWTExecuter() {

                    protected void execute() {
                        int style = SWT.APPLICATION_MODAL | SWT.OK;
                        MessageBox messageBox = new MessageBox(new Shell(DisplayManager.getDefaultDisplay()), style);
                        messageBox.setMessage(getI18nManager().getString(getNamespace(), "clir", "label", getLanguage()));
                        messageBox.open();
                    }
                }.start();
                return;
            }
            List cms = getAllActiveCallerManagers(getRuntime());
            if (cms.size() == 0) {
                new SWTExecuter() {

                    protected void execute() {
                        int style = SWT.APPLICATION_MODAL | SWT.OK;
                        MessageBox messageBox = new MessageBox(new Shell(DisplayManager.getDefaultDisplay()), style);
                        messageBox.setMessage(getI18nManager().getString(getNamespace(), "nocms", "label", getLanguage()));
                        messageBox.open();
                    }
                }.start();
                return;
            }
            caller = Identifier.identify(getRuntime(), caller.getPhoneNumber(), cms);
            if (caller == null) {
                new SWTExecuter() {

                    protected void execute() {
                        int style = SWT.APPLICATION_MODAL | SWT.OK;
                        MessageBox messageBox = new MessageBox(new Shell(DisplayManager.getDefaultDisplay()), style);
                        messageBox.setMessage(getI18nManager().getString(getNamespace(), "notidentified", "label", getLanguage()));
                        messageBox.open();
                    }
                }.start();
                return;
            }
            final ICaller newCaller = openCallerWizard(caller);
            if (newCaller != null) {
                int style = SWT.APPLICATION_MODAL | SWT.YES | SWT.NO;
                MessageBox messageBox = new MessageBox(DisplayManager.getDefaultDisplay().getActiveShell(), style);
                messageBox.setMessage(getI18nManager().getString(getNamespace(), "setall", "label", getLanguage()));
                final int status = messageBox.open();
                ProgressMonitorDialog pmd = new ProgressMonitorDialog(DisplayManager.getDefaultDisplay().getActiveShell());
                try {
                    IRunnableWithProgress r = new IRunnableWithProgress() {

                        public void run(IProgressMonitor progressMonitor) {
                            progressMonitor.beginTask(getI18nManager().getString(getNamespace(), "assignprogress", "label", getLanguage()), IProgressMonitor.UNKNOWN);
                            progressMonitor.worked(1);
                            call.setCaller(newCaller);
                            processModifierServices(call);
                            if (status == SWT.NO && m_app.getController() instanceof IExtendedApplicationController) {
                                // added 2009/12/31: only update single entry
                                progressMonitor.setTaskName(getI18nManager().getString(getNamespace(), "assignprogress", "label", getLanguage()));
                                ((IExtendedApplicationController) m_app.getController()).updateElement(call, false);
                            } else {
                                progressMonitor.setTaskName(getI18nManager().getString(getNamespace(), "assignall", "label", getLanguage()));
                                m_app.getController().updateElement(call);
                            }
                            progressMonitor.done();
                        }
                    };
                    pmd.setBlockOnOpen(false);
                    pmd.run(true, false, r);
                // ModalContext.run(r, true, pmd.getProgressMonitor(),
                // DisplayManager.getDefaultDisplay());
                } catch (InterruptedException e) {
                    m_logger.log(Level.SEVERE, e.getMessage(), e);
                } catch (InvocationTargetException e) {
                    m_logger.log(Level.SEVERE, e.getMessage(), e);
                }
                this.m_app.updateViews(true);
            }
        }
    }
}
Also used : ICall(de.janrufmonitor.framework.ICall) ProgressMonitorDialog(org.eclipse.jface.dialogs.ProgressMonitorDialog) TableViewer(org.eclipse.jface.viewers.TableViewer) Viewer(org.eclipse.jface.viewers.Viewer) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) InvocationTargetException(java.lang.reflect.InvocationTargetException) MessageBox(org.eclipse.swt.widgets.MessageBox) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress) ICaller(de.janrufmonitor.framework.ICaller) Shell(org.eclipse.swt.widgets.Shell) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ArrayList(java.util.ArrayList) List(java.util.List) IExtendedApplicationController(de.janrufmonitor.ui.jface.application.IExtendedApplicationController) TableViewer(org.eclipse.jface.viewers.TableViewer) SWTExecuter(de.janrufmonitor.ui.swt.SWTExecuter)

Example 87 with ICall

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

the class Status method renderAsImage.

public Image renderAsImage() {
    if (this.m_o != null) {
        if (this.m_o instanceof ICall) {
            ICall call = (ICall) this.m_o;
            IAttribute att = call.getAttribute(IJAMConst.ATTRIBUTE_NAME_CALLSTATUS);
            if (att != null && att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_REJECTED)) {
                return SWTImageManager.getInstance(PIMRuntime.getInstance()).get(IJAMConst.IMAGE_KEY_REJECTED_GIF);
            }
            // att = call.getAttribute(IJAMConst.ATTRIBUTE_NAME_CALLSTATUS);
            if (att != null && att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_ACCEPTED)) {
                return SWTImageManager.getInstance(PIMRuntime.getInstance()).get(IJAMConst.IMAGE_KEY_ACCEPTED_GIF);
            }
            // att = call.getAttribute(IJAMConst.ATTRIBUTE_NAME_CALLSTATUS);
            if (att != null && att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_OUTGOING)) {
                return SWTImageManager.getInstance(PIMRuntime.getInstance()).get(IJAMConst.IMAGE_KEY_OUTGOING_GIF);
            }
            if (att != null && att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_MISSED)) {
                return SWTImageManager.getInstance(PIMRuntime.getInstance()).get(IJAMConst.IMAGE_KEY_AWAY_GIF);
            }
            /**
             *				// 2008/11/08: work-a-round for showing old status fields
             *				att = call.getAttribute(IJAMConst.ATTRIBUTE_NAME_REJECTED);
             *				if (att != null && att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_YES)) {
             *					return SWTImageManager.getInstance(PIMRuntime.getInstance()).get(IJAMConst.IMAGE_KEY_REJECTED_GIF);
             *				}
             *				att = call.getAttribute(IJAMConst.ATTRIBUTE_NAME_ACCEPTED);
             *				if (att != null && att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_YES)) {
             *					return SWTImageManager.getInstance(PIMRuntime.getInstance()).get(IJAMConst.IMAGE_KEY_ACCEPTED_GIF);
             *				}
             *				att = call.getAttribute(IJAMConst.ATTRIBUTE_NAME_OUTGOING);
             *				if (att != null && att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_YES)) {
             *					return SWTImageManager.getInstance(PIMRuntime.getInstance()).get(IJAMConst.IMAGE_KEY_OUTGOING_GIF);
             *				}
             */
            return SWTImageManager.getInstance(PIMRuntime.getInstance()).get(IJAMConst.IMAGE_KEY_AWAY_GIF);
        }
    }
    return null;
}
Also used : ICall(de.janrufmonitor.framework.ICall) IAttribute(de.janrufmonitor.framework.IAttribute)

Example 88 with ICall

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

the class CallActive method renderAsImageID.

public String renderAsImageID() {
    if (this.m_o != null) {
        if (this.m_o instanceof ICall) {
            ICall call = (ICall) this.m_o;
            IAttribute att = call.getAttribute(IJAMConst.ATTRIBUTE_NAME_CALLSTATUS);
            if (att != null && att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_REJECTED)) {
                return IJAMConst.IMAGE_KEY_REJECTED_GIF;
            }
            // att = call.getAttribute(IJAMConst.ATTRIBUTE_NAME_CALLSTATUS);
            if (att != null && att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_ACCEPTED)) {
                return IJAMConst.IMAGE_KEY_ACCEPTED_GIF;
            }
            // att = call.getAttribute(IJAMConst.ATTRIBUTE_NAME_CALLSTATUS);
            if (att != null && att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_OUTGOING)) {
                return IJAMConst.IMAGE_KEY_OUTGOING_GIF;
            }
            if (att != null && att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_MISSED)) {
                return IJAMConst.IMAGE_KEY_AWAY_GIF;
            }
        }
    }
    return "";
}
Also used : ICall(de.janrufmonitor.framework.ICall) IAttribute(de.janrufmonitor.framework.IAttribute)

Example 89 with ICall

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

the class BChannel method renderAsImageID.

public String renderAsImageID() {
    if (this.m_o != null) {
        if (this.m_o instanceof ICall) {
            ICall call = (ICall) this.m_o;
            IAttribute att = call.getAttribute(IJAMConst.ATTRIBUTE_NAME_BCHANNEL);
            if (att != null) {
                if (att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_B1))
                    return IJAMConst.IMAGE_KEY_B1_JPG;
                if (att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_B2))
                    return IJAMConst.IMAGE_KEY_B2_JPG;
            }
        }
    }
    return "";
}
Also used : ICall(de.janrufmonitor.framework.ICall) IAttribute(de.janrufmonitor.framework.IAttribute)

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