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//Par1B9.tmp//ParticipantController-HEAD-left.java" "b/C://downloads//waveinabox//src//org//waveprotocol//wave//client//wavepanel//impl//edit//ParticipantController.java"
Diff Revision 2 Diff Revision 3 - 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
    String addressString = Window.prompt("Add a participant: ", "");
96
    ParticipantId p;
97
    if (addressString == null) {
97
    String address = Window.prompt("Add a participant: ", "");

    
   
98
    if (address == null) {
98
      return;
99
      return;
99
    }
100
    }
100
    ParticipantsView participantsUi = views.fromAddButton(context);
101
    address = address.trim();
101
    Conversation conversation = models.getParticipants(participantsUi);

   
102
    String errorString = "";

   
103

    
   

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

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

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

   
107

    
   

   
108
      ParticipantId p;

   
109
      if (localDomain != null) {
102
    if (localDomain != null) {
110
        if (!address.isEmpty() &&  address.indexOf("@") == -1) {
103
      if (!address.isEmpty() &&  address.indexOf("@") == -1) {
111
        // 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.
112
        address = address + "@" + localDomain;
105
        address = address + "@" + localDomain;
113
        } else if (address.equals("@")) {
106
      } else if (address.equals("@")) {
114
        // "@" is a shortcut for the shared domain participant.
107
        // "@" is a shortcut for the shared domain participant.
115
        address = address + localDomain;
108
        address = address + localDomain;
116
        }
109
      }
117
      }
110
    }
118

    
   
111

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

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

    
   
116
      return;
124
      }
117
    }
125

    
   
118

   

    
   
119
    ParticipantsView participantsUi = views.fromAddButton(context);

    
   
120
    Conversation conversation = models.getParticipants(participantsUi);

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

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

   
129
    }

   
130
  }

   
131

    
   
123

   
132
  /**
124
  /**
133
   * Shows a participation popup for the clicked participant.
125
   * Shows a participation popup for the clicked participant.
134
   */
126
   */
135
  private void handleParticipantClicked(Element context) {
127
  private void handleParticipantClicked(Element context) {
[+20] [20] 19 lines
src/org/waveprotocol/wave/client/wavepanel/impl/edit/ParticipantController.java
Diff Revision 2 Diff Revision 3
 
src/org/waveprotocol/wave/model/wave/ParticipantId.java
Diff Revision 2 Diff Revision 3
 
test/org/waveprotocol/wave/model/wave/ParticipantIdTest.java
Diff Revision 2 Diff Revision 3
 
  1. "b/C://downloads//waveinabox//src//org//waveprotocol//wave//client//wavepanel//impl//edit//ParticipantController.java": Loading...
  2. src/org/waveprotocol/wave/client/wavepanel/impl/edit/ParticipantController.java: Loading...
  3. src/org/waveprotocol/wave/model/wave/ParticipantId.java: Loading...
  4. test/org/waveprotocol/wave/model/wave/ParticipantIdTest.java: Loading...