|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "taskstatuspage.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tw/treeview.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tw/colors.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tfarmcontroller.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "application.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tw/mainshell.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tw/textfield.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tw/label.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tw/scrollbar.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tw/event.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "textlist.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "tw/message.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "pixmaps.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include <vector></vector>
|
|
Toshihiro Shimizu |
890ddd |
using namespace std;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
using namespace TwConsts;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
namespace
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
class TaskTreeItemRoot : public TTreeViewItem
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
TaskTreeItemRoot(TTreeViewItem *parent = 0) : TTreeViewItem(parent) {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
wstring getName() const { return toWideString("tasks"); }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TDimension getIconSize() const { return TDimension(32, 30); }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void drawIcon(TTreeView *w, const TPoint &origin)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TRect rect(origin, getIconSize());
|
|
Toshihiro Shimizu |
890ddd |
rect = rect.enlarge(-3);
|
|
Toshihiro Shimizu |
890ddd |
w->rectwrite(tasks_icon, rect.getP00());
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class TaskTreeItem : public TTreeViewItem
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
TaskTreeItem(TTreeViewItem *parent, string &id, string &name, TaskState status)
|
|
Toshihiro Shimizu |
890ddd |
: TTreeViewItem(parent), m_id(id)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
/*
|
|
Toshihiro Shimizu |
890ddd |
setIsLeaf(true);
|
|
Toshihiro Shimizu |
890ddd |
if(task.m_parentId =="")
|
|
Toshihiro Shimizu |
890ddd |
setIsLeaf(false);
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
m_name = " <" + m_id + "> " + name;
|
|
Toshihiro Shimizu |
890ddd |
m_status = status;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
wstring getName() const
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return toWideString(m_name);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
string getId() const
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return m_id;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TDimension getIconSize() const { return TDimension(24, 22); }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void drawIcon(TTreeView *w, const TPoint &origin)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TRect rect(origin, getIconSize());
|
|
Toshihiro Shimizu |
890ddd |
rect = rect.enlarge(-3);
|
|
Toshihiro Shimizu |
890ddd |
switch (m_status) {
|
|
Toshihiro Shimizu |
890ddd |
case Suspended:
|
|
Toshihiro Shimizu |
890ddd |
w->rectwrite(casm_suspended, rect.getP00());
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
case Waiting:
|
|
Toshihiro Shimizu |
890ddd |
w->rectwrite(casm_waiting, rect.getP00());
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
case Running:
|
|
Toshihiro Shimizu |
890ddd |
w->rectwrite(casm_computing, rect.getP00());
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
case Completed:
|
|
Toshihiro Shimizu |
890ddd |
w->rectwrite(casm_done, rect.getP00());
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
case Aborted:
|
|
Toshihiro Shimizu |
890ddd |
w->rectwrite(casm_done_with_errors, rect.getP00());
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
//case TaskUnknown:
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
string m_name;
|
|
Toshihiro Shimizu |
890ddd |
string m_id;
|
|
Toshihiro Shimizu |
890ddd |
TaskState m_status;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class SubtaskTreeItem : public TaskTreeItem
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
SubtaskTreeItem(TaskTreeItem *parent, string &id, string &name, TaskState status)
|
|
Toshihiro Shimizu |
890ddd |
: TaskTreeItem(parent, id, name, status)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
setIsLeaf(true);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void drawIcon(TTreeView *w, const TPoint &origin)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TRect rect(origin, getIconSize());
|
|
Toshihiro Shimizu |
890ddd |
rect = rect.enlarge(-3);
|
|
Toshihiro Shimizu |
890ddd |
switch (m_status) {
|
|
Toshihiro Shimizu |
890ddd |
case Suspended:
|
|
Toshihiro Shimizu |
890ddd |
w->rectwrite(suspended, rect.getP00());
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
case Waiting:
|
|
Toshihiro Shimizu |
890ddd |
w->rectwrite(waiting, rect.getP00());
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
case Running:
|
|
Toshihiro Shimizu |
890ddd |
w->rectwrite(computing, rect.getP00());
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
case Completed:
|
|
Toshihiro Shimizu |
890ddd |
w->rectwrite(done, rect.getP00());
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
case Aborted:
|
|
Toshihiro Shimizu |
890ddd |
w->rectwrite(done_with_errors, rect.getP00());
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
//case TaskUnknown:
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class TaskTree : public TTreeView
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TaskStatusPage *m_statusPage;
|
|
Toshihiro Shimizu |
890ddd |
TPopupMenu *m_popupMenu;
|
|
Toshihiro Shimizu |
890ddd |
TPopupMenu *m_globalPopupMenu;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
TaskTree(TaskStatusPage *parent, string name = "taskTree")
|
|
Toshihiro Shimizu |
890ddd |
: TTreeView(parent, name), m_statusPage(parent)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_popupMenu = new TPopupMenu(this);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TPopupMenuItem *item = new TPopupMenuItem(m_popupMenu, "remove");
|
|
Toshihiro Shimizu |
890ddd |
TGuiCommand("remove").setAction(new TCommandAction<tasktree>(this, onRemove));</tasktree>
|
|
Toshihiro Shimizu |
890ddd |
TGuiCommand("remove").add(item);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
item = new TPopupMenuItem(m_popupMenu, "restart");
|
|
Toshihiro Shimizu |
890ddd |
TGuiCommand("restart").setAction(new TCommandAction<tasktree>(this, onRestart));</tasktree>
|
|
Toshihiro Shimizu |
890ddd |
TGuiCommand("restart").add(item);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_globalPopupMenu = new TPopupMenu(this);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TPopupMenuItem *item1 = new TPopupMenuItem(m_globalPopupMenu, "restart all");
|
|
Toshihiro Shimizu |
890ddd |
TGuiCommand("restart all").setAction(new TCommandAction<tasktree>(this, onRestartAll));</tasktree>
|
|
Toshihiro Shimizu |
890ddd |
TGuiCommand("restart all").add(item1);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void rightButtonDown(const TMouseEvent &e)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
leftButtonDown(e);
|
|
Toshihiro Shimizu |
890ddd |
TTreeViewItem *item = getSelectedItem();
|
|
Toshihiro Shimizu |
890ddd |
TaskTreeItem *taskItem = dynamic_cast<tasktreeitem *="">(item);</tasktreeitem>
|
|
Toshihiro Shimizu |
890ddd |
if (taskItem) {
|
|
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 |
TaskTreeItemRoot *taskItemRoot = dynamic_cast<tasktreeitemroot *="">(item);</tasktreeitemroot>
|
|
Toshihiro Shimizu |
890ddd |
if (taskItemRoot) {
|
|
Toshihiro Shimizu |
890ddd |
TPoint pos = getAbsolutePosition() + TPoint(e.m_pos.x, getSize().ly - e.m_pos.y);
|
|
Toshihiro Shimizu |
890ddd |
m_globalPopupMenu->popup(pos);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void onSelect(TTreeViewItem *item)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TaskTreeItem *taskItem = dynamic_cast<tasktreeitem *="">(item);</tasktreeitem>
|
|
Toshihiro Shimizu |
890ddd |
if (taskItem)
|
|
Toshihiro Shimizu |
890ddd |
m_statusPage->showTaskInfo(taskItem->getId());
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void onExpand(TTreeViewItem *item)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
string id = "";
|
|
Toshihiro Shimizu |
890ddd |
TaskTreeItem *i = dynamic_cast<tasktreeitem *="">(item);</tasktreeitem>
|
|
Toshihiro Shimizu |
890ddd |
if (i)
|
|
Toshihiro Shimizu |
890ddd |
id = i->getId();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
item->clearItems();
|
|
Toshihiro Shimizu |
890ddd |
TFarmController *controller = Application::instance()->getController();
|
|
Toshihiro Shimizu |
890ddd |
vector<string> tasks;</string>
|
|
Toshihiro Shimizu |
890ddd |
try {
|
|
Toshihiro Shimizu |
890ddd |
controller->getTasks(id, tasks);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
vector<string>::iterator it = tasks.begin();</string>
|
|
Toshihiro Shimizu |
890ddd |
for (int j = 0; it != tasks.end(); ++it, ++j) {
|
|
Toshihiro Shimizu |
890ddd |
string taskId = *it;
|
|
Toshihiro Shimizu |
890ddd |
if (taskId != "") {
|
|
Toshihiro Shimizu |
890ddd |
TFarmTask task;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
string parentId, name;
|
|
Toshihiro Shimizu |
890ddd |
TaskState status;
|
|
Toshihiro Shimizu |
890ddd |
controller->queryTaskShortInfo(taskId, parentId, name, status);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (!item->getItem(name))
|
|
Toshihiro Shimizu |
890ddd |
if (parentId == "")
|
|
Toshihiro Shimizu |
890ddd |
item->addItem(new TaskTreeItem(0, taskId, name, status));
|
|
Toshihiro Shimizu |
890ddd |
else
|
|
Toshihiro Shimizu |
890ddd |
item->addItem(new SubtaskTreeItem(0, taskId, name, status));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*
|
|
Toshihiro Shimizu |
890ddd |
int count = tasks.size();
|
|
Toshihiro Shimizu |
890ddd |
for (int j = 0; j< count; ++j)
|
|
Toshihiro Shimizu |
890ddd |
if(tasks[j] != "")
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TFarmTask task;
|
|
Toshihiro Shimizu |
890ddd |
controller->queryTaskInfo(tasks[j], task);
|
|
Toshihiro Shimizu |
890ddd |
//TMainshell::errorMessage("dopo queryTaskInfo" + tasks[j]);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if(!item->getItem(task.m_name))
|
|
Toshihiro Shimizu |
890ddd |
if(task.m_parentId == "")
|
|
Toshihiro Shimizu |
890ddd |
item->addItem(new TaskTreeItem(0, task));
|
|
Toshihiro Shimizu |
890ddd |
else
|
|
Toshihiro Shimizu |
890ddd |
item->addItem(new SubtaskTreeItem(0, task));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
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 |
void onCollapse(TTreeViewItem *item)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
/*
|
|
Toshihiro Shimizu |
890ddd |
string id = "";
|
|
Toshihiro Shimizu |
890ddd |
TaskTreeItem *taskItem = dynamic_cast<tasktreeitem*> (item);</tasktreeitem*>
|
|
Toshihiro Shimizu |
890ddd |
if(taskItem)
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
item->clearItems();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void onRemove()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
string id = "";
|
|
Toshihiro Shimizu |
890ddd |
TaskTreeItem *taskTreeItem = dynamic_cast<tasktreeitem *="">(getSelectedItem());</tasktreeitem>
|
|
Toshihiro Shimizu |
890ddd |
if (taskTreeItem)
|
|
Toshihiro Shimizu |
890ddd |
id = taskTreeItem->getId();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFarmController *controller = Application::instance()->getController();
|
|
Toshihiro Shimizu |
890ddd |
try {
|
|
Toshihiro Shimizu |
890ddd |
controller->removeTask(id);
|
|
Toshihiro Shimizu |
890ddd |
update();
|
|
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 |
void onRestart()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
string id = "";
|
|
Toshihiro Shimizu |
890ddd |
TaskTreeItem *taskTreeItem = dynamic_cast<tasktreeitem *="">(getSelectedItem());</tasktreeitem>
|
|
Toshihiro Shimizu |
890ddd |
if (taskTreeItem)
|
|
Toshihiro Shimizu |
890ddd |
id = taskTreeItem->getId();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFarmController *controller = Application::instance()->getController();
|
|
Toshihiro Shimizu |
890ddd |
try {
|
|
Toshihiro Shimizu |
890ddd |
controller->restartTask(id);
|
|
Toshihiro Shimizu |
890ddd |
update();
|
|
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 |
void onRestartAll()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TFarmController *controller = Application::instance()->getController();
|
|
Toshihiro Shimizu |
890ddd |
try {
|
|
Toshihiro Shimizu |
890ddd |
vector<string> tasks;</string>
|
|
Toshihiro Shimizu |
890ddd |
controller->getTasks("", tasks);
|
|
Toshihiro Shimizu |
890ddd |
int i = 0;
|
|
Toshihiro Shimizu |
890ddd |
for (; i < (int)tasks.size(); i++)
|
|
Toshihiro Shimizu |
890ddd |
controller->restartTask(tasks[i]);
|
|
Toshihiro Shimizu |
890ddd |
update();
|
|
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 |
void update(TTreeViewItem *item)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (!item->isOpen())
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFarmController *controller = Application::instance()->getController();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
string taskId;
|
|
Toshihiro Shimizu |
890ddd |
TaskTreeItem *task = dynamic_cast<tasktreeitem *="">(item);</tasktreeitem>
|
|
Toshihiro Shimizu |
890ddd |
if (task)
|
|
Toshihiro Shimizu |
890ddd |
taskId = task->getId();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
vector<taskshortinfo> subTasks;</taskshortinfo>
|
|
Toshihiro Shimizu |
890ddd |
try {
|
|
Toshihiro Shimizu |
890ddd |
controller->getTasks(taskId, subTasks);
|
|
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<ttreeviewitem *=""> toBeDeleted;</ttreeviewitem>
|
|
Toshihiro Shimizu |
890ddd |
int count = item->getItemCount();
|
|
Toshihiro Shimizu |
890ddd |
for (int i = 0; i < count; ++i) {
|
|
Toshihiro Shimizu |
890ddd |
TaskTreeItem *subTask = dynamic_cast<tasktreeitem *="">(item->getItem(i));</tasktreeitem>
|
|
Toshihiro Shimizu |
890ddd |
if (subTask) {
|
|
Toshihiro Shimizu |
890ddd |
vector<taskshortinfo>::iterator it = subTasks.begin();</taskshortinfo>
|
|
Toshihiro Shimizu |
890ddd |
for (; it != subTasks.end(); ++it) {
|
|
Toshihiro Shimizu |
890ddd |
string id = it->m_id;
|
|
Toshihiro Shimizu |
890ddd |
if (id == subTask->getId())
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (it != subTasks.end()) {
|
|
Toshihiro Shimizu |
890ddd |
subTask->m_status = it->m_status;
|
|
Toshihiro Shimizu |
890ddd |
update(subTask);
|
|
Toshihiro Shimizu |
890ddd |
} else
|
|
Toshihiro Shimizu |
890ddd |
toBeDeleted.push_back(subTask);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
vector<ttreeviewitem *="">::iterator it = toBeDeleted.begin();</ttreeviewitem>
|
|
Toshihiro Shimizu |
890ddd |
while (it != toBeDeleted.end()) {
|
|
Toshihiro Shimizu |
890ddd |
if (getSelectedItem() == *it) {
|
|
Toshihiro Shimizu |
890ddd |
TTreeViewItem *task = dynamic_cast<ttreeviewitem *="">((*it)->getParent());</ttreeviewitem>
|
|
Toshihiro Shimizu |
890ddd |
if (task)
|
|
Toshihiro Shimizu |
890ddd |
select(task);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
item->removeItem(*it++);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifdef PRIMA
|
|
Toshihiro Shimizu |
890ddd |
TFarmController *controller = Application::instance()->getController();
|
|
Toshihiro Shimizu |
890ddd |
vector<ttreeviewitem *=""> toBeDeleted;</ttreeviewitem>
|
|
Toshihiro Shimizu |
890ddd |
int count = item->getItemCount();
|
|
Toshihiro Shimizu |
890ddd |
for (int i = 0; i < count; ++i) {
|
|
Toshihiro Shimizu |
890ddd |
TaskTreeItem *task = dynamic_cast<tasktreeitem *="">(item->getItem(i));</tasktreeitem>
|
|
Toshihiro Shimizu |
890ddd |
if (task) {
|
|
Toshihiro Shimizu |
890ddd |
TFarmTask taskInfo;
|
|
Toshihiro Shimizu |
890ddd |
try {
|
|
Toshihiro Shimizu |
890ddd |
string parentId, name;
|
|
Toshihiro Shimizu |
890ddd |
TaskState status;
|
|
Toshihiro Shimizu |
890ddd |
controller->queryTaskShortInfo(task->getId(), parentId, name, status);
|
|
Toshihiro Shimizu |
890ddd |
if (status == TaskUnknown)
|
|
Toshihiro Shimizu |
890ddd |
toBeDeleted.push_back(task);
|
|
Toshihiro Shimizu |
890ddd |
else {
|
|
Toshihiro Shimizu |
890ddd |
task->m_status = status;
|
|
Toshihiro Shimizu |
890ddd |
update(task);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
} catch (TException &e) {
|
|
Toshihiro Shimizu |
890ddd |
TMainshell::errorMessage(e.getMessage());
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
vector<ttreeviewitem *="">::iterator it = toBeDeleted.begin();</ttreeviewitem>
|
|
Toshihiro Shimizu |
890ddd |
while (it != toBeDeleted.end()) {
|
|
Toshihiro Shimizu |
890ddd |
if (getSelectedItem() == *it) {
|
|
Toshihiro Shimizu |
890ddd |
TTreeViewItem *task = dynamic_cast<ttreeviewitem *="">((*it)->getParent());</ttreeviewitem>
|
|
Toshihiro Shimizu |
890ddd |
if (task)
|
|
Toshihiro Shimizu |
890ddd |
select(task);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
item->removeItem(*it++);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void update()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TFarmController *controller = Application::instance()->getController();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TTreeViewItem *item = getItem(0);
|
|
Toshihiro Shimizu |
890ddd |
if (!item->isOpen())
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (item)
|
|
Toshihiro Shimizu |
890ddd |
update(item);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//aggiungo i nuovi
|
|
Toshihiro Shimizu |
890ddd |
vector<string> tasks;</string>
|
|
Toshihiro Shimizu |
890ddd |
try {
|
|
Toshihiro Shimizu |
890ddd |
controller->getTasks("", tasks);
|
|
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<string>::iterator it = tasks.begin();</string>
|
|
Toshihiro Shimizu |
890ddd |
for (; it != tasks.end(); it++) {
|
|
Toshihiro Shimizu |
890ddd |
bool old = false;
|
|
Toshihiro Shimizu |
890ddd |
int count = item->getItemCount();
|
|
Toshihiro Shimizu |
890ddd |
for (int i = 0; i < count; ++i) {
|
|
Toshihiro Shimizu |
890ddd |
TaskTreeItem *task = dynamic_cast<tasktreeitem *="">(item->getItem(i));</tasktreeitem>
|
|
Toshihiro Shimizu |
890ddd |
if (task)
|
|
Toshihiro Shimizu |
890ddd |
old = (*it == task->getId());
|
|
Toshihiro Shimizu |
890ddd |
if (old)
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (!old) {
|
|
Toshihiro Shimizu |
890ddd |
if (*it != "") {
|
|
Toshihiro Shimizu |
890ddd |
TFarmTask task;
|
|
Toshihiro Shimizu |
890ddd |
try {
|
|
Toshihiro Shimizu |
890ddd |
string parentId, name;
|
|
Toshihiro Shimizu |
890ddd |
TaskState status;
|
|
Toshihiro Shimizu |
890ddd |
controller->queryTaskShortInfo(*it, parentId, name, status);
|
|
Toshihiro Shimizu |
890ddd |
item->addItem(new TaskTreeItem(0, *it, name, status));
|
|
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 |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
updateVisibleItems();
|
|
Toshihiro Shimizu |
890ddd |
invalidate();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
}; //namespace
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//==============================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class TaskStatusPage::Data
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
Data(TaskStatusPage *parent);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void showTaskInfo(const TFarmTask &task);
|
|
Toshihiro Shimizu |
890ddd |
void configureNotify(const TDimension &size);
|
|
Toshihiro Shimizu |
890ddd |
void clearFields();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFarmTask m_currTask;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TaskTree *m_tree;
|
|
Toshihiro Shimizu |
890ddd |
TTextField *m_taskId, *m_cmdLine, *m_server,
|
|
Toshihiro Shimizu |
890ddd |
*m_byUser, *m_onMachine, *m_priority,
|
|
Toshihiro Shimizu |
890ddd |
*m_submissionDate, *m_startDate, *m_completionDate,
|
|
Toshihiro Shimizu |
890ddd |
*m_taskStatus, *m_failedSteps, *m_successfullSteps,
|
|
Toshihiro Shimizu |
890ddd |
*m_stepCount;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TLabel *m_taskIdLbl, *m_cmdLineLbl, *m_serverLbl,
|
|
Toshihiro Shimizu |
890ddd |
*m_byUserLbl, *m_onMachineLbl, *m_priorityLbl,
|
|
Toshihiro Shimizu |
890ddd |
*m_submissionDateLbl, *m_startDateLbl, *m_completionDateLbl,
|
|
Toshihiro Shimizu |
890ddd |
*m_taskStatusLbl, *m_failedStepsLbl, *m_successfullStepsLbl,
|
|
Toshihiro Shimizu |
890ddd |
*m_stepCountLbl, *m_dependenciesLbl;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TTextList *m_dependencies;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TScrollbar *m_scrollVBar, *m_scrollHBar;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TaskStatusPage::Data::Data(TaskStatusPage *parent)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_tree = new TaskTree(parent, "taskTree");
|
|
Toshihiro Shimizu |
890ddd |
m_taskId = new TTextField(parent, "taskId");
|
|
Toshihiro Shimizu |
890ddd |
m_cmdLine = new TTextField(parent, "cmdLine");
|
|
Toshihiro Shimizu |
890ddd |
m_server = new TTextField(parent, "server");
|
|
Toshihiro Shimizu |
890ddd |
m_byUser = new TTextField(parent, "byUser");
|
|
Toshihiro Shimizu |
890ddd |
m_onMachine = new TTextField(parent, "onMachine");
|
|
Toshihiro Shimizu |
890ddd |
m_priority = new TTextField(parent, "priority");
|
|
Toshihiro Shimizu |
890ddd |
m_submissionDate = new TTextField(parent, "submissionDate");
|
|
Toshihiro Shimizu |
890ddd |
m_startDate = new TTextField(parent, "startDate");
|
|
Toshihiro Shimizu |
890ddd |
m_completionDate = new TTextField(parent, "completionDate");
|
|
Toshihiro Shimizu |
890ddd |
m_taskStatus = new TTextField(parent, "taskStatus");
|
|
Toshihiro Shimizu |
890ddd |
m_stepCount = new TTextField(parent, "stepCount");
|
|
Toshihiro Shimizu |
890ddd |
m_failedSteps = new TTextField(parent, "failedSteps");
|
|
Toshihiro Shimizu |
890ddd |
m_successfullSteps = new TTextField(parent, "successfullSteps");
|
|
Toshihiro Shimizu |
890ddd |
m_dependencies = new TTextList(parent);
|
|
Toshihiro Shimizu |
890ddd |
m_taskIdLbl = new TLabel(parent, "task id");
|
|
Toshihiro Shimizu |
890ddd |
m_cmdLineLbl = new TLabel(parent, "command line");
|
|
Toshihiro Shimizu |
890ddd |
m_serverLbl = new TLabel(parent, "server");
|
|
Toshihiro Shimizu |
890ddd |
m_byUserLbl = new TLabel(parent, "submitted by");
|
|
Toshihiro Shimizu |
890ddd |
m_onMachineLbl = new TLabel(parent, "submitted on");
|
|
Toshihiro Shimizu |
890ddd |
m_priorityLbl = new TLabel(parent, "priority");
|
|
Toshihiro Shimizu |
890ddd |
m_submissionDateLbl = new TLabel(parent, "submission date");
|
|
Toshihiro Shimizu |
890ddd |
m_startDateLbl = new TLabel(parent, "start date");
|
|
Toshihiro Shimizu |
890ddd |
m_completionDateLbl = new TLabel(parent, "completion date");
|
|
Toshihiro Shimizu |
890ddd |
m_stepCountLbl = new TLabel(parent, "step count");
|
|
Toshihiro Shimizu |
890ddd |
m_failedStepsLbl = new TLabel(parent, "failed steps");
|
|
Toshihiro Shimizu |
890ddd |
m_successfullStepsLbl = new TLabel(parent, "successfull steps");
|
|
Toshihiro Shimizu |
890ddd |
m_dependenciesLbl = new TLabel(parent, "dependencies");
|
|
Toshihiro Shimizu |
890ddd |
m_taskStatusLbl = new TLabel(parent, "status");
|
|
Toshihiro Shimizu |
890ddd |
m_scrollVBar = new TScrollbar(parent, "vscroll");
|
|
Toshihiro Shimizu |
890ddd |
m_scrollHBar = new TScrollbar(parent, "hscroll");
|
|
Toshihiro Shimizu |
890ddd |
m_tree->setScrollbars(m_scrollHBar, m_scrollVBar);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TaskStatusPage::Data::showTaskInfo(const TFarmTask &task)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
switch (task.m_status) {
|
|
Toshihiro Shimizu |
890ddd |
case Waiting:
|
|
Toshihiro Shimizu |
890ddd |
m_taskStatus->setText("Waiting");
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
case Running:
|
|
Toshihiro Shimizu |
890ddd |
m_taskStatus->setText("Running");
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
case Completed:
|
|
Toshihiro Shimizu |
890ddd |
m_taskStatus->setText("Completed");
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
case Aborted:
|
|
Toshihiro Shimizu |
890ddd |
m_taskStatus->setText("Failed");
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
case TaskUnknown:
|
|
Toshihiro Shimizu |
890ddd |
clearFields();
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
m_taskId->setText(task.m_id);
|
|
Toshihiro Shimizu |
890ddd |
m_cmdLine->setText(task.m_cmdline);
|
|
Toshihiro Shimizu |
890ddd |
m_server->setText(task.m_server);
|
|
Toshihiro Shimizu |
890ddd |
m_byUser->setText(task.m_user);
|
|
Toshihiro Shimizu |
890ddd |
m_onMachine->setText(task.m_hostName);
|
|
Toshihiro Shimizu |
890ddd |
m_priority->setText(toString(task.m_priority));
|
|
Toshihiro Shimizu |
890ddd |
m_submissionDate->setText(task.m_submissionDate);
|
|
Toshihiro Shimizu |
890ddd |
m_startDate->setText(task.m_startDate);
|
|
Toshihiro Shimizu |
890ddd |
m_completionDate->setText(task.m_completionDate);
|
|
Toshihiro Shimizu |
890ddd |
m_stepCount->setText(toString(task.m_stepCount));
|
|
Toshihiro Shimizu |
890ddd |
m_failedSteps->setText(toString(task.m_failedSteps));
|
|
Toshihiro Shimizu |
890ddd |
m_successfullSteps->setText(toString(task.m_successfullSteps));
|
|
Toshihiro Shimizu |
890ddd |
m_dependencies->clearAll();
|
|
Toshihiro Shimizu |
890ddd |
if (task.m_dependencies) {
|
|
Toshihiro Shimizu |
890ddd |
int count = task.m_dependencies->getTaskCount(), i = 0;
|
|
Toshihiro Shimizu |
890ddd |
TFarmController *controller = Application::instance()->getController();
|
|
Toshihiro Shimizu |
890ddd |
for (; i < count; ++i) {
|
|
Toshihiro Shimizu |
890ddd |
string id, parentId, name;
|
|
Toshihiro Shimizu |
890ddd |
TaskState status;
|
|
Toshihiro Shimizu |
890ddd |
id = task.m_dependencies->getTaskId(i);
|
|
Toshihiro Shimizu |
890ddd |
try {
|
|
Toshihiro Shimizu |
890ddd |
controller->queryTaskShortInfo(id, parentId, name, status);
|
|
Toshihiro Shimizu |
890ddd |
} catch (TException &e) {
|
|
Toshihiro Shimizu |
890ddd |
TMessage::error(toString(e.getMessage()));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
string label = "<" + id + "> " + name;
|
|
Toshihiro Shimizu |
890ddd |
m_dependencies->addItem(new TTextListItem(id, label));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
m_dependencies->invalidate();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TaskStatusPage::Data::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 |
const int scbSize = 15;
|
|
Toshihiro Shimizu |
890ddd |
TRect rect = TRect(0, 0, leftSize, size.ly);
|
|
Toshihiro Shimizu |
890ddd |
int x = leftSize;
|
|
Toshihiro Shimizu |
890ddd |
m_tree->setGeometry(rect.x0, rect.y0 + scbSize, x - 1 - scbSize, rect.y1);
|
|
Toshihiro Shimizu |
890ddd |
m_scrollVBar->setGeometry(x - scbSize, rect.y0 + scbSize, x - 1, rect.y1);
|
|
Toshihiro Shimizu |
890ddd |
m_scrollHBar->setGeometry(rect.x0, rect.y0, x - 1 - scbSize, rect.y0 + scbSize - 1);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// ora la parte a dx
|
|
Toshihiro Shimizu |
890ddd |
x0 = left;
|
|
Toshihiro Shimizu |
890ddd |
m_taskIdLbl->setGeometry(x0, y0, x0 + lw, y0 + h);
|
|
Toshihiro Shimizu |
890ddd |
x0 += lw + dx;
|
|
Toshihiro Shimizu |
890ddd |
m_taskId->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_taskStatusLbl->setGeometry(x0, y0, x0 + lw, y0 + h);
|
|
Toshihiro Shimizu |
890ddd |
x0 += lw + dx;
|
|
Toshihiro Shimizu |
890ddd |
m_taskStatus->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_cmdLineLbl->setGeometry(x0, y0, x0 + lw, y0 + h);
|
|
Toshihiro Shimizu |
890ddd |
x0 += lw + dx;
|
|
Toshihiro Shimizu |
890ddd |
m_cmdLine->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_serverLbl->setGeometry(x0, y0, x0 + lw, y0 + h);
|
|
Toshihiro Shimizu |
890ddd |
x0 += lw + dx;
|
|
Toshihiro Shimizu |
890ddd |
m_server->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_byUserLbl->setGeometry(x0, y0, x0 + lw, y0 + h);
|
|
Toshihiro Shimizu |
890ddd |
x0 += lw + dx;
|
|
Toshihiro Shimizu |
890ddd |
m_byUser->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_onMachineLbl->setGeometry(x0, y0, x0 + lw, y0 + h);
|
|
Toshihiro Shimizu |
890ddd |
x0 += lw + dx;
|
|
Toshihiro Shimizu |
890ddd |
m_onMachine->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_priorityLbl->setGeometry(x0, y0, x0 + lw, y0 + h);
|
|
Toshihiro Shimizu |
890ddd |
x0 += lw + dx;
|
|
Toshihiro Shimizu |
890ddd |
m_priority->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_submissionDateLbl->setGeometry(x0, y0, x0 + lw, y0 + h);
|
|
Toshihiro Shimizu |
890ddd |
x0 += lw + dx;
|
|
Toshihiro Shimizu |
890ddd |
m_submissionDate->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_startDateLbl->setGeometry(x0, y0, x0 + lw, y0 + h);
|
|
Toshihiro Shimizu |
890ddd |
x0 += lw + dx;
|
|
Toshihiro Shimizu |
890ddd |
m_startDate->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_completionDateLbl->setGeometry(x0, y0, x0 + lw, y0 + h);
|
|
Toshihiro Shimizu |
890ddd |
x0 += lw + dx;
|
|
Toshihiro Shimizu |
890ddd |
m_completionDate->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_stepCountLbl->setGeometry(x0, y0, x0 + lw, y0 + h);
|
|
Toshihiro Shimizu |
890ddd |
x0 += lw + dx;
|
|
Toshihiro Shimizu |
890ddd |
m_stepCount->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_failedStepsLbl->setGeometry(x0, y0, x0 + lw, y0 + h);
|
|
Toshihiro Shimizu |
890ddd |
x0 += lw + dx;
|
|
Toshihiro Shimizu |
890ddd |
m_failedSteps->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_successfullStepsLbl->setGeometry(x0, y0, x0 + lw, y0 + h);
|
|
Toshihiro Shimizu |
890ddd |
x0 += lw + dx;
|
|
Toshihiro Shimizu |
890ddd |
m_successfullSteps->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_dependenciesLbl->setGeometry(x0, y0, x0 + lw, y0 + h);
|
|
Toshihiro Shimizu |
890ddd |
x0 += lw + dx;
|
|
Toshihiro Shimizu |
890ddd |
m_dependencies->setGeometry(x0, y0 - 3 * h, x0 + w, y0 + h);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TaskStatusPage::Data::clearFields()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_taskStatus->setText("");
|
|
Toshihiro Shimizu |
890ddd |
m_taskId->setText("");
|
|
Toshihiro Shimizu |
890ddd |
m_cmdLine->setText("");
|
|
Toshihiro Shimizu |
890ddd |
m_server->setText("");
|
|
Toshihiro Shimizu |
890ddd |
m_byUser->setText("");
|
|
Toshihiro Shimizu |
890ddd |
m_onMachine->setText("");
|
|
Toshihiro Shimizu |
890ddd |
m_priority->setText("");
|
|
Toshihiro Shimizu |
890ddd |
m_submissionDate->setText("");
|
|
Toshihiro Shimizu |
890ddd |
m_startDate->setText("");
|
|
Toshihiro Shimizu |
890ddd |
m_completionDate->setText("");
|
|
Toshihiro Shimizu |
890ddd |
m_stepCount->setText("");
|
|
Toshihiro Shimizu |
890ddd |
m_failedSteps->setText("");
|
|
Toshihiro Shimizu |
890ddd |
m_successfullSteps->setText("");
|
|
Toshihiro Shimizu |
890ddd |
m_dependencies->clearAll();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//==============================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TaskStatusPage::TaskStatusPage(TWidget *parent)
|
|
Toshihiro Shimizu |
890ddd |
: TabPage(parent, "Tasks")
|
|
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 |
TaskStatusPage::~TaskStatusPage()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TaskStatusPage::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 TaskStatusPage::rightButtonDown(const TMouseEvent &e)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TaskStatusPage::onActivate()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (m_data->m_tree && m_data->m_tree->getItemCount() < 1) {
|
|
Toshihiro Shimizu |
890ddd |
TaskTreeItemRoot *root = new TaskTreeItemRoot();
|
|
Toshihiro Shimizu |
890ddd |
root->setIsLeaf(false);
|
|
Toshihiro Shimizu |
890ddd |
m_data->m_tree->clearItems();
|
|
Toshihiro Shimizu |
890ddd |
m_data->m_tree->addItem(root);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
m_data->m_tree->update();
|
|
Toshihiro Shimizu |
890ddd |
invalidate();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TaskStatusPage::onDeactivate()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TaskStatusPage::showTaskInfo(const string &id)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TFarmController *controller = Application::instance()->getController();
|
|
Toshihiro Shimizu |
890ddd |
try {
|
|
Toshihiro Shimizu |
890ddd |
TFarmTask task;
|
|
Toshihiro Shimizu |
890ddd |
controller->queryTaskInfo(id, task);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (task != m_data->m_currTask) {
|
|
Toshihiro Shimizu |
890ddd |
m_data->m_currTask = task;
|
|
Toshihiro Shimizu |
890ddd |
m_data->showTaskInfo(task);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
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 TaskStatusPage::update()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_data->m_tree->update();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
string id = "";
|
|
Toshihiro Shimizu |
890ddd |
TaskTreeItem *item = dynamic_cast<tasktreeitem *="">(m_data->m_tree->getSelectedItem());</tasktreeitem>
|
|
Toshihiro Shimizu |
890ddd |
if (item)
|
|
Toshihiro Shimizu |
890ddd |
id = item->getId();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (id != "")
|
|
Toshihiro Shimizu |
890ddd |
showTaskInfo(id);
|
|
Toshihiro Shimizu |
890ddd |
else
|
|
Toshihiro Shimizu |
890ddd |
m_data->clearFields();
|
|
Toshihiro Shimizu |
890ddd |
invalidate();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------------
|