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
|
iotype:
|
{({IntDom},_) |-> _ || ({FloatDom},_) |-> _ || ({CharDom},_) |-> _ || ({StringDom},{True}) |-> _ || ({StringDom},{False}) |-> _ || ({BoolDom},_) |-> _ || ({DateDom},_) |-> _ || ({UserDefined},_) |-> _ || ({KeyDom},_) |-> _}
|