воскресенье, 7 августа 2011 г.

Basic concepts

Presenty is a user interface framework that makes it easy to create reusable components of user interface and user interraction logic. With Presenty you can lively tune appearance of your application. 

Presenty based on Model-View-Presenter pattern, view prototypes and continuations.

MVP is powerfull pattern for implementing reusable components of user interface. With MVP you can present your model by different presenters in concrete place of your application. Unfortunately existed MVP frameworks make it difficult to create multiple views for same presenter. For example, you implement ContactPresenter. And you want specific view for it in "contact dial task" and "contact sms task". With Presenty you take it easy. Indeed you can show your presenter with styles (selected or deselected for example). And appearace of this styles can be specific in concrete application task.

With Presenty you can create tasks - reusable components of user interraction logic. Implementation of tasks based on continuation (like tasks in Seaside). Task programming based on simple DSL (it is usual smalltalk of course) which gives you expressions for request confirmations, show warnings, request requisities, request new tasks and others:
  • user warn: 'message'
  • user confirm: 'question?'
  • user input: requisities
  • user select: 'ItemName' from: itemsArray.
  • user execute: newTask
  • ...
You can extend this DSL for your application. For example, you can implement "user dialTo: aContact" which will request user for new DialContactTask.

Every task know user and guide (PtyUser and PtyGuide). With "guide" you can control current view area. You can set up new area or add new items to it. You can set up modal view area and all ui actions will be placed in modal mode:

   guide doInModal: [user warn: 'message'].
Guide is central object which known by every application component: tasks and presenters. It is like museum guide which show you exhibits. You can ask guide to show you presenters or execute some tasks.

Guide has viewport. It is instance of PtyViewportPresenter which presents main application panel with current view area. When you ask guide to show some presenter guide placed it on current view area of viewport.

Each task has its own view area in which it placed ui components. Task view area inherits from caller (parent) task view area. So all components of caller tasks become parts of new task.
Task can return answer to parent (caller) continuation by "parent resumeWith: #answer".
Or you can stop current task by "user stopCurrentTask". And user will be return to previous request.

Each presenter know about continuation in which context it has been shown. Presenter holds it in context variable. All presenters can resume it context with some value by "self answer: #value".

Guide has taskNavigator object. It saves all user requests. So you always can add back button to view area which return user to previous request. "User stopCurrentTask" implemented by taskNavigator too. It removes from navigator all tasks derived from current and executes last remain task which repeats last user request.

Presenty support multilingual by default. All text and image labels are translated by guide translator object. All kind of labels has label name which is key for translator dictionary. You can easily add new languages and translations for it. When image label shown it requests image from guide resourcesManager by translated label name key. By default guide resourcesManager is PtyResourcesManager which loads images from "images" folder near VM.

Guide has task settings (PtyTaskSettings). Task settings holds settings of tasks and presenters. By "guide create: aTask" you can create task instance with saved settings. New instance can be another class. For example, you can request PtyShowListTask and guide creates PtyShowListWithPagesTask or PtySimpleShowListTask. You can see hierarchy of this kind of task. Besides you can spesify settings in concrete context of current tasks chain. So in one context you will see list of items splitted by pages. In another task you will see items in scrolled panel.
Task settings has userFeeling object. It provides preferred instances of tasks and presenters for current platform. Now Presenty has PtyDesktopUserFeeling and PtyStreetUserFeeling. It is possible to implement PtyMobileTouchScreenUserFeeling which gives you input fields with visual keyboard. (It is really done by PtyStreetUserFeeling, but PtyStreetUserFeeling purpose is little different than mobile touch screen devices)

With Presenty you can program in terms of user interraction logic (based on tasks). Way in which this logic will be presented to user is part of design time and configuration of application. For desktop platform you can configure one "look and feel". For tablet platform "look and feel" can be very different. With Presenty you take it without code changes.

In next posts I will show how create Presenty components of user interface.

Комментариев нет:

Отправить комментарий