// TODO not used
  private void showNotification() {
    final WebDialog dialog = new WebDialog();
    dialog.setUndecorated(true);
    dialog.setBackground(Color.BLACK);
    dialog.setBackground(StyleConstants.transparent);

    WebNotificationPopup popup = new WebNotificationPopup(PopupStyle.dark);
    popup.setIcon(Utils.getIcon("kontalk_small.png"));
    popup.setMargin(View.MARGIN_DEFAULT);
    popup.setDisplayTime(6000);
    popup.addNotificationListener(
        new NotificationListener() {
          @Override
          public void optionSelected(NotificationOption option) {}

          @Override
          public void accepted() {}

          @Override
          public void closed() {
            dialog.dispose();
          }
        });

    // content
    WebPanel panel = new WebPanel();
    panel.setMargin(View.MARGIN_DEFAULT);
    panel.setOpaque(false);
    WebLabel title = new WebLabel("A new Message!");
    title.setFontSize(View.FONT_SIZE_BIG);
    title.setForeground(Color.WHITE);
    panel.add(title, BorderLayout.NORTH);
    String text = "this is some message, and some longer text was added";
    WebLabel message = new WebLabel(text);
    message.setForeground(Color.WHITE);
    panel.add(message, BorderLayout.CENTER);
    popup.setContent(panel);

    // popup.packPopup();
    dialog.setSize(popup.getPreferredSize());

    // set position on screen
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gd = ge.getDefaultScreenDevice();
    GraphicsConfiguration gc = gd.getDefaultConfiguration();
    Rectangle screenBounds = gc.getBounds();
    // get height of the task bar
    // doesn't work on all environments
    // Insets toolHeight = toolkit.getScreenInsets(popup.getGraphicsConfiguration());
    int toolHeight = 40;
    dialog.setLocation(
        screenBounds.width - dialog.getWidth() - 10,
        screenBounds.height - toolHeight - dialog.getHeight());

    dialog.setVisible(true);
    NotificationManager.showNotification(dialog, popup);
  }
Ejemplo n.º 2
0
 @Override
 public void setPreferredSize(Dimension preferredSize) {
   // mac下忽略背影,减去背影部分 @IMFrameWrap
   if (SystemUtils.isMac()) {
     preferredSize.setSize(preferredSize.getWidth() - 20, preferredSize.getHeight() - 10);
   }
   super.setPreferredSize(preferredSize);
 }
Ejemplo n.º 3
0
  @Override
  @SuppressWarnings("unchecked")
  public void hide() {
    SkinManager skinManager = IMContext.getBean(SkinManager.class);
    // 取消注册皮肤管理
    skinManager.unregister(this);

    super.hide();
  }
Ejemplo n.º 4
0
  @Override
  @SuppressWarnings("unchecked")
  public void show() {
    SkinManager skinManager = IMContext.getBean(SkinManager.class);
    // 注册皮肤管理
    skinManager.register(this);
    installSkin(getSkinService());

    super.show();
  }
Ejemplo n.º 5
0
  public IMDialog(IMFrame owner) {
    super(owner);
    this.owner = owner;

    i18nService = IMContext.getBean(I18nService.class);
    skinService = IMContext.getBean(SkinService.class);
    resourceService = IMContext.getBean(ResourceService.class);
    eventService = IMContext.getBean(EventService.class);

    setDefaultCloseOperation(WebFrame.DISPOSE_ON_CLOSE);
    getRootPane().setDoubleBuffered(true);
    // 创建wrap,并设置为默认面板(该面板为窗口阴影面板)
    contentWrap = new IMFrameWrap();
    contentWrap.installSkin(getSkinService());
    super.setContentPane(contentWrap);

    // 去了默认边框
    setUndecorated(true);
    // 把窗口设置为透明
    AWTUtilities.setWindowOpaque(this, false);

    UIEventDispatcher uiEventDispatcher = new UIEventDispatcher(this);
    eventService.register(uiEventDispatcher.getEventTypes(), uiEventDispatcher);
  }
Ejemplo n.º 6
0
 void showImportWizard(boolean connect) {
   WebDialog importFrame = new ImportDialog(this, connect);
   importFrame.setVisible(true);
 }