KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > lucane > applications > whiteboard > BoardAction


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;
20
21 import java.io.Serializable JavaDoc;
22 import java.util.ArrayList JavaDoc;
23
24 import org.jgraph.graph.GraphModel;
25 import org.lucane.applications.whiteboard.operations.GraphOperation;
26
27 public class BoardAction implements Serializable JavaDoc
28 {
29     //-- client to server
30
public static final int JOIN_BOARD = 0;
31     public static final int LEAVE_BOARD = 1;
32     public static final int TAKE_PEN = 2;
33     public static final int RELEASE_PEN = 3;
34     
35     //-- server to client
36
public static final int SEND_USER_LIST = 10;
37     public static final int SEND_COMPLETE_GRAPH = 11;
38     public static final int GIVE_PEN = 12;
39     public static final int SERVER_EXIT = 13;
40     
41     //-- common
42
public static final int BROADCAST_OPERATION = 20;
43     public static final int BROADCAST_MODEL = 21;
44     
45     //-- attributes
46
private int action;
47     private String JavaDoc user;
48     private int queueSize;
49     private GraphOperation operation;
50     private GraphModel graphModel;
51     private ArrayList JavaDoc userList;
52     
53     
54     //-- constructors
55
public BoardAction(int action)
56     {
57         this.action = action;
58     }
59
60     public BoardAction(int action, ArrayList JavaDoc userList)
61     {
62         this(action);
63         this.userList = userList;
64     }
65
66     public BoardAction(int action, String JavaDoc user)
67     {
68         this(action);
69         this.user = user;
70     }
71
72     public BoardAction(int action, GraphModel model)
73     {
74         this(action, null, model);
75     }
76
77     public BoardAction(int action, String JavaDoc user, int queueSize)
78     {
79         this(action, user);
80         this.queueSize = queueSize;
81     }
82     
83     public BoardAction(int action, String JavaDoc user, GraphModel model)
84     {
85         this(action, user);
86         this.graphModel = model;
87     }
88     
89     public BoardAction(int action, String JavaDoc user, GraphOperation operation)
90     {
91         this(action);
92         this.user = user;
93         this.operation = operation;
94     }
95     
96     //-- getters
97
public int getAction()
98     {
99         return this.action;
100     }
101     
102     public String JavaDoc getUser()
103     {
104         return this.user;
105     }
106     
107     public GraphModel getGraphModel()
108     {
109         return this.graphModel;
110     }
111     
112     public GraphOperation getOperation()
113     {
114         return this.operation;
115     }
116     
117     public ArrayList JavaDoc getUserList()
118     {
119         return this.userList;
120     }
121     
122     public int getQueueSize()
123     {
124         return this.queueSize;
125     }
126 }
Popular Tags