Commit 5ba401c1 authored by Bas Lijnse's avatar Bas Lijnse

Removed intermediate automatic layouting. Only layouting at the end of the pipeline

parent 72cc896a
......@@ -7,7 +7,7 @@ import Data.Either, System.OS, Text.URI, Internet.HTTP
import iTasks._Framework.IWorld, iTasks._Framework.Task, iTasks._Framework.TaskState
import iTasks._Framework.SDS, iTasks._Framework.TaskStore, iTasks._Framework.TaskEval
import iTasks.API.Core.Types, iTasks.API.Core.Tasks, iTasks.UI.Layout, iTasks.UI.Layout.Auto
import iTasks.API.Core.Types, iTasks.API.Core.Tasks, iTasks.UI.Layout
import iTasks.API.Core.SDSs
import iTasks.API.Common.InteractionTasks, iTasks.API.Common.TaskCombinators //TODO don't import from Common in Core
import iTasks.UI.Editor
......@@ -75,7 +75,6 @@ where
# (content,iworld) = makeView opts status taskId iworld
# prompt = toPrompt desc
# change = ReplaceUI (uic (UIEditor {UIEditor|optional=False}) [prompt,content])
# change = if evalOpts.autoLayout (fst (autoLayoutInteract (change,JSONNull))) change
= (change, iworld)
makeView [ViewWith viewFun] status taskId iworld
......
......@@ -6,7 +6,7 @@ import Internet.HTTP, GenEq, System.Time, Text, Data.Func, Data.Tuple, Data.List
import iTasks._Framework.Task, iTasks._Framework.TaskState, iTasks._Framework.TaskStore, iTasks._Framework.TaskEval
import iTasks._Framework.Util, iTasks._Framework.Store
import iTasks._Framework.Generic, iTasks.UI.Definition
import iTasks.API.Core.Types, iTasks.UI.Layout, iTasks.UI.Layout.Auto
import iTasks.API.Core.Types, iTasks.UI.Layout
import iTasks._Framework.IWorld
import iTasks._Framework.Tonic.Shares
import iTasks._Framework.Client.Override
......@@ -141,14 +141,13 @@ where
(OnAllExceptions taskbf) = callWithDeferredJSON taskbf d_json_a
doStepLayout taskId evalOpts event actions prevEnabled change val
# change = case (event,change) of
= case (event,change) of
//On reset generate a new step UI
(ResetEvent,ReplaceUI rui)
= ReplaceUI (uic UIStep [rui:map (\x -> (ui (UIAction x))) (contActions taskId val conts)])
//Otherwise create a compound change definition
_
= ChangeUI [] [(0,ChangeChild change):actionChanges]
= if evalOpts.autoLayout (fst (autoLayoutStep (change,JSONNull))) change
where
actionChanges = [(i,ChangeChild (switch enabled name)) \\ {UIAction|action=(Action name _),enabled} <- actions & i <- [1..]]
where
......@@ -514,7 +513,7 @@ genParallelValue results = Value [(lastEvent,val) \\ ValueResult val {TaskEvalIn
genParallelRep :: !TaskEvalOpts !Event [UIAction] [String] [TaskResult a] Int -> UIChange
genParallelRep evalOpts event actions prevEnabledActions results prevNumBranches
# change = case event of
= case event of
ResetEvent
= ReplaceUI (uic UIParallel [uic UICompoundContent [def \\ ValueResult _ _ (ReplaceUI def) _ <- results]
,uic UICompoundContent (map (\x -> ui (UIAction x)) actions)
......@@ -523,7 +522,6 @@ genParallelRep evalOpts event actions prevEnabledActions results prevNumBranches
= ChangeUI [] [(0,ChangeChild (ChangeUI [] (itemChanges 0 prevNumBranches results)))
,(1,ChangeChild (ChangeUI [] actionChanges))
]
= if evalOpts.autoLayout (fst (autoLayoutParallel (change,JSONNull))) change
where
itemChanges i numExisting [] = []
itemChanges i numExisting [ValueResult _ _ change _:rs]
......@@ -707,12 +705,10 @@ where
= (ValueResult (Value ASExcepted True) {TaskEvalInfo|lastEvent=ts,removedTasks=[],refreshSensitive=False} NoChange tree, iworld)
| attachedId == taskId
# rep = ReplaceUI (embedTaskDef instanceNo instanceKey)
# rep = if evalOpts.autoLayout (fst (autoLayoutAttach (rep,JSONNull))) rep
# stable = value === Stable
= (ValueResult (Value (ASAttached stable) stable) {TaskEvalInfo|lastEvent=ts,removedTasks=[],refreshSensitive=True} rep tree, iworld)
| otherwise
# rep = ReplaceUI inUseDef
# rep = if evalOpts.autoLayout (fst (autoLayoutAttach (rep,JSONNull))) rep
= (ValueResult (Value (ASInUse attachedId) False) {TaskEvalInfo|lastEvent=ts,removedTasks=[],refreshSensitive=False} rep tree, iworld)
_
= (ValueResult (Value ASDeleted True) {TaskEvalInfo|lastEvent=ts,removedTasks=[],refreshSensitive=False} NoChange tree, iworld)
......
......@@ -5,7 +5,7 @@ import System.Time, Data.Error, System.OSError, Data.Tuple, Text, Text.JSON
import iTasks._Framework.Util, iTasks._Framework.HtmlUtil, iTasks._Framework.TaskServer
import iTasks._Framework.Generic, iTasks._Framework.Generic.Interaction, iTasks._Framework.Task, iTasks._Framework.TaskState
import iTasks._Framework.TaskEval, iTasks._Framework.TaskStore, iTasks.UI.Definition, iTasks._Framework.IWorld
import iTasks.UI.Layout, iTasks.UI.Layout.Auto, iTasks.UI.Editor
import iTasks.UI.Layout, iTasks.UI.Editor
import iTasks.API.Core.SDSs, iTasks.API.Common.SDSCombinators
from iTasks._Framework.SDS as SDS import qualified read, readRegister, write
......
definition module iTasks.UI.Layout.Auto
definition module iTasks.UI.Layout.Default
/**
* This module defines the functions that drive iTask's automagic UI layouting
* This module defines the functions that drive iTask's automagic default UI layouting
*/
import iTasks.UI.Layout
autoLayoutInteract :: Layout //Automatically applied by 'interact'
autoLayoutStep :: Layout //Automatically applied by 'step'
autoLayoutParallel :: Layout //Automatically applied by 'parallel'
autoLayoutAttach :: Layout //Automatically applied by 'attach'
autoLayoutSession :: Layout //Added when a task instance is 'published' (can be easily removed or replaced by publishing a task explicitly)
defaultSessionLayout :: Layout //Added when a task instance is 'published' (can be easily removed or replaced by publishing a task explicitly)
//Partial layouts used in the automatic layouts
editorToForm :: Layout
......
implementation module iTasks.UI.Layout.Auto
implementation module iTasks.UI.Layout.Default
import iTasks.UI.Layout
import iTasks.UI.Definition
......@@ -11,20 +11,8 @@ import qualified Data.Map as DM
LABEL_WIDTH :== 100
autoLayoutInteract :: Layout
autoLayoutInteract = id
autoLayoutStep :: Layout
autoLayoutStep = id
autoLayoutParallel :: Layout
autoLayoutParallel = id
autoLayoutAttach :: Layout
autoLayoutAttach = id
autoLayoutSession :: Layout
autoLayoutSession = sequenceLayouts
defaultSessionLayout :: Layout
defaultSessionLayout = sequenceLayouts
[layoutSubsMatching [] isInteract (layoutSubAt [1] editorToForm) //All interacts: Remap changes in the editor, ignore changes to the prompt, it should be constant
,finalizeUI
,changeNodeType (setFramed True o setSize WrapSize WrapSize o setMargins 50 0 20 0 o setMinWidth (ExactBound 600))
......
......@@ -11,7 +11,7 @@ import iTasks._Framework.Util, iTasks._Framework.HtmlUtil
import iTasks._Framework.IWorld, iTasks._Framework.WebService, iTasks._Framework.SDSService
import iTasks.API.Common.SDSCombinators
import qualified iTasks._Framework.SDS as SDS
import iTasks.UI.Layout, iTasks.UI.Layout.Auto
import iTasks.UI.Layout, iTasks.UI.Layout.Default
from iTasks.API.Core.TaskCombinators import class tune(..)
from iTasks.UI.Layout import instance tune ApplyLayout, instance tune AutoLayout
......@@ -213,7 +213,7 @@ publishRaw :: String ServiceFormat (HTTPRequest -> Task a) -> PublishedTask | iT
publishRaw url format task = {url = url, task = TaskWrapper (withoutLayout task), defaultFormat = format}
withFinalSessionLayout :: (HTTPRequest -> Task a) -> (HTTPRequest -> Task a) | iTask a
withFinalSessionLayout taskf = \req -> tune (ApplyLayout autoLayoutSession) (taskf req)
withFinalSessionLayout taskf = \req -> tune (ApplyLayout defaultSessionLayout) (taskf req)
withoutLayout :: (HTTPRequest -> Task a) -> (HTTPRequest -> Task a) | iTask a
withoutLayout taskf = \req -> tune WithoutAutoLayout (taskf req)
......
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