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

Diff revision 3

This is not the most recent revision of the diff. The latest diff is revision 6. See what's changed.

1 2 3 4 5 6
1 2 3 4 5 6

  1. src/org/waveprotocol/wave/client/wavepanel/impl/edit/ParticipantController.java: Loading...
  2. src/org/waveprotocol/wave/model/wave/ParticipantId.java: Loading...
  3. test/org/waveprotocol/wave/model/wave/ParticipantIdTest.java: Loading...
src/org/waveprotocol/wave/client/wavepanel/impl/edit/ParticipantController.java
Revision ec9e25a New Change
[20] 90 lines
[+20] [+] public boolean onClick(ClickEvent event, Element context) {
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
    ParticipantId p;
96
    String addressString = Window.prompt("Add a participant(s) (separate with comma ','): ", "");
97
    String address = Window.prompt("Add a participant: ", "");
97
    if (addressString == null) {
98
    if (address == null) {

   
99
      return;
98
      return;
100
    }
99
    }
101
    address = address.trim();

   
102
    if (localDomain != null) {

   
103
      if (!address.isEmpty() &&  address.indexOf("@") == -1) {

   
104
        // If no domain was specified, assume that the participant is from the local domain.

   
105
        address = address + "@" + localDomain;

   
106
      } else if (address.equals("@")) {

   
107
        // "@" is a shortcut for the shared domain participant.

   
108
        address = address + localDomain;

   
109
      }

   
110
    }

   
111

    
   
100

   

    
   
101
    ParticipantId[] participantList;

    
   
102

   
112
    try {
103
    try {
113
      p = ParticipantId.of(address);
104
      participantList = ParticipantId.buildParticipantList(localDomain, addressString);
114
    } catch (InvalidParticipantAddress e) {
105
    } catch (InvalidParticipantAddress e) {
115
      Window.alert("Invalid address: " + address);
106
      Window.alert(e.getMessage());
116
      return;
107
      return;
117
    }
108
    }
118

    
   
109

   
119
    ParticipantsView participantsUi = views.fromAddButton(context);
110
    ParticipantsView participantsUi = views.fromAddButton(context);
120
    Conversation conversation = models.getParticipants(participantsUi);
111
    Conversation conversation = models.getParticipants(participantsUi);
121
    conversation.addParticipant(p);
112
    for (int i=0;i<participantList.length;i++) {

    
   
113
      conversation.addParticipant(participantList[i]);

    
   
114
    }
122
  }
115
  }
123

    
   
116

   
124
  /**
117
  /**
125
   * Shows a participation popup for the clicked participant.
118
   * Shows a participation popup for the clicked participant.
126
   */
119
   */
[+20] [20] 20 lines
src/org/waveprotocol/wave/model/wave/ParticipantId.java
Revision a5dbdf6 New Change
 
test/org/waveprotocol/wave/model/wave/ParticipantIdTest.java
Revision 58a2772 New Change
 
  1. src/org/waveprotocol/wave/client/wavepanel/impl/edit/ParticipantController.java: Loading...
  2. src/org/waveprotocol/wave/model/wave/ParticipantId.java: Loading...
  3. test/org/waveprotocol/wave/model/wave/ParticipantIdTest.java: Loading...