Exemple #1
0
  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) {
        if (!((ICaller) this.m_o).getPhoneNumber().isClired()
            && this.hasCallerComment((ICaller) this.m_o)) {
          return this.getI18nYes();
        }
      }
      if (this.m_o instanceof IComment) {
        int maxtext = 0;
        try {
          maxtext =
              Integer.parseInt(
                  PIMRuntime.getInstance()
                      .getConfigManagerFactory()
                      .getConfigManager()
                      .getProperty("service.CommentService", "maxtext"));
        } catch (Exception e) {
        }

        String t = ((IComment) m_o).getText();
        return (maxtext > 0
            ? t.substring(0, Math.min(maxtext, (t.length() > maxtext ? maxtext : t.length())))
                + "..."
            : t);
      }
    }
    return "";
  }
Exemple #2
0
 private String getLanguage() {
   if (this.m_language == null) {
     this.m_language =
         PIMRuntime.getInstance()
             .getConfigManagerFactory()
             .getConfigManager()
             .getProperty(IJAMConst.GLOBAL_NAMESPACE, IJAMConst.GLOBAL_LANGUAGE);
   }
   return this.m_language;
 }
Exemple #3
0
 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;
 }
 private CommentCallerHandler getHandler() {
   IService service = PIMRuntime.getInstance().getServiceFactory().getService("CommentService");
   if (service != null) {
     if (service instanceof CommentService) {
       CommentService commentService = (CommentService) service;
       CommentCallerHandler cch = commentService.getHandler();
       return cch;
     }
   }
   return null;
 }
Exemple #5
0
  private boolean hasCallerComment(ICaller c) {
    if (this.m_commentService == null) {
      IService s = PIMRuntime.getInstance().getServiceFactory().getService("CommentService");
      if (s != null && s instanceof CommentService) this.m_commentService = (CommentService) s;
    }

    if (this.m_commentService != null) {
      CommentCallerHandler cch = this.m_commentService.getHandler();
      if (cch != null) {
        return cch.hasCommentCaller(c);
      }
    }

    return false;
  }
Exemple #6
0
 private II18nManager getI18nManager() {
   if (this.m_i18n == null) {
     this.m_i18n = PIMRuntime.getInstance().getI18nManagerFactory().getI18nManager();
   }
   return this.m_i18n;
 }
 private IRuntime getRuntime() {
   if (this.m_runtime == null) {
     this.m_runtime = PIMRuntime.getInstance();
   }
   return this.m_runtime;
 }
  public boolean performFinish() {
    if (m_boxip == null || m_boxip.trim().length() == 0) {
      try {
        Thread.sleep(550);
      } catch (InterruptedException e) {
        m_logger.log(Level.SEVERE, e.getMessage(), e);
      }
      return true;
    }

    getRuntime()
        .getConfigManagerFactory()
        .getConfigManager()
        .setProperty(FritzBoxMonitor.NAMESPACE, "boxip", m_boxip);
    getRuntime()
        .getConfigManagerFactory()
        .getConfigManager()
        .setProperty(FritzBoxMonitor.NAMESPACE, "boxpassword", m_boxpassword);
    getRuntime()
        .getConfigManagerFactory()
        .getConfigManager()
        .setProperty(FritzBoxMonitor.NAMESPACE, "boxuser", m_boxuser);
    getRuntime()
        .getConfigManagerFactory()
        .getConfigManager()
        .setProperty(FritzBoxMonitor.NAMESPACE, "activemonitor", (m_active ? "true" : "false"));
    getRuntime().getConfigManagerFactory().getConfigManager().saveConfiguration();

    try {
      Thread.sleep(500);
    } catch (InterruptedException e) {
      m_logger.log(Level.SEVERE, e.getMessage(), e);
      return false;
    }

    getRuntime().getConfigurableNotifier().notifyByNamespace(FritzBoxMonitor.NAMESPACE);

    try {
      Thread.sleep(500);
    } catch (InterruptedException e) {
      m_logger.log(Level.SEVERE, e.getMessage(), e);
      return false;
    }

    if (m_active && !getRuntime().getMonitorListener().isRunning()) {
      getRuntime().getMonitorListener().start();
      try {
        Thread.sleep(500);
      } catch (InterruptedException e) {
        m_logger.log(Level.SEVERE, e.getMessage(), e);
        return false;
      }
      ICommand c = PIMRuntime.getInstance().getCommandFactory().getCommand("Activator");
      if (c != null) {
        try {
          Map m = new HashMap();
          IMonitor mon = getRuntime().getMonitorListener().getDefaultMonitor();
          m.put("status", (mon.isStarted() ? "revert" : "invert"));
          c.setParameters(m); // this method executes the command as well !!
        } catch (Exception e) {
          m_logger.log(Level.SEVERE, e.toString(), e);
        }
      }
    }

    try {
      Thread.sleep(500);
    } catch (InterruptedException e) {
      m_logger.log(Level.SEVERE, e.getMessage(), e);
      return false;
    }
    return true;
  }