public ExtendedBalloonDialog(Properties config, ICall call) {
    super(DisplayManager.getDefaultDisplay(), SWT.ON_TOP | SWT.CLOSE | SWT.TITLE);

    if (m_instance_count > 2) m_instance_count = -1;
    m_instance_count++;

    this.m_logger = LogManager.getLogManager().getLogger(IJAMConst.DEFAULT_LOGGER);

    IEventBroker eventBroker = this.getRuntime().getEventBroker();
    eventBroker.register(this);
    eventBroker.register(this, eventBroker.createEvent(IEventConst.EVENT_TYPE_CALLCLEARED));
    eventBroker.register(this, eventBroker.createEvent(IEventConst.EVENT_TYPE_CALLACCEPTED));
    eventBroker.register(this, eventBroker.createEvent(IEventConst.EVENT_TYPE_CALLREJECTED));
    eventBroker.register(this, eventBroker.createEvent(IEventConst.EVENT_TYPE_CALLMARKEDSPAM));

    this.m_configuration = config;
    this.m_call = call;

    this.setAnchor(SWT.NONE);

    this.setText(
        this.getI18nManager()
            .getString(
                this.getNamespace(),
                (isOutgoing(call) ? "outgoing" : "call"),
                "label",
                this.getLanguage()));

    this.setImage(
        SWTImageManager.getInstance(this.getRuntime())
            .get(
                (isOutgoing(call)
                    ? IJAMConst.IMAGE_KEY_OUTGOING_GIF
                    : IJAMConst.IMAGE_KEY_ACCEPTED_GIF)));
  }
Exemple #2
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;
 }
  protected void createButtonsForButtonBar(Composite parent) {
    super.createButtonsForButtonBar(parent);
    this.getButton(1).dispose();

    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.horizontalSpan = 2;
    gd.widthHint = 50;

    this.getButton(0).setLayoutData(gd);
    this.getButton(0).setFocus();
    this.setTitleImage(
        SWTImageManager.getInstance(this.getRuntime()).get(IJAMConst.IMAGE_KEY_PIM_JPG));
  }
  protected Control createDialogArea(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout(3, false));
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.horizontalIndent = 15;
    gd.verticalIndent = 15;
    composite.setLayoutData(gd);

    gd = new GridData(GridData.FILL_BOTH);
    gd.horizontalSpan = 2;

    FontData fd = parent.getFont().getFontData()[0];
    fd.setStyle(SWT.BOLD);
    fd.setHeight(11);
    Font font = new Font(parent.getDisplay(), fd);

    Label l = new Label(composite, SWT.NONE);
    l.setText("jAnrufmonitor");
    l.setFont(font);
    l.setLayoutData(gd);

    gd = new GridData(GridData.FILL_BOTH);
    gd.verticalSpan = 8;

    // check for edition
    String edition = getI18nManager().getString(NAMESPACE, "edition", "label", getLanguage());

    if (edition != null && edition.trim().length() > 0 && !edition.equalsIgnoreCase("edition"))
      l.setText(l.getText() + " " + edition);

    l = new Label(composite, SWT.NONE);
    l.setImage(SWTImageManager.getInstance(this.getRuntime()).get(IJAMConst.IMAGE_KEY_TELEFON_JPG));
    l.setLayoutData(gd);

    fd = parent.getFont().getFontData()[0];
    fd.setStyle(SWT.BOLD);
    font = new Font(parent.getDisplay(), fd);

    l = new Label(composite, SWT.NONE);
    l.setText(getI18nManager().getString(NAMESPACE, "license", "label", getLanguage()));
    l.setFont(font);

    new Label(composite, SWT.NONE)
        .setText(getI18nManager().getString(NAMESPACE, "freeware", "label", getLanguage()));

    l = new Label(composite, SWT.NONE);
    l.setText(getI18nManager().getString(NAMESPACE, "version", "label", getLanguage()));
    l.setFont(font);

    new Label(composite, SWT.NONE).setText(IJAMConst.VERSION_DISPLAY);

    l = new Label(composite, SWT.NONE);
    l.setText(getI18nManager().getString(NAMESPACE, "build", "label", getLanguage()));
    l.setFont(font);

    new Label(composite, SWT.NONE).setText(IJAMConst.VERSION_BUILD);

    l = new Label(composite, SWT.NONE);
    l.setText(getI18nManager().getString(NAMESPACE, "rkey", "label", getLanguage()));
    l.setFont(font);

    String key =
        getRuntime()
            .getConfigManagerFactory()
            .getConfigManager()
            .getProperty("service.update.UpdateManager", "regkey");
    if (key == null || key.length() == 0) {
      key = new UUID().toString();
      getRuntime()
          .getConfigManagerFactory()
          .getConfigManager()
          .setProperty("service.update.UpdateManager", "regkey", key);
      getRuntime().getConfigManagerFactory().getConfigManager().saveConfiguration();
    }

    HyperLink hl = new HyperLink(composite, SWT.NONE);
    hl.setText(key);
    final String rkey = key;
    hl.addMouseListener(
        new MouseAdapter() {
          public void mouseDown(MouseEvent e) {
            if (e.button == 1) Program.launch("http://www.janrufmonitor.de/registry.php?k=" + rkey);
          }
        });

    new Label(composite, SWT.NONE);
    new Label(composite, SWT.NONE);

    l = new Label(composite, SWT.NONE);
    l.setText(getI18nManager().getString(NAMESPACE, "homepage", "label", getLanguage()));
    l.setFont(font);

    hl = new HyperLink(composite, SWT.NONE);
    hl.setText("http://www.janrufmonitor.de/");
    hl.addMouseListener(
        new MouseAdapter() {
          public void mouseDown(MouseEvent e) {
            if (e.button == 1) Program.launch("http://www.janrufmonitor.de/");
          }
        });

    l = new Label(composite, SWT.NONE);
    l.setText(getI18nManager().getString(NAMESPACE, "mail", "label", getLanguage()));
    l.setFont(font);

    hl = new HyperLink(composite, SWT.NONE);
    hl.setText("*****@*****.**");
    hl.addMouseListener(
        new MouseAdapter() {
          public void mouseDown(MouseEvent e) {
            if (e.button == 1)
              Program.launch("http://www.janrufmonitor.de/support-request.php?k=" + rkey);
          }
        });

    l = new Label(composite, SWT.NONE);
    l.setText(getI18nManager().getString(NAMESPACE, "donation", "label", getLanguage()));
    l.setFont(font);

    hl = new HyperLink(composite, SWT.NONE);
    hl.setText("http://www.janrufmonitor.de/donation/");
    hl.addMouseListener(
        new MouseAdapter() {
          public void mouseDown(MouseEvent e) {
            if (e.button == 1) Program.launch("http://www.janrufmonitor.de/donation/");
          }
        });

    new Label(composite, SWT.NONE);
    new Label(composite, SWT.NONE);

    gd = new GridData(GridData.FILL_BOTH);
    gd.horizontalSpan = 3;
    gd.widthHint = 300;

    l = new Label(composite, SWT.RIGHT);
    l.setText("(c) 2008 - 2011 by Thilo Brandt      ");
    l.setLayoutData(gd);

    return super.createDialogArea(parent);
  }