====== Deck and Layouts ====== **Deck and Layouts** is a [[SOLoist Sample Applications|SOLoist sample application]] that shows the use of the deck panel component, buttons, and //bindings// (//GUIBindingComponent//). 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 ==== [[http://soloistdemo.org/SampleApplications/decklayouts.html]] |{{screen:deckandlayouts.png?250}}| ===== UML Model ===== None. ===== Business Logic Code ===== None. ===== GUI Code ===== package rs.sol.sampleapps; import rs.sol.soloist.helpers.init.Initializer; import rs.sol.soloist.helpers.init.InitializerFailedException; import rs.sol.soloist.server.guiconfiguration.components.GUIApplicationComponent; import rs.sol.soloist.server.guiconfiguration.components.GUIButtonComponent; import rs.sol.soloist.server.guiconfiguration.components.GUIDeckComponent; import rs.sol.soloist.server.guiconfiguration.components.GUIHTMLComponent; import rs.sol.soloist.server.guiconfiguration.components.GUIImageComponent; import rs.sol.soloist.server.guiconfiguration.components.GUILabelComponent; import rs.sol.soloist.server.guiconfiguration.components.GUILinkComponent; import rs.sol.soloist.server.guiconfiguration.components.GUIPanelComponent; import rs.sol.soloist.server.guiconfiguration.construction.GUIComponentBinding; import rs.sol.soloist.server.guiconfiguration.layout.DockLayoutData; import rs.sol.soloist.server.guiconfiguration.layout.DockLayoutDirection; import rs.sol.soloist.server.guiconfiguration.layout.TableLayoutData; import rs.sol.soloist.server.guiconfiguration.layout.XYLayoutData; import rs.sol.soloist.server.server.SoloistServiceServlet; public enum DeckLayoutStaticComponents implements Initializer { INSTANCE; @Override public void init() throws InitializerFailedException { GUIApplicationComponent application = new GUIApplicationComponent(); application.setName("DeckLayoutStaticComponents"); SoloistServiceServlet.registerApplication(application); GUIPanelComponent root = GUIPanelComponent.createFlow(application); GUILabelComponent title = GUILabelComponent.create(root, "Deck and Layouts"); title.setStyle("titleStyle"); GUIPanelComponent topPanel = GUIPanelComponent.createFlow(root); topPanel.setStyle("topPanel"); GUIDeckComponent deck = GUIDeckComponent.create(topPanel); deck.setStyle("deckH"); GUIPanelComponent verticalPanel = GUIPanelComponent.createVertical(deck); createStaticComponents(verticalPanel); GUIPanelComponent horizontalPanel = GUIPanelComponent.createHorizontal(deck); createStaticComponents(horizontalPanel); GUIPanelComponent flowPanel = GUIPanelComponent.createFlow(deck); createStaticComponents(flowPanel); GUIPanelComponent table = GUIPanelComponent.createTable(deck); int row = 0, col = 0; GUILabelComponent.create(table, "GUILabelComponent", TableLayoutData.create(row, col++)); GUILinkComponent.create(table, "GUILinkComponent", "http://www.soloist4uml.com", TableLayoutData.create(row++, col--)); GUIImageComponent.create(table, "images/logo.png", TableLayoutData.create(row, col++)); GUIHTMLComponent.create(table, "

GUIHTMLComponent

", TableLayoutData.create(row, col)); GUIPanelComponent dock = GUIPanelComponent.createDock(deck); dock.setStyle("box"); GUILabelComponent.create(dock, "GUILabelComponent", DockLayoutData.create(DockLayoutDirection.NORTH, 5)); GUILinkComponent.create(dock, "GUILinkComponent", "http://www.soloist4uml.com", "_blank", DockLayoutData.create(DockLayoutDirection.EAST, 9)); GUIImageComponent.create(dock, "images/logo.png", DockLayoutData.create(DockLayoutDirection.WEST, 12)); GUIHTMLComponent.create(dock, "

GUIHTMLComponent

", DockLayoutData.create(DockLayoutDirection.SOUTH, 5)); GUIPanelComponent xy = GUIPanelComponent.createAbsolute(deck); xy.setStyle("box"); GUILabelComponent.create(xy, "GUILabelComponent", XYLayoutData.create(5, 10, "120px", "30px")); GUILinkComponent.create(xy, "GUILinkComponent", "http://www.soloist4uml.com", "_blank", XYLayoutData.create(155, 20, "120px", "30px")); GUIImageComponent.create(xy, "images/logo.png", XYLayoutData.create(55, 110, "160px", "80px")); GUIHTMLComponent.create(xy, "

GUIHTMLComponent

", XYLayoutData.create(205, 50, "280px", "40px")); GUIButtonComponent verticalBtn = GUIButtonComponent.create(topPanel, "Vertical"); GUIButtonComponent horizontalBtn = GUIButtonComponent.create(topPanel, "Horizontal"); GUIButtonComponent flowBtn = GUIButtonComponent.create(topPanel, "Flow"); GUIButtonComponent tableBtn = GUIButtonComponent.create(topPanel, "Table"); GUIButtonComponent dockBtn = GUIButtonComponent.create(topPanel, "Dock"); GUIButtonComponent xyBtn = GUIButtonComponent.create(topPanel, "XY"); GUIComponentBinding.create(verticalBtn.opClick(), verticalPanel.ipShow()); GUIComponentBinding.create(horizontalBtn.opClick(), horizontalPanel.ipShow()); GUIComponentBinding.create(flowBtn.opClick(), flowPanel.ipShow()); GUIComponentBinding.create(tableBtn.opClick(), table.ipShow()); GUIComponentBinding.create(dockBtn.opClick(), dock.ipShow()); GUIComponentBinding.create(xyBtn.opClick(), xy.ipShow()); GUIButtonComponent backBtn = GUIButtonComponent.create(topPanel, "<<"); GUIButtonComponent forwardBtn = GUIButtonComponent.create(topPanel, ">>"); GUIComponentBinding.create(forwardBtn.opClick(), deck.ipForward()); GUIComponentBinding.create(backBtn.opClick(), deck.ipBack()); } private void createStaticComponents(GUIPanelComponent parent) { GUILabelComponent.create(parent, "GUILabelComponent"); GUILinkComponent.create(parent, "GUILinkComponent", "http://www.soloist4uml.com", "_blank"); GUIImageComponent.create(parent, "images/logo.png"); GUIHTMLComponent.create(parent, "

GUIHTMLComponent

"); } }