Ejemplo n.º 1
0
  private void layoutComponents() {
    setBorder(
        BorderFactory.createTitledBorder(UIManager.getBorder("TitledBorder.border"), "Summary"));
    setLayout(new MigLayout("fill, wrap 1"));

    for (CertificateSummaryEntry entry : summary) {
      add(
          new JLabel(
              entry.getText(),
              entry.isGood()
                  ? IconManager.getIconManager().getIcon("tick")
                  : IconManager.getIconManager().getIcon("cross"),
              JLabel.LEFT),
          "growx");
    }
  }
Ejemplo n.º 2
0
  /**
   * Instantiates a new invite label.
   *
   * @param mainFrame Parent window
   */
  public InviteLabel(final MainFrame mainFrame) {
    super(new JLabel());

    this.mainFrame = mainFrame;

    setBorder(BorderFactory.createEtchedBorder());
    label.setIcon(IconManager.getIconManager().getIcon("invite"));

    inviteList = new MapList<Server, Invite>();
    menu = new JPopupMenu();
    dismiss = new JMenuItem("Dismiss all invites");
    dismiss.addActionListener(
        new java.awt.event.ActionListener() {

          /** {@inheritDoc} */
          @Override
          public void actionPerformed(final ActionEvent e) {
            for (Server server : inviteList.keySet()) {
              final List<Invite> invites = new ArrayList<Invite>(inviteList.values(server));
              for (Invite invite : invites) {
                invite.getServer().removeInvite(invite);
              }
            }
          }
        });

    accept = new JMenuItem("Accept all invites");
    accept.addActionListener(
        new java.awt.event.ActionListener() {

          /** {@inheritDoc} */
          @Override
          public void actionPerformed(final ActionEvent e) {
            for (Server server : inviteList.keySet()) {
              final List<Invite> invites = new ArrayList<Invite>(inviteList.values(server));
              for (Invite invite : invites) {
                invite.accept();
              }
            }
          }
        });

    for (Server server : ServerManager.getServerManager().getServers()) {
      inviteList.add(server, server.getInvites());
      server.addInviteListener(this);
    }

    ActionManager.addListener(this, CoreActionType.CLIENT_FRAME_CHANGED);
    ActionManager.addListener(this, CoreActionType.SERVER_CONNECTED);
    ActionManager.addListener(this, CoreActionType.SERVER_DISCONNECTED);
    ActionManager.addListener(this, CoreActionType.SERVER_CONNECTERROR);

    update();
  }