Commit c5ae0e38 authored by Michael Hanus 's avatar Michael Hanus

Code refactoring

parent 2fb8b418
......@@ -262,22 +262,14 @@ hasDateAttribute = any isDate
_ -> False
combinator :: Int -> QName
combinator n =
case n of
0 -> error "GenerationHelper.combinator: empty attribute list"
1 -> error "GenerationHelper.combinator: no combinator for list of length 1"
2 -> (wui "wPair")
3 -> (wui "wTriple")
4 -> (wui "w4Tuple")
5 -> (wui "w5Tuple")
6 -> (wui "w6Tuple")
7 -> (wui "w7Tuple")
8 -> (wui "w8Tuple")
9 -> (wui "w9Tuple")
10 -> (wui "w10Tuple")
11 -> (wui "w11Tuple")
12 -> (wui "w12Tuple")
_ -> error "GenerationHelper.combinator: attribute list too long"
combinator n
| n==0 = error "GenerationHelper.combinator: empty attribute list"
| n==1
= error "GenerationHelper.combinator: no combinator for list of length 1"
| n>14 = error "GenerationHelper.combinator: attribute list too long"
| n==2 = (wui "wPair")
| n==3 = (wui "wTriple")
| otherwise = (wui $ "w" ++ show n ++ "Tuple")
-- Associate to each attribute of the argument list a WUI specification
-- as an abstract Curry program
......
......@@ -44,7 +44,7 @@ wuiSpec erdname (Entity entityName attrlist) relationships allEntities =
manyToManyEntities = manyToMany allEntities (Entity entityName attrlist)
manyToOneEntities = manyToOne (Entity entityName attrlist) relationships
argumentCount = length attrlist + length manyToOneEntities
+ length manyToManyEntities
+ length manyToManyEntities
in
stCmtFunc
("The WUI specification for the entity type "++entityName++".\n"++
......@@ -65,13 +65,12 @@ wuiSpec erdname (Entity entityName attrlist) relationships allEntities =
head (attrWidgets attrlist)
else
applyF (combinator argumentCount)
(
(attrWidgets attrlist) ++
(map (\e -> applyF (wui "wSelect")
( attrWidgets attrlist ++
map (\e -> applyF (wui "wSelect")
[constF (erdname, lowerFirst e++"ToShortView"),
CVar (1, lowerFirst $ e ++ "List")])
manyToOneEntities) ++
(map (\e ->
manyToOneEntities ++
map (\e ->
applyF (wui "wMultiCheckSelect")
[CLambda [CPVar (1, lowerFirst e)]
(list2ac [
......@@ -80,8 +79,8 @@ wuiSpec erdname (Entity entityName attrlist) relationships allEntities =
[CVar (1, lowerFirst e)]
]]),
CVar (1, lowerFirst $ e ++ "List")
]) manyToManyEntities)
)
]) manyToManyEntities
)
),
applyF (spiceyModule, "renderLabels")
[constF (entitiesToHtmlModule erdname,
......
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