Differences

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

Link to this comparison view

deck_and_layouts [2012/03/30 15:51]
srdjan.lukovic
deck_and_layouts [2012/07/09 10:43] (current)
srdjan.lukovic [GUI Code]
Line 1: Line 1:
-====== Deck and Layouts Sample ====== +====== Deck and Layouts ======
-This sample upgrades on previous one, introduces deck component, buttons and most importantly bindings (//GUIBindingComponent//). Clicking on buttons will show appropriate panel with same few static components, but with different layouts. Deck component has history stack, which can be browsed using //back// and //forward// input pins (click on << and >> buttons).+
  
-===== UML Model ===== +**Deck and Layouts** is a [[SOLoist Sample Applications|SOLoist sample application]] that shows the use of the deck panel component, buttons, and //bindings// (//GUIBindingComponent//). 
-None.+ 
 +Clicking on the buttons at the bottom will show the appropriate panel with the same static contents, but with different layouts. The deck component has an internal history stack, which can be browsed using the //back// and //forward// input pins (click on the << and >> buttons).
  
 ==== Live example ==== ==== Live example ====
 [[http://soloistdemo.org/SampleApplications/decklayouts.html]] [[http://soloistdemo.org/SampleApplications/decklayouts.html]]
 +|{{screen:deckandlayouts.png?250}}|
 +
 +===== UML Model =====
 +None.
  
 ===== Business Logic Code ===== ===== Business Logic Code =====
Line 18: Line 22:
 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.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 30: Line 33:
 import rs.sol.soloist.server.guiconfiguration.layout.DockLayoutData; import rs.sol.soloist.server.guiconfiguration.layout.DockLayoutData;
 import rs.sol.soloist.server.guiconfiguration.layout.DockLayoutDirection; import rs.sol.soloist.server.guiconfiguration.layout.DockLayoutDirection;
-import rs.sol.soloist.server.guiconfiguration.layout.XYLayout;+import rs.sol.soloist.server.guiconfiguration.layout.TableLayoutData;
 import rs.sol.soloist.server.guiconfiguration.layout.XYLayoutData; import rs.sol.soloist.server.guiconfiguration.layout.XYLayoutData;
 import rs.sol.soloist.server.server.SoloistServiceServlet; import rs.sol.soloist.server.server.SoloistServiceServlet;
Line 41: Line 44:
  public void init() throws InitializerFailedException {  public void init() throws InitializerFailedException {
  GUIApplicationComponent application = new GUIApplicationComponent();  GUIApplicationComponent application = new GUIApplicationComponent();
- application.name.set(Text.fromString("DeckLayoutStaticComponents"));+ application.setName("DeckLayoutStaticComponents");
  SoloistServiceServlet.registerApplication(application);  SoloistServiceServlet.registerApplication(application);
  GUIPanelComponent root = GUIPanelComponent.createFlow(application);  GUIPanelComponent root = GUIPanelComponent.createFlow(application);
   
  GUILabelComponent title = GUILabelComponent.create(root, "Deck and Layouts");  GUILabelComponent title = GUILabelComponent.create(root, "Deck and Layouts");
- 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");
  
  GUIDeckComponent deck = GUIDeckComponent.create(topPanel);  GUIDeckComponent deck = GUIDeckComponent.create(topPanel);
- deck.styleName.set(Text.fromString("deckH"));+ deck.setStyle("deckH");
  
  GUIPanelComponent verticalPanel = GUIPanelComponent.createVertical(deck);  GUIPanelComponent verticalPanel = GUIPanelComponent.createVertical(deck);
Line 65: Line 68:
  GUIPanelComponent table = GUIPanelComponent.createTable(deck);  GUIPanelComponent table = GUIPanelComponent.createTable(deck);
  int row = 0, col = 0;  int row = 0, col = 0;
- GUILabelComponent.create(table, "GUILabelComponent", row, col++); + GUILabelComponent.create(table, "GUILabelComponent", TableLayoutData.create(row, col++)); 
- GUILinkComponent.create(table, "GUILinkComponent", "http://www.soloist4uml.com", row++, col--); + GUILinkComponent.create(table, "GUILinkComponent", "http://www.soloist4uml.com", TableLayoutData.create(row++, col--)); 
- GUIImageComponent.create(table, "images/logo.png", row, col++); + GUIImageComponent.create(table, "images/logo.png", TableLayoutData.create(row, col++)); 
- GUIHTMLComponent.create(table, "<h1>GUI<i>HTMLComponent</i></h1>", row, col);+ GUIHTMLComponent.create(table, "<h1>GUI<i>HTMLComponent</i></h1>", TableLayoutData.create(row, col));
  
  GUIPanelComponent dock = GUIPanelComponent.createDock(deck);  GUIPanelComponent dock = GUIPanelComponent.createDock(deck);
- dock.styleName.set(Text.fromString("box")); + dock.setStyle("box"); 
- GUILabelComponent.create(dock, "GUILabelComponent").layoutData.set(new DockLayoutData(DockLayoutDirection.NORTH, 5)); + GUILabelComponent.create(dock, "GUILabelComponent", DockLayoutData.create(DockLayoutDirection.NORTH, 5)); 
- GUILinkComponent.create(dock, "GUILinkComponent", "http://www.soloist4uml.com", "_blank").layoutData + GUILinkComponent.create(dock, "GUILinkComponent", "http://www.soloist4uml.com", "_blank", DockLayoutData.create(DockLayoutDirection.EAST, 9)); 
- .set(new DockLayoutData(DockLayoutDirection.EAST, 9)); + GUIImageComponent.create(dock, "images/logo.png", DockLayoutData.create(DockLayoutDirection.WEST, 12)); 
- GUIImageComponent.create(dock, "images/logo.png").layoutData.set(new DockLayoutData(DockLayoutDirection.WEST, 12)); + GUIHTMLComponent.create(dock, "<h1>GUI<i>HTMLComponent</i></h1>", DockLayoutData.create(DockLayoutDirection.SOUTH, 5));
- GUIHTMLComponent.create(dock, "<h1>GUI<i>HTMLComponent</i></h1>").layoutData.set(new DockLayoutData(DockLayoutDirection.SOUTH, 5));+
  
- GUIPanelComponent xy = new GUIPanelComponent(); + GUIPanelComponent xy = GUIPanelComponent.createAbsolute(deck); 
- xy.styleName.set(Text.fromString("box")); + xy.setStyle("box"); 
- xy.parent.set(deck); + GUILabelComponent.create(xy, "GUILabelComponent", XYLayoutData.create(5, 10, "120px""30px")); 
- xy.layout.set(new XYLayout()); + GUILinkComponent.create(xy, "GUILinkComponent", "http://www.soloist4uml.com", "_blank", XYLayoutData.create(155, 20, "120px""30px")); 
- GUILabelComponent.create(xy, "GUILabelComponent").layoutData.set(new XYLayoutData(5, 10, 12030)); + GUIImageComponent.create(xy, "images/logo.png", XYLayoutData.create(55, 110, "160px""80px")); 
- GUILinkComponent.create(xy, "GUILinkComponent", "http://www.soloist4uml.com", "_blank").layoutData.set(new XYLayoutData(155, 20, 12030)); + GUIHTMLComponent.create(xy, "<h1>GUI<i>HTMLComponent</i></h1>", XYLayoutData.create(205, 50, "280px""40px"));
- GUIImageComponent.create(xy, "images/logo.png").layoutData.set(new XYLayoutData(55, 110, 16080)); +
- GUIHTMLComponent.create(xy, "<h1>GUI<i>HTMLComponent</i></h1>").layoutData.set(new XYLayoutData(205, 50, 28040));+
  
  GUIButtonComponent verticalBtn = GUIButtonComponent.create(topPanel, "Vertical");  GUIButtonComponent verticalBtn = GUIButtonComponent.create(topPanel, "Vertical");
Line 94: Line 94:
  GUIButtonComponent xyBtn = GUIButtonComponent.create(topPanel, "XY");  GUIButtonComponent xyBtn = GUIButtonComponent.create(topPanel, "XY");
   
- // clicking on button will send signal to show input pin of corresponding panel which in turn will be shown in deck + GUIComponentBinding.create(verticalBtn.opClick(), verticalPanel.ipShow()); 
- GUIComponentBinding.create(verticalBtn.click, verticalPanel.show); + GUIComponentBinding.create(horizontalBtn.opClick(), horizontalPanel.ipShow()); 
- GUIComponentBinding.create(horizontalBtn.click, horizontalPanel.show); + GUIComponentBinding.create(flowBtn.opClick(), flowPanel.ipShow()); 
- GUIComponentBinding.create(flowBtn.click, flowPanel.show); + GUIComponentBinding.create(tableBtn.opClick(), table.ipShow()); 
- GUIComponentBinding.create(tableBtn.click, table.show); + GUIComponentBinding.create(dockBtn.opClick(), dock.ipShow()); 
- GUIComponentBinding.create(dockBtn.click, dock.show); + GUIComponentBinding.create(xyBtn.opClick(), xy.ipShow());
- GUIComponentBinding.create(xyBtn.click, xy.show);+
  
  GUIButtonComponent backBtn = GUIButtonComponent.create(topPanel, "<<");  GUIButtonComponent backBtn = GUIButtonComponent.create(topPanel, "<<");
  GUIButtonComponent forwardBtn = GUIButtonComponent.create(topPanel, ">>");  GUIButtonComponent forwardBtn = GUIButtonComponent.create(topPanel, ">>");
- GUIComponentBinding.create(forwardBtn.click, deck.forward); + GUIComponentBinding.create(forwardBtn.opClick(), deck.ipForward()); 
- GUIComponentBinding.create(backBtn.click, deck.back);+ GUIComponentBinding.create(backBtn.opClick(), deck.ipBack());
  }  }
  
Print/export