예제 #1
0
  public void addUser(String userid) {
    Object[] row = createRow(userid);
    if (row == null) return;

    ml.addUser(userid);
    addRow(row);
  }
예제 #2
0
 public void removeUser(String userid) {
   ml.removeUser(userid);
   for (int i = 0; i < getRowCount(); i++) {
     if (getUserIdAt(i).equals(userid)) {
       removeRow(i);
       return;
     }
   }
 }
예제 #3
0
  public MLTableModel(CourseMailingList ml) {
    super(new String[] {"User ID", "User Name", "Mail"}, 0);
    this.ml = ml;

    ArrayList<String> userids = ml.getUserIdList();
    for (String userid : userids) {
      Object[] row = createRow(userid);
      super.addRow(row);
    }
  }
예제 #4
0
  public void sendReport() {
    int aws =
        JOptionPane.showConfirmDialog(
            null,
            "Do you want to send all users.\nPress YES: Send all users.\nPress NO: Send only selected users",
            "Sending Mail or Report Confirm",
            JOptionPane.YES_NO_CANCEL_OPTION);
    if (aws == JOptionPane.CANCEL_OPTION) return;
    boolean all = (aws == JOptionPane.OK_OPTION);

    CourseMailingList ml = getMLTableModel().ml;
    if (all) {
      ml.sendReport(null, null);
    } else {
      ArrayList<String> selectedUserIdList = getSelectedUserIdList();
      if (selectedUserIdList.size() == 0) {
        JOptionPane.showMessageDialog(null, "You should select one user at least to send mail");
        return;
      }
      ml.sendReport(selectedUserIdList, null);
    }
    JOptionPane.showMessageDialog(null, "Report sent");
  }