Differences
This shows you the differences between two versions of the page.
tabs_and_layouts [2012/04/09 17:46] dragan.milicev |
tabs_and_layouts [2012/07/09 10:42] (current) srdjan.lukovic [GUI Code] |
||
---|---|---|---|
Line 21: | Line 21: | ||
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.GUIHTMLComponent; | import rs.sol.soloist.server.guiconfiguration.components.GUIHTMLComponent; | ||
Line 31: | Line 30: | ||
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 42: | Line 41: | ||
public void init() throws InitializerFailedException { | public void init() throws InitializerFailedException { | ||
- | GUIApplicationComponent application = new GUIApplicationComponent(); // new web page | + | GUIApplicationComponent application = new GUIApplicationComponent(); |
- | application.name.set(Text.fromString("TabLayoutStaticComponents")); // set some kind of name for application component so you can refer it by that name from the corresponding html page | + | application.setName("TabLayoutStaticComponents"); |
- | SoloistServiceServlet.registerApplication(application); // register application | + | SoloistServiceServlet.registerApplication(application); |
GUIPanelComponent root = GUIPanelComponent.createFlow(application); // remember, application can have only one child, do not add more panels to it | GUIPanelComponent root = GUIPanelComponent.createFlow(application); // remember, application can have only one child, do not add more panels to it | ||
GUILabelComponent title = GUILabelComponent.create(root, "Tabs and Layouts"); | GUILabelComponent title = GUILabelComponent.create(root, "Tabs and Layouts"); | ||
- | title.styleName.set(Text.fromString("titleStyle")); // setting CSS class name (.titleStyle) | + | title.setStyle("titleStyle"); // setting CSS class name (.titleStyle) |
GUIPanelComponent topPanel = GUIPanelComponent.createFlow(root); | GUIPanelComponent topPanel = GUIPanelComponent.createFlow(root); | ||
- | topPanel.styleName.set(Text.fromString("topPanel")); | + | topPanel.setStyle("topPanel"); |
GUITabComponent tabs = GUITabComponent.create(topPanel, new String[] { "Vertical", "Horizontal", "Flow", "Table", "Dock", "XY" }); | GUITabComponent tabs = GUITabComponent.create(topPanel, new String[] { "Vertical", "Horizontal", "Flow", "Table", "Dock", "XY" }); | ||
Line 68: | Line 67: | ||
int row = 0, col = 0; | int row = 0, col = 0; | ||
GUILabelComponent.create(table, "GUILabelComponent", row, col++); | GUILabelComponent.create(table, "GUILabelComponent", 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(tabs); // Dock layout | GUIPanelComponent dock = GUIPanelComponent.createDock(tabs); // Dock layout | ||
- | 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(); // XY layout | + | GUIPanelComponent xy = GUIPanelComponent.createAbsolute(tabs); // XY layout |
- | xy.styleName.set(Text.fromString("box")); | + | xy.setStyle("box"); |
- | xy.parent.set(tabs); | + | GUILabelComponent.create(xy, "GUILabelComponent").setLayoutData(XYLayoutData.create(5, 10, "120px", "30px")); |
- | xy.layout.set(new XYLayout()); | + | GUILinkComponent.create(xy, "GUILinkComponent", "http://www.soloist4uml.com", "_blank").setLayoutData(XYLayoutData.create(155, 20, "120px", "30px")); |
- | GUILabelComponent.create(xy, "GUILabelComponent").layoutData.set(new XYLayoutData(5, 10, 120, 30)); | + | GUIImageComponent.create(xy, "images/logo.png").setLayoutData(XYLayoutData.create(55, 110, "160px", "80px")); |
- | GUILinkComponent.create(xy, "GUILinkComponent", "http://www.soloist4uml.com", "_blank").layoutData.set(new XYLayoutData(155, 20, 120, 30)); | + | GUIHTMLComponent.create(xy, "<h1>GUI<i>HTMLComponent</i></h1>").setLayoutData(XYLayoutData.create(205, 50, "280px", "40px")); |
- | GUIImageComponent.create(xy, "images/logo.png").layoutData.set(new XYLayoutData(55, 110, 160, 80)); | + | |
- | GUIHTMLComponent.create(xy, "<h1>GUI<i>HTMLComponent</i></h1>").layoutData.set(new XYLayoutData(205, 50, 280, 40)); | + | |
} | } |