|
definition: |
widgetFor :: Domain -> Bool -> CExpr
widgetFor domain null =
case domain of
IntDom _ -> addMaybe (constF (wuiModule "wInt"))
FloatDom _ -> addMaybe (constF (wuiModule "wFloat"))
CharDom _ -> addMaybe (constF (wuiModule "wString"))
StringDom _ -> if null then constF (spiceyModule,"wString")
else constF (wuiModule "wRequiredString")
--constF (wuiModule (if null then "wString" else "wRequiredString"))
BoolDom _ -> addMaybe (constF (wuiModule "wBoolean"))
DateDom _ -> addMaybe (constF (spiceyModule, "wDateType"))
UserDefined _ _ -> addMaybe (applyF (wuiModule "wCheckBool")
[applyF (html "htxt") [string2ac ""]])
KeyDom _ -> addMaybe (constF (wuiModule "wInt"))
_ -> error "widgetFor: unknown domain for attribute"
where
-- adds a Maybe WUI if null values are allowed
addMaybe e =
if null
then applyF (spiceyModule,"wUncheckMaybe")
[domainDefaultValue
(applyF (timeModule, "toClockTime")
[applyF (timeModule, "CalendarTime")
(map (CLit . CIntc) [2018,1,1,0,0,0,0])])
domain, e]
else e
|
|
demand: |
arguments 1 2 |
|
deterministic: |
deterministic operation |
|
failfree: |
(_, _) |
|
indeterministic: |
referentially transparent operation |
|
infix: |
no fixity defined |
|
iotype: |
{({IntDom},_) |-> _ || ({FloatDom},_) |-> _ || ({CharDom},_) |-> _ || ({StringDom},{True}) |-> _ || ({StringDom},{False}) |-> _ || ({BoolDom},_) |-> _ || ({DateDom},_) |-> _ || ({UserDefined},_) |-> _ || ({KeyDom},_) |-> _}
|
|
name: |
widgetFor |
|
precedence: |
no precedence defined |
|
result-values: |
_ |
|
signature: |
Database.ERD.Domain -> Prelude.Bool -> AbstractCurry.Types.CExpr |
|
solution-complete: |
operation might suspend on free variables |
|
terminating: |
yes |
|
totally-defined: |
reducible on all ground data terms |