Differences

This shows you the differences between two versions of the page.

Link to this comparison view

wizard [2012/04/09 17:47]
dragan.milicev
wizard [2012/07/09 10:46] (current)
srdjan.lukovic [GUI Code]
Line 20: Line 20:
 import rs.sol.soloist.helpers.init.Initializer; import rs.sol.soloist.helpers.init.Initializer;
 import rs.sol.soloist.helpers.init.InitializerFailedException; 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.GUIApplicationComponent;
 import rs.sol.soloist.server.guiconfiguration.components.GUIButtonComponent; import rs.sol.soloist.server.guiconfiguration.components.GUIButtonComponent;
Line 38: Line 36:
  public void init() throws InitializerFailedException {  public void init() throws InitializerFailedException {
  GUIApplicationComponent application = new GUIApplicationComponent();  GUIApplicationComponent application = new GUIApplicationComponent();
- application.name.set(Text.fromString("WizardSample"));+ application.setName("WizardSample");
  SoloistServiceServlet.registerApplication(application);  SoloistServiceServlet.registerApplication(application);
   
Line 44: Line 42:
  
  GUILabelComponent title = GUILabelComponent.create(root, "Wizard");  GUILabelComponent title = GUILabelComponent.create(root, "Wizard");
- title.styleName.set(Text.fromString("titleStyle"));+ title.setStyle("titleStyle");
   
  GUIPanelComponent topPanel = GUIPanelComponent.createFlow(root);  GUIPanelComponent topPanel = GUIPanelComponent.createFlow(root);
- topPanel.styleName.set(Text.fromString("topPanel"));+ topPanel.setStyle("topPanel");
   
- GUIPanelComponent blackScreen = GUIPanelComponent.createFlow(root); // background panel which is shown when wizard dialog pops up, aids visual effect + // background panel which is shown when wizard dialog pops up, aids visual effect 
- blackScreen.styleName.set(Text.fromString("blackScreen"));+ GUIPanelComponent blackScreen = GUIPanelComponent.createFlow(root); 
 + blackScreen.setStyle("blackScreen");
  
  GUIDialogComponent dialog = new GUIDialogComponent();  GUIDialogComponent dialog = new GUIDialogComponent();
- dialog.modal.set(Boolean.TRUE); + dialog.setModal(true); 
- dialog.application.set(root.getApplication()); + application.addDialog(dialog); 
- dialog.caption.set(Text.fromString("SOLoist Wizard"));+ dialog.setCaption("SOLoist Wizard");
  
  GUIPanelComponent dialogPanel = GUIPanelComponent.createFlow(dialog);  GUIPanelComponent dialogPanel = GUIPanelComponent.createFlow(dialog);
- dialogPanel.styleName.set(Text.fromString("dialogPanel"));+ dialogPanel.setStyle("dialogPanel");
  
  Wizard wizard = new Wizard(dialogPanel, dialog, blackScreen);  Wizard wizard = new Wizard(dialogPanel, dialog, blackScreen);
  
- // Panels that will be shown as steps in the wizard+ // Panels which will be shown as steps in wizard
  GUIPanelComponent p1 = new GUIPanelComponent();  GUIPanelComponent p1 = new GUIPanelComponent();
- p1.layout.set(new FlowLayout());+ p1.setLayout(new FlowLayout());
  GUIPanelComponent p2 = new GUIPanelComponent();  GUIPanelComponent p2 = new GUIPanelComponent();
- p2.layout.set(new FlowLayout());+ p2.setLayout(new FlowLayout());
  GUIPanelComponent p3 = new GUIPanelComponent();  GUIPanelComponent p3 = new GUIPanelComponent();
- p3.layout.set(new FlowLayout());+ p3.setLayout(new FlowLayout());
  
- // The content can be arbitrarily complex + // The content can arbitrarily complex 
- GUILabelComponent.create(p1, "1").styleName.set(Text.fromString("largeText")); + GUILabelComponent.create(p1, "1/3").setStyle("largeText"); 
- GUILabelComponent.create(p2, "2").styleName.set(Text.fromString("largeText")); + GUILabelComponent.create(p2, "2/3").setStyle("largeText"); 
- GUILabelComponent.create(p3, "3").styleName.set(Text.fromString("largeText"));+ GUILabelComponent.create(p3, "3/3").setStyle("largeText");
  
- // Add pages to the wizard in order+ // Add pages to wizard in order
  wizard.addPage(p1);  wizard.addPage(p1);
  wizard.addPage(p2);  wizard.addPage(p2);
Line 85: Line 84:
  GUIButtonComponent cmdStart = GUIButtonComponent.create(topPanel, "Start wizard");  GUIButtonComponent cmdStart = GUIButtonComponent.create(topPanel, "Start wizard");
  
- GUIComponentBinding.create(cmdStart.click, wizard.getBufferDarkenBackground().send); + GUIComponentBinding.create(cmdStart.opClick(), wizard.getBufferDarkenBackground().ipSend()); 
- GUIComponentBinding.create(cmdStart.click, wizard.getFirstChild().showInParent); + GUIComponentBinding.create(cmdStart.opClick(), wizard.getFirstChild().ipShowInParent()); 
- GUIComponentBinding.create(cmdStart.click, wizard.getFirstButtonChild().showInParent);+ GUIComponentBinding.create(cmdStart.opClick(), wizard.getFirstButtonChild().ipShowInParent());
  
- GUIComponentBinding.create(cmdStart.click, dialog.show); + GUIComponentBinding.create(cmdStart.opClick(), dialog.ipShow()); 
- GUIComponentBinding.create(cmdStart.result, dialogPanel.input);+ GUIComponentBinding.create(cmdStart.opResult(), dialogPanel.ipRelay1());
  
- GUIComponentBinding.create(cmdStart.result, p1.input); + GUIComponentBinding.create(cmdStart.opResult(), p1.ipRelay1()); 
- GUIComponentBinding.create(cmdStart.result, p2.input); + GUIComponentBinding.create(cmdStart.opResult(), p2.ipRelay1()); 
- GUIComponentBinding.create(cmdStart.result, p3.input);+ GUIComponentBinding.create(cmdStart.opResult(), p3.ipRelay1());
     }     }
- +
 } }
 </code> </code>
Line 106: Line 105:
 import java.util.List; import java.util.List;
  
-import rs.sol.soloist.server.builtindomains.builtindatatypes.Boolean; 
 import rs.sol.soloist.server.builtindomains.builtindatatypes.Text; import rs.sol.soloist.server.builtindomains.builtindatatypes.Text;
 import rs.sol.soloist.server.guiconfiguration.components.GUIButtonComponent; import rs.sol.soloist.server.guiconfiguration.components.GUIButtonComponent;
Line 114: Line 112:
 import rs.sol.soloist.server.guiconfiguration.construction.GUIComponentBinding; import rs.sol.soloist.server.guiconfiguration.construction.GUIComponentBinding;
 import rs.sol.soloist.server.guiconfiguration.nonvisualcompoments.GUIBufferComponent; import rs.sol.soloist.server.guiconfiguration.nonvisualcompoments.GUIBufferComponent;
-import rs.sol.soloist.server.uml.concepts.runtime.ISlot; 
  
 public class Wizard { public class Wizard {
Line 125: Line 122:
  private GUIBufferComponent bufferRemove;  private GUIBufferComponent bufferRemove;
  private GUIPanelComponent blackScreen;  private GUIPanelComponent blackScreen;
- private ISlot<Text> firstNextEvent; 
- private ISlot<Text> lastNextEvent; 
- private ISlot<Text> finishEvent; 
  private GUIPanelComponent rootPanel;  private GUIPanelComponent rootPanel;
  
Line 145: Line 139:
  bufferRemove = GUIBufferComponent.create(rootPanel, false, Text.fromString("darkenBackground"));  bufferRemove = GUIBufferComponent.create(rootPanel, false, Text.fromString("darkenBackground"));
  
- GUIComponentBinding.create(bufferSet.output, blackScreen.addStyle); + GUIComponentBinding.create(bufferSet.opOutput(), blackScreen.ipAddStyle()); 
- GUIComponentBinding.create(bufferRemove.output, blackScreen.removeStyle);+ GUIComponentBinding.create(bufferRemove.opOutput(), blackScreen.ipRemoveStyle());
  
  GUIPanelComponent mainPanel = GUIPanelComponent.createFlow(rootPanel);  GUIPanelComponent mainPanel = GUIPanelComponent.createFlow(rootPanel);
Line 152: Line 146:
  
  mainDeck = GUIDeckComponent.create(mainPanel);  mainDeck = GUIDeckComponent.create(mainPanel);
- mainPanel.styleName.set(Text.fromString("wizardMain"));+ mainPanel.setStyle("wizardMain");
  
  buttonDeck = GUIDeckComponent.create(btnPanel);  buttonDeck = GUIDeckComponent.create(btnPanel);
- btnPanel.styleName.set(Text.fromString("wizardButtons"));+ btnPanel.setStyle("wizardButtons");
  
  for (int i = 0; i < pages.size(); i++) {  for (int i = 0; i < pages.size(); i++) {
- mainDeck.children.add(pages.get(i));+ mainDeck.add(pages.get(i));
  GUIPanelComponent.createFlow(buttonDeck);  GUIPanelComponent.createFlow(buttonDeck);
  }  }
Line 164: Line 158:
  for (int i = 0; i < pages.size(); i++) {  for (int i = 0; i < pages.size(); i++) {
  
- GUIPanelComponent buttonPanel = (GUIPanelComponent) buttonDeck.children.at(i);+ GUIPanelComponent buttonPanel = (GUIPanelComponent) buttonDeck.get(i);
  
  GUIButtonComponent btnCancel = GUIButtonComponent.create(buttonPanel, "Cancel");  GUIButtonComponent btnCancel = GUIButtonComponent.create(buttonPanel, "Cancel");
- btnCancel.styleName.set(Text.fromString("cancelButton")); + btnCancel.setStyle("cancelButton"); 
- btnCancel.confirmationRequired.set(Boolean.TRUE); + btnCancel.setConfirmationRequired(true); 
- btnCancel.confirmationMessage.set(Text.fromString("Cancel?"));+ btnCancel.setConfirmationMessage("Cancel?");
  
- GUIComponentBinding.create(btnCancel.click, dialog.hide); + GUIComponentBinding.create(btnCancel.opClick(), dialog.ipHide()); 
- GUIComponentBinding.create(btnCancel.click, bufferRemove.send);+ GUIComponentBinding.create(btnCancel.opClick(), bufferRemove.ipSend());
  
  if (i != 0) {  if (i != 0) {
  GUIButtonComponent btnPrev = GUIButtonComponent.create(buttonPanel, "< Back");  GUIButtonComponent btnPrev = GUIButtonComponent.create(buttonPanel, "< Back");
- GUIComponentBinding.create(btnPrev.click, mainDeck.children.at(i - 1).show); + GUIComponentBinding.create(btnPrev.opClick(), mainDeck.get(i - 1).ipShow()); 
- GUIComponentBinding.create(btnPrev.click, buttonDeck.children.at(i - 1).show); + GUIComponentBinding.create(btnPrev.opClick(), buttonDeck.get(i - 1).ipShow()); 
- btnPrev.styleName.set(Text.fromString("previousButton"));+ btnPrev.setStyle("previousButton");
  }  }
  
  if (i == pages.size() - 1) {  if (i == pages.size() - 1) {
  GUIButtonComponent btnFinish = GUIButtonComponent.create(buttonPanel, "Finish");  GUIButtonComponent btnFinish = GUIButtonComponent.create(buttonPanel, "Finish");
- btnFinish.styleName.set(Text.fromString("finishButton")); + btnFinish.setStyle("finishButton"); 
- btnFinish.confirmationMessage.set(Text.fromString("Finish?")); + btnFinish.setConfirmationMessage("Finish?"); 
- btnFinish.confirmationRequired.set(Boolean.TRUE); + btnFinish.setConfirmationRequired(true); 
- GUIComponentBinding.create(btnFinish.click, dialog.hide); + GUIComponentBinding.create(btnFinish.opClick(), dialog.ipHide()); 
- GUIComponentBinding.create(btnFinish.click, bufferRemove.send)+ GUIComponentBinding.create(btnFinish.opClick(), bufferRemove.ipSend());
- finishEvent = btnFinish.click;+
  } else {  } else {
  GUIButtonComponent btnNext = GUIButtonComponent.create(buttonPanel, "Next >");  GUIButtonComponent btnNext = GUIButtonComponent.create(buttonPanel, "Next >");
- btnNext.styleName.set(Text.fromString("nextButton")); + btnNext.setStyle("nextButton"); 
- GUIComponentBinding.create(btnNext.click, mainDeck.children.at(i + 1).show); + GUIComponentBinding.create(btnNext.opClick(), mainDeck.get(i + 1).ipShow()); 
- GUIComponentBinding.create(btnNext.click, buttonDeck.children.at(i + 1).show); + GUIComponentBinding.create(btnNext.opClick(), buttonDeck.get(i + 1).ipShow());
- if (i == 0 +
- firstNextEvent = btnNext.click; +
- if (i == pages.size(- 2) +
- lastNextEvent = btnNext.click;+
  }  }
- 
  }  }
  }  }
Line 208: Line 196:
  
  public GUIPanelComponent getFirstChild() {  public GUIPanelComponent getFirstChild() {
- return (GUIPanelComponent) mainDeck.children.at(0);+ return (GUIPanelComponent) mainDeck.get(0);
  }  }
  
  public GUIPanelComponent getFirstButtonChild() {  public GUIPanelComponent getFirstButtonChild() {
- return (GUIPanelComponent) buttonDeck.children.at(0);+ return (GUIPanelComponent) buttonDeck.get(0);
  }  }
- 
- public ISlot<Text> getFirstNextEvent() { 
- return firstNextEvent; 
- } 
- 
- public ISlot<Text> getLastNextEvent() { 
- return lastNextEvent; 
- } 
- 
- public ISlot<Text> getFinishEvent() { 
- return finishEvent; 
- } 
- 
 } }
 </code> </code>
Print/export