This is an old revision of the document!
Table of Contents
Wizard Sample
This sample demonstrates simple wizard.
Live example
UML Model
None.
Business Logic Code
None.
GUI Code
package rs.sol.sampleapps.wizard; import rs.sol.soloist.helpers.init.Initializer; import rs.sol.soloist.helpers.init.InitializerFailedException; import rs.sol.soloist.server.builtindomains.builtindatatypes.Boolean; import rs.sol.soloist.server.builtindomains.builtindatatypes.Text; import rs.sol.soloist.server.guiconfiguration.components.GUIApplicationComponent; import rs.sol.soloist.server.guiconfiguration.components.GUIButtonComponent; import rs.sol.soloist.server.guiconfiguration.components.GUIDialogComponent; import rs.sol.soloist.server.guiconfiguration.components.GUILabelComponent; import rs.sol.soloist.server.guiconfiguration.components.GUIPanelComponent; import rs.sol.soloist.server.guiconfiguration.construction.GUIComponentBinding; import rs.sol.soloist.server.guiconfiguration.layout.FlowLayout; import rs.sol.soloist.server.server.SoloistServiceServlet; public enum WizardSample implements Initializer { INSTANCE; @Override public void init() throws InitializerFailedException { GUIApplicationComponent application = new GUIApplicationComponent(); application.name.set(Text.fromString("WizardSample")); SoloistServiceServlet.registerApplication(application); GUIPanelComponent root = GUIPanelComponent.createFlow(application); GUILabelComponent title = GUILabelComponent.create(root, "Wizard"); title.styleName.set(Text.fromString("titleStyle")); GUIPanelComponent topPanel = GUIPanelComponent.createFlow(root); topPanel.styleName.set(Text.fromString("topPanel")); GUIPanelComponent blackScreen = GUIPanelComponent.createFlow(root); // background panel which is shown when wizard dialog pops up, aids visual effect blackScreen.styleName.set(Text.fromString("blackScreen")); GUIDialogComponent dialog = new GUIDialogComponent(); dialog.modal.set(Boolean.TRUE); dialog.application.set(root.getApplication()); dialog.caption.set(Text.fromString("SOLoist Wizard")); GUIPanelComponent dialogPanel = GUIPanelComponent.createFlow(dialog); dialogPanel.styleName.set(Text.fromString("dialogPanel")); Wizard wizard = new Wizard(dialogPanel, dialog, blackScreen); // panels which will be shown as steps in wizard GUIPanelComponent p1 = new GUIPanelComponent(); p1.layout.set(new FlowLayout()); GUIPanelComponent p2 = new GUIPanelComponent(); p2.layout.set(new FlowLayout()); GUIPanelComponent p3 = new GUIPanelComponent(); p3.layout.set(new FlowLayout()); // content can arbitrarily complex GUILabelComponent.create(p1, "1").styleName.set(Text.fromString("largeText")); GUILabelComponent.create(p2, "2").styleName.set(Text.fromString("largeText")); GUILabelComponent.create(p3, "3").styleName.set(Text.fromString("largeText")); // add pages to wizard in order wizard.addPage(p1); wizard.addPage(p2); wizard.addPage(p3); // generate wizard GUI wizard.generate(); GUIButtonComponent cmdStart = GUIButtonComponent.create(topPanel, "Start wizard"); GUIComponentBinding.create(cmdStart.click, wizard.getBufferDarkenBackground().send); GUIComponentBinding.create(cmdStart.click, wizard.getFirstChild().showInParent); GUIComponentBinding.create(cmdStart.click, wizard.getFirstButtonChild().showInParent); GUIComponentBinding.create(cmdStart.click, dialog.show); GUIComponentBinding.create(cmdStart.result, dialogPanel.input); GUIComponentBinding.create(cmdStart.result, p1.input); GUIComponentBinding.create(cmdStart.result, p2.input); GUIComponentBinding.create(cmdStart.result, p3.input); } }