130 likes | 195 Vues
NIANIO Pattern. Błażej Chodarcewicz Warsaw, 2006-02-22. Presentation Plan. Current UI problems The Nianio introduction Test application Java patterns Genrap UI future. Current prblems. Incomplete application state A lot of state full objects Synchronization and threads
E N D
NIANIO Pattern Błażej Chodarcewicz Warsaw, 2006-02-22
Presentation Plan • Current UI problems • The Nianio introduction • Test application • Java patterns • Genrap UI future
Current prblems • Incomplete application state • A lot of state full objects • Synchronization and threads • Models, MM, listeners – loops • Un clear event flow
The NIANIO • State type definition • Command type definition • External command type definition • Function – nianio implementation – logic
State - schema structure Command - schema variant External command - schema variant State = { … } Cmd = variant [java mm] { … } ExtCmd = variant [java mm] {…} Java implementation of Nianio • Nianio = public State invoke(State, Cmd, ExtCmd.MM) • Function • No sideefects • ExtCmd.MM accumulates commands
AppState = { reportFile, xmlFile, xsdFile, outputFile: SelectFileState = { fileName : string ? fileChooserState : FileChooserParams= { kind : FileChooserKind = variant{open | save} extensions :arrayof string description : string } } outputKind : OutputKind= variant{html | pdf | xls} status : Status = variant{generatingReport of int | ready} messageDialogStates : MsgDialogs } MsgDialogs = [java dict [key]] arrayof Entry = { key : MsgDialogKey = string value : MessageDialogParams= { dialogKind : MessageDialogKind = variant{ info |warning | error} message : string } }
AppLogicCmd = [java mm]variant{ run|close |setPdfOutput|setHtmlOutput|setXlsOutput |generateRequest |reportGenerated of GenrapPluginEvent |reportFileCmd of SelectFileCmd |xmlFileCmd of SelectFileCmd |xsdFileCmd of SelectFileCmd |outputFileCmd of SelectFileCmd |messageDialogClosed of MsgDialogKey } SelectFileCmd = [java mm]variant{ setFileName of string |selectFromFileChooser |fileSelected of FileChooserResult = { ? path : string } } GenrapPluginEvent = [java mm]variant{ success of ReportParams |failure of ReportGenerationFailure = { params : ReportParams cause : string } }
AppLogicExtCmd = [java mm]variant{ generate of ReportParams |showMainFrame of MainFrame = { reportFileName, xmlFileName, xsdFileName, outputFileName : string outputKind : OutputKind status : string } |setOutput of OutputKind |setStatus of string |reportFile of SelectFileExtCmd |xmlFile of SelectFileExtCmd |xsdFile of SelectFileExtCmd |outputFile of SelectFileExtCmd |showMessage of ShowMessageCmd = { key : MsgDialogKey params : MessageDialogParams } |closeMainFrame|exit } SelectFileExtCmd = [java mm]variant{ openFileChooser of FileChooserParams |setFileName of string }
More Nianio examples – Test Application Source • Nianio implementation • Nianio invocation • Nianio parameterization • Connecting nianios
Genrap UI future • Nianio and functional code everywhere (no models, listeners) • Small part of code which touch threads, synchronization etc. • Controlled event flow • Clear core structure
Thank you Questions?