Dialogs in seaBreeze

There are three different kinds of application models in seaBreeze. The normal one, the dialog and the sub component.

Dialogs

Dialog are shown in a lightbox, that is: on top of the current component with a transparent gray background between the component and the dialog. To create a dialog, open the application in the editor and create a new component from the toolbar. The creation dialog provides a "Component Type" menu button, which has the option "Dialog Component". 

The Dialog Components have two requirements. They can only use Ajax for their interaction and they have a fixed size. The size can be changed in the body element's Basic properties.

To call such a Dialog, use the SBAjaxDialog class. Assuming there's a dialog component called UserDetails, it can be called like so:

requestUserDetails
    | details |

    dialogWrapper := SBAjaxDialog withTitle: 'User Details'.
    details := dialogWrapper call: UserDetails new.
    self processDetails: details.

The UserDetails can be implemented like any other component. When they perform a #answer: the dialog is closed and its result is then returned by the #call: method.

There are already predefined dialog's that can be accessed via SBAjaxDialog's class methods, like: #warn:, #request: etc.

SBAjaxDialog dialogClass warn:'Do not forget to send #dialogClass'.

Subcomponents

A application can be composed of (several) sub components by embedding them into the main component. seaBreeze provides the Subcomponent element, which will display a sub component in another component. Think of a login application embedded into the main application. When the main application starts, the login component indicates that you have to login. It implements all the logic for logging in and can be reused in other projects.

Sub components are created like dialogs, create a new component from the editor and choose the Component Type "Sub Component". The only difference between a normal application model and a sub component is that the sub component has an instance variable called 'parent' and can be instantiated using the #from: method with the parent as parameter

mySubcomponent

mySubcomponent isNil ifTrue:[mySubcomponent := (MySubcomponent from: self) asValue].
^mySubcomponent

This is an example of how the aspect of a Subcomponent-Element could be implemented. It creates the instance lazy and tells it that self is the parent of MySubcomponent. 

 

 

Copyright 2013 by Georg Heeg eK, released under MIT License