|
From: <sno...@us...> - 2013-09-09 05:28:09
|
Revision: 76
http://sourceforge.net/p/openrpg/svn/76
Author: snowdog_
Date: 2013-09-09 05:28:04 +0000 (Mon, 09 Sep 2013)
Log Message:
-----------
Added Server Side Module (ClientList) for display of information about groups and connected clients. Required addition of intermodule communication routines within the Group handling code to allow data to be used in ClientList module. Assorted javadoc cleanup/additions in all modified files. TODO - need to add mechanism for modules to be notified when data in other modules has been changed; ModuleManager has skeletal support for this already but it needs fleshed out. --Snowdog
Modified Paths:
--------------
trunk/src/openrpg2/common/core/engine/ModuleManager.java
trunk/src/openrpg2/common/core/group/GroupClient.java
trunk/src/openrpg2/common/core/group/GroupManager.java
trunk/src/openrpg2/common/core/group/GroupMember.java
trunk/src/openrpg2/common/core/group/GroupServerModule.java
trunk/src/openrpg2/server/core/ServerModuleLoader.java
Added Paths:
-----------
trunk/src/openrpg2/common/core/group/GroupInfo.java
trunk/src/openrpg2/server/core/modules/clientlist/
trunk/src/openrpg2/server/core/modules/clientlist/ClientList.java
trunk/src/openrpg2/server/core/modules/clientlist/ClientListTableModel.java
Modified: trunk/src/openrpg2/common/core/engine/ModuleManager.java
===================================================================
--- trunk/src/openrpg2/common/core/engine/ModuleManager.java 2013-09-08 06:40:45 UTC (rev 75)
+++ trunk/src/openrpg2/common/core/engine/ModuleManager.java 2013-09-09 05:28:04 UTC (rev 76)
@@ -20,6 +20,7 @@
*/
package openrpg2.common.core.engine;
+import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JPanel;
import openrpg2.common.core.network.NetworkMessageRelay;
@@ -33,8 +34,10 @@
/**
- * The ModuleManager is the object that oversees and manages all interactions between modules and the rest of the application.
- * It acts as a proxy for the network with respect to the modules and offers inter-module communication services to loaded modules.
+ * The ModuleManager is the object that oversees and manages all interactions
+ * between modules and the rest of the application.
+ * It acts as a proxy for the network with respect to the modules and offers
+ * inter-module communication services to loaded modules.
* @author Snowdog
*/
public class ModuleManager implements NetworkedModuleLocator, ModuleCommunicator{
@@ -82,7 +85,8 @@
return false;
}
/**
- * Sets the ModuleManagers operational mode. This determines which module set will get loaded among other things.
+ * Sets the ModuleManagers operational mode. This determines which module
+ * set will get loaded among other things.
* @param mode Sets the operational mode of the ModuleManager
* @see ORPGConstants#OPMODE_CLIENT
* @see ORPGConstants#OPMODE_SERVER
@@ -137,7 +141,7 @@
/**
* Registers a RouteManager with the ModuleManager
- * @param m Reference to the RouteManager object that will supply message routing serivices.
+ * @param m Reference to the RouteManager object that will supply message routing services.
*/
public void registerRouteManager(RouteManager m){
routeManager = m;
@@ -189,7 +193,7 @@
/**
- * sets the Default Message Handling Module for all unknown messagetypes
+ * sets the Default Message Handling Module for all unknown message types
*/
public void registerDefaultModule(NetworkedModule module){
defaultHandler = module;
@@ -213,12 +217,13 @@
/**
* Locates the handler for a given message type
* @param moduleName Type (ID) of message to be handled.
- * @throws openrpg2.common.core.engine.NoSuchModuleException Thrown if no handler is registered for the given message type.
+ * @throws openrpg2.common.core.engine.NoSuchModuleException Thrown if no
+ * handler is registered for the given message type.
* @return NetworkedModule reference
*/
+ @Override
public NetworkedModule getNetworkedModuleReference(String moduleName) throws NoSuchModuleException{
- NetworkedModule module = null;
- module = messageRegistry.getReference(moduleName);
+ NetworkedModule module = messageRegistry.getReference(moduleName);
if (module == null){
//module not found in main registry check for registered init message
module = messageInitRegistry.getReference(moduleName);
@@ -234,9 +239,9 @@
* @throws openrpg2.common.core.engine.NoSuchModuleException Thrown if no default handler is registered.
* @return default NetworkedModule reference
*/
+ @Override
public NetworkedModule getDefaultModuleReference() throws NoSuchModuleException{
- NetworkedModule module = null;
- module = defaultHandler;
+ NetworkedModule module = defaultHandler;
if (module == null){
//module cannot be found to service messages with ID of moduleName
throw new NoSuchModuleException("No default module registered");
@@ -253,6 +258,7 @@
* @param name Type (ID) of message to deregister
* @param reference Reference to message handler module
*/
+ @Override
public void registerMessageType(String name, NetworkedModule reference){
messageRegistry.register(name, reference);
}
@@ -262,6 +268,7 @@
* @param name Type (ID) of message to register
* @param reference Reference to message handler module
*/
+ @Override
public void registerInitMessageType(String name, NetworkedModule reference){
messageInitRegistry.register(name, reference);
}
@@ -272,6 +279,7 @@
* @param name Type (ID) of message to deregister
* @param reference Reference to message handler module
*/
+ @Override
public void deregisterMessageType(String name, NetworkedModule reference){
try {
NetworkedModule nm = messageRegistry.getReference(name);
@@ -289,6 +297,7 @@
* @param name Type (ID) of message to deregister
* @param reference Reference to message handler module
*/
+ @Override
public void deregisterInitMessageType(String name, NetworkedModule reference){
try {
NetworkedModule nm = messageInitRegistry.getReference(name);
@@ -303,6 +312,7 @@
/**
* Registers a graphical module component (JPanel Object) with the loaded GUIManager
*/
+ @Override
public void registerGUIComponent(String moduleName, JPanel modulePanel){
guiManager.addModuleGUI(moduleName, modulePanel);
}
@@ -310,6 +320,7 @@
/**
* Deregisters a graphical module component (JPanel Object) from the loaded GUIManager
*/
+ @Override
public void deregisterGUIComponent(String moduleName){
guiManager.removeModuleGUI(moduleName);
}
@@ -320,9 +331,10 @@
* @param msg ORPGMessage to send
* @throws openrpg2.common.core.engine.ModuleCommunicationException Thrown if network is not available.
*/
+ @Override
public void sendToNetwork( ORPGMessage msg ) throws ModuleCommunicationException{
if ( msg.getDestination() == null){
- log.warning("Message for module "+msg.getHandlerId()+" dropped due to missing address information.");
+ log.log(Level.WARNING, "Message for module {0} dropped due to missing address information.", msg.getHandlerId());
return;
}
if ( ! isInitialized() ){
@@ -332,14 +344,17 @@
}
+ @Override
public void deregisterOperationInterest(int operationIdentifier, BaseModule moduleReference){
//TODO
}
+ @Override
public void registerOperationInterest(int operationIdentifier, BaseModule moduleReference){
//TODO
}
+ @Override
public Object requestModuleData(String fromModule, String nameOfData ) throws NoSuchModuleException, InvalidDataRequestException{
if ( ! isInitialized() ){
throw new NoSuchModuleException("ModuleManager not initialized. No modules available");
@@ -350,6 +365,8 @@
}
return m.getModuleData(nameOfData);
}
+
+ @Override
public Object requestModuleAction(String fromModule, String actionName, Object[] args) throws NoSuchModuleException, InvalidActionRequestException, IllegalArgumentException{
if ( ! isInitialized() ){
throw new NoSuchModuleException("ModuleManager not initialized. No modules available");
Modified: trunk/src/openrpg2/common/core/group/GroupClient.java
===================================================================
--- trunk/src/openrpg2/common/core/group/GroupClient.java 2013-09-08 06:40:45 UTC (rev 75)
+++ trunk/src/openrpg2/common/core/group/GroupClient.java 2013-09-09 05:28:04 UTC (rev 76)
@@ -23,7 +23,7 @@
/**
* This class represents client data that should remain consistent
- * across all groups the client is invloved in.
+ * across all groups the client is involved in.
*
* Data that should exist on a per-group basis (like display name
* and role settings) should be placed in GroupMember instead
@@ -85,4 +85,29 @@
return defaultDisplayName;
}
+ public void setModerator(boolean flag){
+ this.serverModeratorFlag = flag;
+ }
+
+ public boolean isModerator(){ return this.serverModeratorFlag; }
+
+ public void setAdminstrator(boolean flag){
+ this.serverAdministratorFlag = flag;
+ }
+ public boolean isAdminstrator(){ return this.serverAdministratorFlag; }
+
+ /**
+ * Creates a duplicate of the original GroupMember to allow safe 'read only'
+ * copies of the object (deep copy).
+ * @return a new GroupMember object with the same information as original
+ */
+ public GroupClient duplicate(){
+ GroupClient g = new GroupClient(this.networkId);
+ g.setActualName(this.actualName);
+ g.setDefaultDisplayName(this.defaultDisplayName);
+ g.setModerator(this.serverModeratorFlag);
+ g.setAdminstrator(this.serverAdministratorFlag);
+ return g;
+ }
+
}
Added: trunk/src/openrpg2/common/core/group/GroupInfo.java
===================================================================
--- trunk/src/openrpg2/common/core/group/GroupInfo.java (rev 0)
+++ trunk/src/openrpg2/common/core/group/GroupInfo.java 2013-09-09 05:28:04 UTC (rev 76)
@@ -0,0 +1,46 @@
+/*
+ * GroupMember.java
+ *
+ * Author: Snowdog
+ * Created: September 8, 2013 8:15 PM
+ *
+ * ====================================================================
+ * Copyright (C) 2005-2006 The OpenRPG Project (www.openrpg.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License on www.gnu.org for more details.
+ * ====================================================================
+ */
+
+package openrpg2.common.core.group;
+
+/**
+ * Simple data class to transfer basic group information to other modules
+ * in a safe, non destructive manner. After all we don't want other modules
+ * messing with the Group or Client info behind the scenes! We want them to
+ * do their operations on a COPY of the data.
+ *
+ * @author snowdog
+ */
+public class GroupInfo {
+ public boolean persistant = false;
+ public int groupId = 0;
+ public String groupName = null;
+ public String groupShortDescription = "";
+ public String groupLongDescription ="";
+
+ public GroupInfo(Group g){
+ this.groupId = g.getGroupId();
+ this.groupName = g.getName();
+ this.groupShortDescription = g.getShortDescription();
+ this.groupLongDescription = g.getLongDescription();
+ this.persistant = g.isPersistantGroup();
+ }
+}
Modified: trunk/src/openrpg2/common/core/group/GroupManager.java
===================================================================
--- trunk/src/openrpg2/common/core/group/GroupManager.java 2013-09-08 06:40:45 UTC (rev 75)
+++ trunk/src/openrpg2/common/core/group/GroupManager.java 2013-09-09 05:28:04 UTC (rev 76)
@@ -21,10 +21,13 @@
package openrpg2.common.core.group;
+import java.util.ArrayList;
import java.util.Enumeration;
+import java.util.HashMap;
import java.util.Hashtable;
import java.util.Observable;
import java.util.Observer;
+import java.util.Vector;
import java.util.logging.Logger;
import openrpg2.common.core.network.NetworkClientState;
import openrpg2.common.core.network.NetworkConnectionAlerter;
@@ -110,7 +113,7 @@
* Internal method. Adds a new Group to the GroupManager with specific id number and name.
* @param id id number to assign to new Group
* @param groupName name to assign to new Group
- * @return int. Id of newly created Group
+ * @return Integer. Id of newly created Group
*/
private synchronized boolean addGroup(int id, String groupName){
Integer gid = new Integer(id);
@@ -327,7 +330,7 @@
}
}
- public void DEBUG_PRINTGROUPTREE(){
+ public void DEBUG_PRINTGROUPTREE(){
Enumeration groups = groupList.elements();
while (groups.hasMoreElements()){
Group g = (Group)groups.nextElement();
@@ -348,6 +351,38 @@
}
System.out.println("");
}
+ }
+
+ /**
+ * Generates an ArrayList of HashMaps containing "group","member", and
+ * "role" data for each group member for sharing client & group info with
+ * other modules.
+ *
+ * @return ArrayList of HashMaps
+ */
+ public ArrayList getClientAndGroupInfo(){
+ ArrayList<HashMap> list = new ArrayList<>();
+ Enumeration groups = groupList.elements();
+ while (groups.hasMoreElements()){
+ Group g = (Group)groups.nextElement();
+ GroupInfo gi = new GroupInfo(g);
+
+ Enumeration members = g.getMembers();
+ while( members.hasMoreElements()){
+ GroupMember m = (GroupMember)members.nextElement();
+ MemberRole r=null;
+ try { r = g.getRole(m); }
+ catch (InvalidMemberException ex) { /* ignored */}
+
+ HashMap info = new HashMap();
+ info.put("group", gi );
+ info.put("member",m.duplicate());
+ info.put("role",r);
+ list.add(info);
+ }
+
+ }
+ return list;
}
/**
Modified: trunk/src/openrpg2/common/core/group/GroupMember.java
===================================================================
--- trunk/src/openrpg2/common/core/group/GroupMember.java 2013-09-08 06:40:45 UTC (rev 75)
+++ trunk/src/openrpg2/common/core/group/GroupMember.java 2013-09-09 05:28:04 UTC (rev 76)
@@ -24,7 +24,9 @@
/**
* The GroupMember class defines the characteristics of a single group
* member. This class contains only information specific to a single
- * group for a given client.
+ * group for a given client. This class is essentially simply a wrapper for a
+ * GroupClient object that allows an Alias Name to be assigned for a specific
+ * group only.
*
* Group information specific to the client and outside of 'group scope'
* should be placed in GroupClient instead.
@@ -36,16 +38,16 @@
final static private String DEFAULTNAME = "Player-";
private GroupClient client = null;
- private String displayName = null; //used for display of name where ID number is not appropriate (optional)
+ private String aliasName = null; //used for display of name where ID number is not appropriate (optional)
- /** Creates a new instance of GroupMember */
- // public GroupMember() {
- //}
-
public GroupMember(GroupClient clientReference){
client = clientReference;
}
+ public GroupMember(GroupClient clientReference, String aliasname){
+ client = clientReference;
+ this.aliasName = aliasname;
+ }
public void setGroupClient(GroupClient clientReference){
client = clientReference;
@@ -73,15 +75,35 @@
}
public void setDisplayName(String name){
- displayName = name;
+ aliasName = name;
}
public String getDisplayName(){
- if (displayName != null){
- return displayName;
+ if (aliasName != null){
+ return aliasName;
}else{
return client.getDefaultDisplayName();
}
}
+ public void setModerator(boolean flag){
+ this.client.setModerator(flag);
+ }
+
+ public boolean isModerator(){ return this.client.isModerator(); }
+
+ public void setAdminstrator(boolean flag){
+ this.client.setAdminstrator(flag);
+ }
+ public boolean isAdminstrator(){ return this.client.isAdminstrator(); }
+
+ /**
+ * Creates a duplicate of the original GroupMember to allow safe 'read only'
+ * copies of the object (deep copy).
+ * @return a new GroupMember object with the same information as original
+ */
+ public GroupMember duplicate(){
+ GroupClient g = this.client.duplicate();
+ return new GroupMember(g, this.aliasName);
+ }
}
Modified: trunk/src/openrpg2/common/core/group/GroupServerModule.java
===================================================================
--- trunk/src/openrpg2/common/core/group/GroupServerModule.java 2013-09-08 06:40:45 UTC (rev 75)
+++ trunk/src/openrpg2/common/core/group/GroupServerModule.java 2013-09-09 05:28:04 UTC (rev 76)
@@ -21,8 +21,10 @@
package openrpg2.common.core.group;
+import java.util.logging.Level;
import openrpg2.common.core.ORPGConstants;
import openrpg2.common.core.ORPGMessage;
+import openrpg2.common.core.engine.InvalidActionRequestException;
import openrpg2.common.core.route.MessageAddress;
import openrpg2.common.core.route.AddressToken;
import openrpg2.common.module.NetworkedModule;
@@ -35,6 +37,7 @@
public class GroupServerModule extends NetworkedModule implements ServerLoadable{
private GroupManager groupManager = null;
+ static final public String ACTION_GET_INFO = "getInfo"; //module Action String
/** Creates a new instance of GroupServerModule */
public GroupServerModule(GroupManager grpmgr) {
@@ -119,8 +122,8 @@
//create the room for the client
int g = groupManager.addGroup(name);
- if(g <= groupManager.LOBBY_ID){ //bailout with warning if no group created.
- log.warning("Group add failed for client "+requestingClient);
+ if(g <= GroupManager.LOBBY_ID){ //bailout with warning if no group created.
+ log.log(Level.WARNING, "Group add failed for client {0}", requestingClient);
return;
}
@@ -168,4 +171,12 @@
return msg;
}
+
+ @Override
+ public Object performModuleAction(String actionName, Object[] args) throws InvalidActionRequestException, IllegalArgumentException{
+ if( actionName.equals(GroupServerModule.ACTION_GET_INFO)){
+ return this.groupManager.getClientAndGroupInfo();
+ }
+ throw new InvalidActionRequestException("No Such Action");
+ }
}
\ No newline at end of file
Modified: trunk/src/openrpg2/server/core/ServerModuleLoader.java
===================================================================
--- trunk/src/openrpg2/server/core/ServerModuleLoader.java 2013-09-08 06:40:45 UTC (rev 75)
+++ trunk/src/openrpg2/server/core/ServerModuleLoader.java 2013-09-09 05:28:04 UTC (rev 76)
@@ -22,11 +22,11 @@
package openrpg2.server.core;
import openrpg2.common.core.engine.ModuleLoader;
-import openrpg2.common.core.engine.ModuleManager;
import openrpg2.server.core.modules.DefaultRelay;
+import openrpg2.server.core.modules.clientlist.ClientList;
/**
- *
+ * The ServerModuleLoader handles loading all modules used by the server.
* @author Snowdog
*/
public class ServerModuleLoader extends ModuleLoader{
@@ -37,17 +37,47 @@
/**
* Loads the default NetworkedModule that will handle all unknown message types.
*/
+ @Override
protected void loadDefaultModule(){
moduleManager.registerDefaultModule(new DefaultRelay());
}
-
+ /**
+ * Loads all core (ie required and default ) modules for the server.
+ * @see loadRequiredModules()
+ * @see loadServiceModules()
+ */
+ @Override
protected void loadCoreModules(){
- //TODO: load all core server modules
+ loadRequiredModules();
+ loadServiceModules();
}
/**
- * Loads 3rd party (user supplied) modules located in a specific directory (path) using dynamic loading
+ * Modules required for server to function properly should be registered
+ * with the moduleManager in this method. This method simply notes to
+ * future developers which modules need to be handled carefully to avoid
+ * 'breaking' the server.
*/
+ private void loadRequiredModules(){
+ //currently no REQUIRED modules exist!!
+ }
+ /**
+ * Modules that are NOT CRITICAL for server to function should be registered
+ * with the moduleManager in this method. Changes to modules loaded in this
+ * method should NOT break the servers ability to run and handle messages.
+ * Methods registered in this method should be those that add information
+ * display or additional features to the server.
+ */
+ private void loadServiceModules(){
+ moduleManager.registerModule(new ClientList());
+ }
+
+
+ /**
+ * Loads 3rd party (user supplied) modules located in a specific
+ * directory (path) using dynamic loading.
+ */
+ @Override
protected void loadUserModules(){
//TODO: check user plugin directory for modules that declare themselves as 'server modules' and load them
}
Added: trunk/src/openrpg2/server/core/modules/clientlist/ClientList.java
===================================================================
--- trunk/src/openrpg2/server/core/modules/clientlist/ClientList.java (rev 0)
+++ trunk/src/openrpg2/server/core/modules/clientlist/ClientList.java 2013-09-09 05:28:04 UTC (rev 76)
@@ -0,0 +1,72 @@
+/*
+ * ClientList.java
+ *
+ * Created on September 8, 2013, 2:31 PM
+ *
+ * ====================================================================
+ * Copyright (C) 2005-2013 The OpenRPG Project (www.openrpg.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License on www.gnu.org for more details.
+ * ====================================================================
+ */
+package openrpg2.server.core.modules.clientlist;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import openrpg2.common.module.BaseModule;
+import openrpg2.common.module.ServerLoadable;
+
+/**
+ * Server Module for displaying information about currently connected clients.
+ * @author snowdog
+ */
+public class ClientList extends BaseModule implements ServerLoadable{
+
+ public JPanel panel = null;
+ private JTable table = null;
+ private ClientListTableModel dataSource = null;
+
+ public ClientList(){
+ this.setModuleAuthor("Snowdog");
+ this.setModuleShortDescription("Client List for Server");
+
+ this.dataSource = new ClientListTableModel(this.modCom);
+
+ buildGUI();
+
+ log.info("Module Instanced.");
+ }
+
+ private void buildGUI(){
+ panel = new JPanel();
+ panel.setLayout(new BorderLayout());
+ panel.setPreferredSize(new Dimension(250,60));
+
+ table = new JTable(this.dataSource);
+
+
+ JScrollPane sp = new JScrollPane(table);
+ table.setFillsViewportHeight(false);
+ panel.add(sp, BorderLayout.CENTER);
+
+
+ }
+
+ @Override
+ protected void doRegistration() {
+ this.modCom.registerGUIComponent("Client List", panel);
+
+ }
+
+}
Added: trunk/src/openrpg2/server/core/modules/clientlist/ClientListTableModel.java
===================================================================
--- trunk/src/openrpg2/server/core/modules/clientlist/ClientListTableModel.java (rev 0)
+++ trunk/src/openrpg2/server/core/modules/clientlist/ClientListTableModel.java 2013-09-09 05:28:04 UTC (rev 76)
@@ -0,0 +1,97 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package openrpg2.server.core.modules.clientlist;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.swing.table.AbstractTableModel;
+import openrpg2.common.core.engine.InvalidActionRequestException;
+import openrpg2.common.core.engine.ModuleCommunicator;
+import openrpg2.common.core.engine.NoSuchModuleException;
+import openrpg2.common.core.group.GroupInfo;
+import openrpg2.common.core.group.GroupMember;
+import openrpg2.common.core.group.GroupServerModule;
+import openrpg2.common.core.group.MemberRole;
+
+/**
+ * Table Model for the client list display
+ * @author snowdog
+ */
+public class ClientListTableModel extends AbstractTableModel {
+
+ private String[] columnNames = {"Room","Room Name", "ID", "User", "Alias","Role","Last","Time"};
+ private ArrayList<HashMap> rowData;
+ private ModuleCommunicator mc= null;
+
+
+ public ClientListTableModel(ModuleCommunicator mc){
+ this.mc = mc;
+ rowData = new ArrayList<>();
+ }
+
+
+ public void updateData(){
+ try {
+ rowData = (ArrayList<HashMap>)this.mc.requestModuleAction("GroupServerModule", GroupServerModule.ACTION_GET_INFO, null);
+
+ } catch (NoSuchModuleException ex) {
+ Logger.getLogger(ClientListTableModel.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
+ } catch (InvalidActionRequestException ex) {
+ Logger.getLogger(ClientListTableModel.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
+ } catch (IllegalArgumentException ex) {
+ Logger.getLogger(ClientListTableModel.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
+ }
+
+ }
+
+
+ @Override
+ public String getColumnName(int col) {
+ return columnNames[col].toString();
+ }
+
+
+ @Override
+ public int getRowCount() { return rowData.size(); }
+
+
+ @Override
+ public int getColumnCount() { return columnNames.length; }
+
+
+ @Override
+ public Object getValueAt(int row, int col) {
+ HashMap data = this.rowData.get(row);
+ //"Room","Room Name", "ID","User", "Alias","Role","Last","Time"};
+ //hashmap keys..."group" "member" "role"
+ GroupInfo g = (GroupInfo)data.get("group");
+ MemberRole r = (MemberRole)data.get("role");
+ GroupMember m = (GroupMember)data.get("member");
+
+ switch(col){
+ case 0:{ return new Integer(g.groupId);}
+ case 1:{ return g.groupName;}
+ case 2:{ return m.getNetworkId();}
+ case 3:{ return m.getActualName();}
+ case 4:{ return m.getDisplayName();}
+ case 5:{ return r.getRoleString();}
+ case 6:{ return "0s"; }
+ case 7:{ return "00:00a";}
+ }
+ return new Object();
+ }
+ @Override
+ public boolean isCellEditable(int row, int col)
+ { return true; }
+
+
+ @Override
+ public void setValueAt(Object value, int row, int col) {
+ //do nothing!! viewer only!
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|