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