Review Board 1.7.22


Implement wave-317: Allow adding (copy/pasting) multiple participants into a wave

Review Request #3882 - Created Feb. 13, 2012 and submitted

rocklund
trunk
wave-317
Reviewers
wave
wave
Implemented as suggested in the jira-issue as a client side implementation in ParticipantController.java. I selected the separator for the multiple participant list to be comma (,) as stated in the jira issue.
Compiled and run.

* Tested to add single as well as multiple participants
* Tested to add participants both with and without @localhost
* Tested to add invalid participants

"a/C://wintmp//Par19E.tmp//ParticipantController-285e0b-left.java" "b/C://wintmp//Par19D.tmp//ParticipantController-9b8e70-right.java"
Diff Revision 1 Diff Revision 2 - File Reverted
[20] 90 lines
[+20]
91

    
   
91

   
92
  /**
92
  /**
93
   * Shows an add-participant popup.
93
   * Shows an add-participant popup.
94
   */
94
   */
95
  private void handleAddButtonClicked(Element context) {
95
  private void handleAddButtonClicked(Element context) {
96
    
96
    ParticipantId p;
97
    String addressString = Window.prompt("Add a participant: ", "");
97
    String address = Window.prompt("Add a participant: ", "");
98
    if (addressString == null) {
98
    if (address == null) {
99
      return;
99
      return;
100
    }
100
    }
101
    ParticipantsView participantsUi = views.fromAddButton(context);
101
    address = address.trim();
102
    Conversation conversation = models.getParticipants(participantsUi);

   
103
    String errorString = "";

   
104

    
   

   
105
    String[] addresses = addressString.split(";");

   
106
    for (int i=0;i<addresses.length;i++) {

   
107
      String address = addresses[i].trim();

   
108
      

   
109
      ParticipantId p;

   
110
      if (localDomain != null) {
102
    if (localDomain != null) {
111
        if (!address.isEmpty() &&  address.indexOf("@") == -1) {
103
      if (!address.isEmpty() &&  address.indexOf("@") == -1) {
112
        // If no domain was specified, assume that the participant is from the local domain.
104
        // If no domain was specified, assume that the participant is from the local domain.
113
        address = address + "@" + localDomain;
105
        address = address + "@" + localDomain;
114
        } else if (address.equals("@")) {
106
      } else if (address.equals("@")) {
115
        // "@" is a shortcut for the shared domain participant.
107
        // "@" is a shortcut for the shared domain participant.
116
        address = address + localDomain;
108
        address = address + localDomain;
117
        }
109
      }
118
      }
110
    }
119

    
   
111

   
120
      try {
112
    try {
121
        p = ParticipantId.of(address);
113
      p = ParticipantId.of(address);
122
        conversation.addParticipant(p);

   
123
      } catch (InvalidParticipantAddress e) {
114
    } catch (InvalidParticipantAddress e) {
124
        errorString += address + " ";
115
      Window.alert("Invalid address: " + address);

    
   
116
      return;
125
      }
117
    }
126

    
   
118

   

    
   
119
    ParticipantsView participantsUi = views.fromAddButton(context);

    
   
120
    Conversation conversation = models.getParticipants(participantsUi);

    
   
121
    conversation.addParticipant(p);
127
    }
122
  }
128
    if (!errorString.equals("")) {

   
129
      Window.alert("Invalid address(es): " + errorString);

   
130
    }

   
131
  }

   
132

    
   
123

   
133
  /**
124
  /**
134
   * Shows a participation popup for the clicked participant.
125
   * Shows a participation popup for the clicked participant.
135
   */
126
   */
136
  private void handleParticipantClicked(Element context) {
127
  private void handleParticipantClicked(Element context) {
[+20] [20] 19 lines
"a/C://wintmp//Par1B9.tmp//ParticipantController-HEAD-left.java"
Diff Revision 1 Diff Revision 2
 
  1. "b/C://wintmp//Par19D.tmp//ParticipantController-9b8e70-right.java": Loading...
  2. "b/C://downloads//waveinabox//src//org//waveprotocol//wave//client//wavepanel//impl//edit//ParticipantController.java": Loading...