Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "serverstatuspage.h"
Toshihiro Shimizu 890ddd
#include "tfarmcontroller.h"
Toshihiro Shimizu 890ddd
#include "application.h"
Toshihiro Shimizu 890ddd
#include "textlist.h"
Toshihiro Shimizu 890ddd
#include "tw/mainshell.h"
Toshihiro Shimizu 890ddd
#include "tw/textfield.h"
Toshihiro Shimizu 890ddd
#include "tw/event.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tw/message.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include <vector></vector>
Toshihiro Shimizu 890ddd
#include <set></set>
Toshihiro Shimizu 890ddd
using namespace std;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//==============================================================================
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class ServerList : public TTextList
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	ServerList(TWidget *parent);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void rightButtonDown(const TMouseEvent &e);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void onDeactivate();
Toshihiro Shimizu 890ddd
	void onActivate();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TPopupMenuItem *m_activationItem;
Toshihiro Shimizu 890ddd
	TPopupMenu *m_popupMenu;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
ServerList::ServerList(TWidget *parent)
Toshihiro Shimizu 890ddd
	: TTextList(parent, "servers")
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_popupMenu = new TPopupMenu(this);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TPopupMenuItem *item = new TPopupMenuItem(m_popupMenu, "deactivate");
Toshihiro Shimizu 890ddd
	TGuiCommand("deactivate").setAction(new TCommandAction<serverlist>(this, onDeactivate));</serverlist>
Toshihiro Shimizu 890ddd
	TGuiCommand("deactivate").add(item);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	item = new TPopupMenuItem(m_popupMenu, "activate");
Toshihiro Shimizu 890ddd
	TGuiCommand("activate").setAction(new TCommandAction<serverlist>(this, onActivate));</serverlist>
Toshihiro Shimizu 890ddd
	TGuiCommand("activate").add(item);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void ServerList::rightButtonDown(const TMouseEvent &e)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	leftButtonDown(e);
Toshihiro Shimizu 890ddd
	TTextListItem *item = getSelectedItem(0);
Toshihiro Shimizu 890ddd
	if (item) {
Toshihiro Shimizu 890ddd
		TFarmController *controller = Application::instance()->getController();
Toshihiro Shimizu 890ddd
		ServerState state;
Toshihiro Shimizu 890ddd
		try {
Toshihiro Shimizu 890ddd
			state = controller->queryServerState2(item->getId());
Toshihiro Shimizu 890ddd
		} catch (TException &e) {
Toshihiro Shimizu 890ddd
			TMessage::error(toString(e.getMessage()));
Toshihiro Shimizu 890ddd
			return;
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		if (state != Offline) {
Toshihiro Shimizu 890ddd
			TGuiCommand("activate").disable();
Toshihiro Shimizu 890ddd
			TGuiCommand("deactivate").enable();
Toshihiro Shimizu 890ddd
		} else {
Toshihiro Shimizu 890ddd
			TGuiCommand("activate").enable();
Toshihiro Shimizu 890ddd
			TGuiCommand("deactivate").disable();
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		TPoint pos = getAbsolutePosition() + TPoint(e.m_pos.x, getSize().ly - e.m_pos.y);
Toshihiro Shimizu 890ddd
		m_popupMenu->popup(pos);
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void ServerList::onDeactivate()
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	TTextListItem *item = getSelectedItem(0);
Toshihiro Shimizu 890ddd
	if (item) {
Toshihiro Shimizu 890ddd
		TFarmController *controller = Application::instance()->getController();
Toshihiro Shimizu 890ddd
		try {
Toshihiro Shimizu 890ddd
			controller->deactivateServer(item->getId());
Toshihiro Shimizu 890ddd
		} catch (TException &e) {
Toshihiro Shimizu 890ddd
			TMessage::error(toString(e.getMessage()));
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void ServerList::onActivate()
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	TTextListItem *item = getSelectedItem(0);
Toshihiro Shimizu 890ddd
	if (item) {
Toshihiro Shimizu 890ddd
		TFarmController *controller = Application::instance()->getController();
Toshihiro Shimizu 890ddd
		try {
Toshihiro Shimizu 890ddd
			controller->activateServer(item->getId());
Toshihiro Shimizu 890ddd
		} catch (TException &e) {
Toshihiro Shimizu 890ddd
			TMessage::error(toString(e.getMessage()));
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//==============================================================================
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class ServerStatusPage::Data
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	Data(ServerStatusPage *parent)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		m_serverList = new ServerList(parent);
Toshihiro Shimizu 890ddd
		m_serverList->setSelAction(new TTextListAction<data>(</data>
Toshihiro Shimizu 890ddd
			this, &Data::onServerSelection));
Toshihiro Shimizu 890ddd
		m_name = new TTextField(parent, "name");
Toshihiro Shimizu 890ddd
		m_ipAddress = new TTextField(parent, "ipAddress");
Toshihiro Shimizu 890ddd
		m_portNumber = new TTextField(parent, "portNumber");
Toshihiro Shimizu 890ddd
		m_tasks = new TTextField(parent, "tasks");
Toshihiro Shimizu 890ddd
		m_state = new TTextField(parent, "state");
Toshihiro Shimizu 890ddd
		m_cpuCount = new TTextField(parent, "cpuCount");
Toshihiro Shimizu 890ddd
		m_totPhysMem = new TTextField(parent, "totalPhysMemory");
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		m_nameLbl = new TLabel(parent, "name");
Toshihiro Shimizu 890ddd
		m_ipAddressLbl = new TLabel(parent, "ipAddress");
Toshihiro Shimizu 890ddd
		m_portNumberLbl = new TLabel(parent, "portNumber");
Toshihiro Shimizu 890ddd
		m_tasksLbl = new TLabel(parent, "tasks");
Toshihiro Shimizu 890ddd
		m_stateLbl = new TLabel(parent, "state");
Toshihiro Shimizu 890ddd
		m_cpuCountLbl = new TLabel(parent, "cpuCount");
Toshihiro Shimizu 890ddd
		m_totPhysMemLbl = new TLabel(parent, "totalPhysMemory");
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	~Data() {}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void onServerSelection(int index)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		TTextListItem *item = m_serverList->getSelectedItem(0);
Toshihiro Shimizu 890ddd
		if (item) {
Toshihiro Shimizu 890ddd
			showServerInfo(item->getId());
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void showServerInfo(const string &id)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		TFarmController *controller = Application::instance()->getController();
Toshihiro Shimizu 890ddd
		ServerInfo info;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		try {
Toshihiro Shimizu 890ddd
			controller->queryServerInfo(id, info);
Toshihiro Shimizu 890ddd
		} catch (TException &e) {
Toshihiro Shimizu 890ddd
			TMessage::error(toString(e.getMessage()));
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		switch (info.m_state) {
Toshihiro Shimizu 890ddd
		case Ready:
Toshihiro Shimizu 890ddd
			m_state->setText("Ready");
Toshihiro Shimizu 890ddd
			break;
Toshihiro Shimizu 890ddd
		case Busy:
Toshihiro Shimizu 890ddd
			m_state->setText("Busy");
Toshihiro Shimizu 890ddd
			break;
Toshihiro Shimizu 890ddd
		case NotResponding:
Toshihiro Shimizu 890ddd
			m_state->setText("Not Responding");
Toshihiro Shimizu 890ddd
			break;
Toshihiro Shimizu 890ddd
		case Down:
Toshihiro Shimizu 890ddd
			m_state->setText("Down");
Toshihiro Shimizu 890ddd
			break;
Toshihiro Shimizu 890ddd
		case Offline:
Toshihiro Shimizu 890ddd
			m_state->setText("Offline");
Toshihiro Shimizu 890ddd
			break;
Toshihiro Shimizu 890ddd
		case ServerUnknown:
Toshihiro Shimizu 890ddd
			m_state->setText("");
Toshihiro Shimizu 890ddd
			m_name->setText("");
Toshihiro Shimizu 890ddd
			m_ipAddress->setText("");
Toshihiro Shimizu 890ddd
			m_portNumber->setText("");
Toshihiro Shimizu 890ddd
			m_tasks->setText("");
Toshihiro Shimizu 890ddd
			m_cpuCount->setText("");
Toshihiro Shimizu 890ddd
			m_totPhysMem->setText("");
Toshihiro Shimizu 890ddd
			return;
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		m_name->setText(info.m_name);
Toshihiro Shimizu 890ddd
		m_ipAddress->setText(info.m_ipAddress);
Toshihiro Shimizu 890ddd
		m_portNumber->setText(info.m_portNumber);
Toshihiro Shimizu 890ddd
		if (info.m_currentTaskId == "")
Toshihiro Shimizu 890ddd
			m_tasks->setText("");
Toshihiro Shimizu 890ddd
		else {
Toshihiro Shimizu 890ddd
			TFarmTask task;
Toshihiro Shimizu 890ddd
			try {
Toshihiro Shimizu 890ddd
				controller->queryTaskInfo(info.m_currentTaskId, task);
Toshihiro Shimizu 890ddd
				m_tasks->setText("<" + task.m_id + "> " + task.m_name);
Toshihiro Shimizu 890ddd
			} catch (TException &e) {
Toshihiro Shimizu 890ddd
				m_tasks->setText("");
Toshihiro Shimizu 890ddd
				TMessage::error(toString(e.getMessage()));
Toshihiro Shimizu 890ddd
			}
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		if (info.m_state != Down) {
Toshihiro Shimizu 890ddd
			m_cpuCount->setText(toString(info.m_cpuCount));
Toshihiro Shimizu 890ddd
			m_totPhysMem->setText(toString((long)info.m_totPhysMem));
Toshihiro Shimizu 890ddd
		} else {
Toshihiro Shimizu 890ddd
			m_cpuCount->setText("");
Toshihiro Shimizu 890ddd
			m_totPhysMem->setText("");
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void addServer(const ServerIdentity &sid)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		m_serverList->addItem(new TTextListItem(sid.m_id, sid.m_name));
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void configureNotify(const TDimension &size)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		const int dx = 10;
Toshihiro Shimizu 890ddd
		const int dy = 5;
Toshihiro Shimizu 890ddd
		const int h = 20;
Toshihiro Shimizu 890ddd
		const int lw = 120;
Toshihiro Shimizu 890ddd
		const int leftSize = tmin(250, size.lx / 3);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		const int w = size.lx - leftSize - lw - dx * 3;
Toshihiro Shimizu 890ddd
		int left = leftSize + dx;
Toshihiro Shimizu 890ddd
		int y0 = size.ly - 30;
Toshihiro Shimizu 890ddd
		int x0;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		//prima la parte a sx
Toshihiro Shimizu 890ddd
		m_serverList->setGeometry(0, 0, leftSize /*100*/, size.ly - 1);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		// ora la parte a dx
Toshihiro Shimizu 890ddd
		x0 = left;
Toshihiro Shimizu 890ddd
		m_nameLbl->setGeometry(x0, y0, x0 + lw, y0 + h);
Toshihiro Shimizu 890ddd
		x0 += lw + dx;
Toshihiro Shimizu 890ddd
		m_name->setGeometry(x0, y0, x0 + w, y0 + h);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		x0 = left;
Toshihiro Shimizu 890ddd
		y0 -= h + dy;
Toshihiro Shimizu 890ddd
		m_ipAddressLbl->setGeometry(x0, y0, x0 + lw, y0 + h);
Toshihiro Shimizu 890ddd
		x0 += lw + dx;
Toshihiro Shimizu 890ddd
		m_ipAddress->setGeometry(x0, y0, x0 + w, y0 + h);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		x0 = left;
Toshihiro Shimizu 890ddd
		y0 -= h + dy;
Toshihiro Shimizu 890ddd
		m_portNumberLbl->setGeometry(x0, y0, x0 + lw, y0 + h);
Toshihiro Shimizu 890ddd
		x0 += lw + dx;
Toshihiro Shimizu 890ddd
		m_portNumber->setGeometry(x0, y0, x0 + w, y0 + h);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		x0 = left;
Toshihiro Shimizu 890ddd
		y0 -= h + dy;
Toshihiro Shimizu 890ddd
		m_tasksLbl->setGeometry(x0, y0, x0 + lw, y0 + h);
Toshihiro Shimizu 890ddd
		x0 += lw + dx;
Toshihiro Shimizu 890ddd
		m_tasks->setGeometry(x0, y0, x0 + w, y0 + h);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		x0 = left;
Toshihiro Shimizu 890ddd
		y0 -= h + dy;
Toshihiro Shimizu 890ddd
		m_stateLbl->setGeometry(x0, y0, x0 + lw, y0 + h);
Toshihiro Shimizu 890ddd
		x0 += lw + dx;
Toshihiro Shimizu 890ddd
		m_state->setGeometry(x0, y0, x0 + w, y0 + h);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		x0 = left;
Toshihiro Shimizu 890ddd
		y0 -= h + dy;
Toshihiro Shimizu 890ddd
		m_cpuCountLbl->setGeometry(x0, y0, x0 + lw, y0 + h);
Toshihiro Shimizu 890ddd
		x0 += lw + dx;
Toshihiro Shimizu 890ddd
		m_cpuCount->setGeometry(x0, y0, x0 + w, y0 + h);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		x0 = left;
Toshihiro Shimizu 890ddd
		y0 -= h + dy;
Toshihiro Shimizu 890ddd
		m_totPhysMemLbl->setGeometry(x0, y0, x0 + lw, y0 + h);
Toshihiro Shimizu 890ddd
		x0 += lw + dx;
Toshihiro Shimizu 890ddd
		m_totPhysMem->setGeometry(x0, y0, x0 + w, y0 + h);
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TTextList *m_serverList;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TTextField *m_name, *m_ipAddress, *m_portNumber, *m_tasks,
Toshihiro Shimizu 890ddd
		*m_state, *m_cpuCount, *m_totPhysMem;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TLabel *m_nameLbl, *m_ipAddressLbl, *m_portNumberLbl, *m_tasksLbl,
Toshihiro Shimizu 890ddd
		*m_stateLbl, *m_cpuCountLbl, *m_totPhysMemLbl;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void ServerStatusPage::onActivate()
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	TFarmController *controller = Application::instance()->getController();
Toshihiro Shimizu 890ddd
	try {
Toshihiro Shimizu 890ddd
		vector<serveridentity> servers;</serveridentity>
Toshihiro Shimizu 890ddd
		controller->getServers(servers);
Toshihiro Shimizu 890ddd
		vector<serveridentity>::iterator it = servers.begin();</serveridentity>
Toshihiro Shimizu 890ddd
		for (; it != servers.end(); ++it)
Toshihiro Shimizu 890ddd
			m_data->addServer(*it);
Toshihiro Shimizu 890ddd
	} catch (TException &e) {
Toshihiro Shimizu 890ddd
		TMessage::error(toString(e.getMessage()));
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void ServerStatusPage::onDeactivate()
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
ServerStatusPage::ServerStatusPage(TWidget *parent)
Toshihiro Shimizu 890ddd
	: TabPage(parent, "Servers")
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_data = new Data(this);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
ServerStatusPage::~ServerStatusPage()
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void ServerStatusPage::configureNotify(const TDimension &size)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_data->configureNotify(size);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void ServerStatusPage::update()
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	TFarmController *controller = Application::instance()->getController();
Toshihiro Shimizu 890ddd
	vector<serveridentity> servers;</serveridentity>
Toshihiro Shimizu 890ddd
	try {
Toshihiro Shimizu 890ddd
		controller->getServers(servers);
Toshihiro Shimizu 890ddd
	} catch (TException &e) {
Toshihiro Shimizu 890ddd
		TMessage::error(toString(e.getMessage()));
Toshihiro Shimizu 890ddd
		return;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	vector<serveridentity>::iterator it = servers.begin();</serveridentity>
Toshihiro Shimizu 890ddd
	vector<serveridentity> newServers;</serveridentity>
Toshihiro Shimizu 890ddd
	std::set<int> oldServers;</int>
Toshihiro Shimizu 890ddd
	TTextList *sl = m_data->m_serverList;
Toshihiro Shimizu 890ddd
	for (; it != servers.end(); ++it) {
Toshihiro Shimizu 890ddd
		int index;
Toshihiro Shimizu 890ddd
		if ((index = sl->itemToIndex(it->m_id)) == -1)
Toshihiro Shimizu 890ddd
			newServers.push_back(*it);
Toshihiro Shimizu 890ddd
		else
Toshihiro Shimizu 890ddd
			oldServers.insert(index);
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	int i = 0, count = sl->getItemCount();
Toshihiro Shimizu 890ddd
	for (; i < count; ++i)
Toshihiro Shimizu 890ddd
		if (oldServers.find(i) == oldServers.end()) {
Toshihiro Shimizu 890ddd
			string itemId = sl->getItem(i)->getId();
Toshihiro Shimizu 890ddd
			/*      
Toshihiro Shimizu 890ddd
      if(sl->isSelected(itemId))
Toshihiro Shimizu 890ddd
        sl->select((i+1)%sl->getItemCount(), true);
Toshihiro Shimizu 890ddd
        */
Toshihiro Shimizu 890ddd
			sl->removeItem(itemId);
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
	it = newServers.begin();
Toshihiro Shimizu 890ddd
	for (; it != newServers.end(); it++)
Toshihiro Shimizu 890ddd
		sl->addItem(new TTextListItem(it->m_id, it->m_name));
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TTextListItem *item = m_data->m_serverList->getSelectedItem(0);
Toshihiro Shimizu 890ddd
	if (item)
Toshihiro Shimizu 890ddd
		m_data->showServerInfo(item->getId());
Toshihiro Shimizu 890ddd
	invalidate();
Toshihiro Shimizu 890ddd
}