KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > lucane > applications > whiteboard > gui > InviteAction


1 /*
2  * Lucane - a collaborative platform
3  * Copyright (C) 2004 Vincent Fiack <vfiack@mail15.com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */

19 package org.lucane.applications.whiteboard.gui;
20
21 import java.awt.event.ActionEvent JavaDoc;
22 import javax.swing.AbstractAction JavaDoc;
23 import javax.swing.Action JavaDoc;
24
25 import org.lucane.applications.whiteboard.WhiteBoard;
26 import org.lucane.client.Client;
27 import org.lucane.client.Communicator;
28 import org.lucane.client.widgets.ListBox;
29 import org.lucane.common.ConnectInfo;
30
31 public class InviteAction extends AbstractAction JavaDoc
32 {
33     private WhiteBoard plugin;
34     
35     public InviteAction(WhiteBoard plugin)
36     {
37         this.plugin = plugin;
38         putValue(Action.SMALL_ICON, plugin.getImageIcon("face2.png"));
39         putValue(Action.NAME, plugin.tr("lbl.invite"));
40         putValue(Action.SHORT_DESCRIPTION, plugin.tr("tip.invite"));
41     }
42     
43     public void actionPerformed(ActionEvent JavaDoc ae)
44     {
45         ListBox userList = new ListBox(null, plugin.getTitle(),
46                 plugin.tr("msg.selectUsers"), Client.getInstance().getUserList());
47         Object JavaDoc[] users = userList.selectItems();
48         if(users != null)
49         {
50             ConnectInfo[] friends = new ConnectInfo[users.length];
51             for(int i=0;i<friends.length;i++)
52                 friends[i] = Communicator.getInstance().getConnectInfo((String JavaDoc)users[i]);
53             
54             plugin.sendInvitations(friends);
55         }
56     }
57 }
Popular Tags