Commit 16f4a123 authored by Steffen Michels's avatar Steffen Michels

updates all tasks in parallel/group instead of redrawing them

git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/trunk@967 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent 68d4bb40
......@@ -158,6 +158,9 @@ itasks.ttc.FormContainer = Ext.extend(Ext.Panel, {
ct.resumeEvents();
}
break;
case "TUIReplaceMenu":
this.replaceToolbar(update[1]);
break;
}
}
......@@ -172,12 +175,7 @@ itasks.ttc.FormContainer = Ext.extend(Ext.Panel, {
this.doLayout();
//Replace toolbar
var tb = this.getTopToolbar();
tb.removeAll();
if(data.content.tbar)
tb.add(data.content.tbar);
this.setupToolbar(tb);
this.replaceToolbar(data.content.tbar);
//Attach eventhandlers
//this.attachTaskHandlers(this);
......@@ -185,6 +183,14 @@ itasks.ttc.FormContainer = Ext.extend(Ext.Panel, {
}
},
replaceToolbar: function(newTb) {
var tb = this.getTopToolbar();
tb.removeAll();
if(newTb)
tb.add(newTb);
this.setupToolbar(tb);
},
setupToolbar: function(tb) {
tb.setVisible(tb.items.length > 0);
......
......@@ -122,7 +122,7 @@ where
_ = stop
optionsEditor = editor { editorFrom = \map -> {type = map.mapType, showMapTypeControl = map.mapTypeControl, showNavigationControl = map.navigationControl, showScaleControl = map.scaleControl, size = if (map.GoogleMap.width == 400) Normal Large}
, editorTo = \opts map -> {map & mapType = opts.MapOptions.type, mapTypeControl = opts.showMapTypeControl, navigationControl = opts.showNavigationControl, scaleControl = opts.showScaleControl, width = case opts.MapOptions.size of Large = 800; Normal = 400}
, editorTo = \opts map -> {map & mapType = opts.MapOptions.type, mapTypeControl = opts.showMapTypeControl, navigationControl = opts.showNavigationControl, scaleControl = opts.showScaleControl, width = case opts.MapOptions.size of Large = 650; Normal = 400}
}
overviewEditor = editor { editorFrom = \map -> {GoogleMap| map & mapTypeControl = False, navigationControl = False, scaleControl = False, scrollwheel = False, zoom = 7}
, editorTo = \nmap map -> {GoogleMap| map & center = nmap.GoogleMap.center}
......
......@@ -28,7 +28,7 @@ setMenus menus
setMenus` :: !(Maybe [Menu]) !*TSt -> (!TaskResult Void,!*TSt)
setMenus` menus tst
= (TaskFinished Void, {TSt|tst & menus = menus})
= (TaskFinished Void, {TSt|tst & menus = menus, menusChanged = True})
removeMenus :: Task Void
removeMenus = mkInstantTask "removeMenus" (setMenus` Nothing)
......
......@@ -24,11 +24,13 @@ import GenPrint, GenParse, GenVisualize, GenUpdate
:: *TSt = { taskNr :: !TaskNr // for generating unique form-id's
, taskInfo :: !TaskInfo // task information available to tasks
, tree :: !TaskTree // accumulator for constructing a task tree
, newTask :: !Bool // does the task run for the first time
, mainTask :: !ProcessId // The id of the current main task
, properties :: !TaskProperties // Properties of the current evaluated process
, menus :: !Maybe [Menu] // Menu structure of the current task
, staticInfo :: !StaticInfo // info which does not change during a run
, mainTask :: !ProcessId // The id of the current main task
, properties :: !TaskProperties // Properties of the current evaluated process
, menus :: !Maybe [Menu] // Menu structure of the current task
, menusChanged :: !Bool // Has the menu structure been changed
, staticInfo :: !StaticInfo // info which does not change during a run
, currentChange :: !Maybe (!ChangeLifeTime,!ChangeDyn) // An active change
, pendingChanges:: ![(!ChangeLifeTime,!ChangeDyn)] // Pending persistent changes
......@@ -302,6 +304,7 @@ setTUIMessage :: !(TUIDef,[TUIButton]) [HtmlTag] ![(Action,Bool)] !*TSt -> *T
setStatus :: ![HtmlTag] !*TSt -> *TSt //Only for monitor tasks
getUserUpdates :: !*TSt -> ([(String,String)],!*TSt)
anyUpdates :: !*TSt -> (Bool,!*TSt)
/**
* Writes a 'task scoped' value to the store
......
......@@ -33,9 +33,11 @@ mkTSt appName config request session workflows dataStore documentStore world
= { taskNr = []
, taskInfo = initTaskInfo
, tree = TTMainTask initTaskInfo initTaskProperties Nothing Nothing (TTFinishedTask initTaskInfo [])
, newTask = True
, mainTask = ""
, properties = initTaskProperties
, menus = Nothing
, menusChanged = False
, staticInfo = initStaticInfo appName session workflows
, currentChange = Nothing
, pendingChanges= []
......@@ -579,7 +581,7 @@ applyTask (Task desc=:{TaskDescription | groupedBehaviour} mbCxt taskfun) tst=:{
, groupedBehaviour = groupedBehaviour
, taskDescription = ""
}
# tst = {TSt|tst & dataStore = dataStore, world = world, taskInfo = taskInfo}
# tst = {TSt|tst & dataStore = dataStore, world = world, taskInfo = taskInfo, newTask = isNothing taskVal}
= case taskVal of
(Just (TaskFinished a))
# tst = addTaskNode (TTFinishedTask {taskInfo & traceValue = printToString a} (visualizeAsHtmlDisplay a)) tst
......@@ -714,6 +716,9 @@ where
| otherwise
= []
anyUpdates :: !*TSt -> (Bool,!*TSt)
anyUpdates tst=:{request} = (http_getValue "_targettask" request.arg_post "" <> "",tst)
clearUserUpdates :: !*TSt -> *TSt
clearUserUpdates tst=:{taskNr, request}
| http_getValue "_targettask" request.arg_post "" == taskNrToString taskNr
......
......@@ -17,6 +17,7 @@ derive JSONEncode TUIDef, TUIUpdate
| TUIReplace TUIId TUIDef // Replace a component
| TUISetValue TUIId String // Call setValue on the component with indicated id
| TUISetEnabled TUIId Bool // Enable/disable form elements
| TUIReplaceMenu [TUIDef]
:: TUIDef
= TUILabel
......
......@@ -26,7 +26,7 @@ JSONEncode{|Timestamp|} (Timestamp x) c = JSONEncode{|*|} x c
JSONEncode{|UserName|} (UserName name disp) c = ["\"" +++ disp +++ " <" +++ name +++ ">\"" : c]
buildTaskPanel :: !TaskTree !(Maybe [Menu]) !UserName !*TSt -> (!TaskPanel,!*TSt)
buildTaskPanel tree menus currentUser tst = case tree of
buildTaskPanel tree menus currentUser tst=:{menusChanged} = case tree of
(TTFinishedTask _ _)
= (TaskDone,tst)
(TTInteractiveTask ti (Definition (def,buttons) acceptedA))
......@@ -45,7 +45,7 @@ buildTaskPanel tree menus currentUser tst = case tree of
, id = "taskform-" +++ ti.TaskInfo.taskId
, taskId = ti.TaskInfo.taskId
, content = Nothing
, updates = Just (determineUpdates upd menus acceptedA ti)
, updates = Just (determineUpdates upd menus menusChanged acceptedA ti)
, subtaskId = Nothing
, description = ti.TaskInfo.taskDescription
}, tst)
......@@ -101,6 +101,7 @@ buildTaskPanel tree menus currentUser tst = case tree of
_ = (abort "Multiple simultaneously active tasks in a sequence!")
(TTGroupedTask ti tasks)
# (containers,tst) = seqList [(\(p,tst) -> ({panel = p, behaviour = getGroupedBehaviour t, index = idx},tst)) o buildTaskPanel t menus currentUser \\ t <- tasks & idx <- [0..]] tst
# containers = filter filterFinished containers
# container = (TTCGroupContainer {TTCGroupContainer
| xtype = "itasks.ttc.group"
, taskId = ti.TaskInfo.taskId
......@@ -136,9 +137,13 @@ where
(TTParallelTask _ _ _) = False // the parallel subtask itself should not become visible
(TTMainTask _ _ _ _ _) = False // a main-subtask should not become visible
_ = abort "Unknown panel type in parallel"
filterFinished container =
case container.panel of
TaskDone = False
_ = True
buildSubtaskPanels :: !TaskTree !SubtaskNr !(Maybe [Menu]) !UserName !TaskParallelType !Bool !(Maybe TaskProperties) !*TSt -> (![SubtaskContainer],!*TSt)
buildSubtaskPanels tree stnr menus manager partype inClosed procProps tst = case tree of
buildSubtaskPanels tree stnr menus manager partype inClosed procProps tst=:{menusChanged} = case tree of
(TTInteractiveTask ti (Definition (def,buttons) acceptedA))
= ([{SubtaskContainer
| subtaskNr = stnr
......@@ -168,7 +173,7 @@ buildSubtaskPanels tree stnr menus manager partype inClosed procProps tst = case
, id = "taskform-" +++ ti.TaskInfo.taskId
, taskId = ti.TaskInfo.taskId
, content = Nothing
, updates = Just (determineUpdates upd menus acceptedA ti)
, updates = Just (determineUpdates upd menus menusChanged acceptedA ti)
, subtaskId = Just (subtaskNrToString stnr)
, description = ti.TaskInfo.taskDescription
}
......@@ -386,11 +391,13 @@ where
[TUIMenuSeparator:defs] = defs
defs = defs
determineUpdates :: ![TUIUpdate] !(Maybe [Menu]) [(Action,Bool)] TaskInfo -> [TUIUpdate]
determineUpdates upd menus acceptedA ti
= case menus of
determineUpdates :: ![TUIUpdate] !(Maybe [Menu]) !Bool [(Action,Bool)] TaskInfo -> [TUIUpdate]
determineUpdates upd mbMenus menusChanged acceptedA ti
= case mbMenus of
Nothing = upd
Just menus = fst (determineMenuUpd upd menus 0)
Just menus
| menusChanged = [TUIReplaceMenu (makeMenuBar mbMenus acceptedA ti):upd]
| otherwise = fst (determineMenuUpd upd menus 0)
where
determineMenuUpd upd [Menu _ items:menus] id
#(upd,id) = determineItemUpd upd items id
......
......@@ -137,7 +137,7 @@ toHidden :: !.a -> (Hidden .a)
, index :: !Int
}
:: SharedDocumentVersion :== Int
:: DocumentDataLocation = LocalLocation !TaskId | SharedLocation !(DBid Document) !SharedDocumentVersion
:: DocumentDataLocation = LocalLocation !TaskId | SharedLocation !String !SharedDocumentVersion
:: DocumentData :== String
emptyDoc :: Document
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment