Differences
This shows you the differences between two versions of the page.
|
menus [2012/07/09 10:43] srdjan.lukovic [GUI Code] |
menus [2012/07/09 10:44] (current) srdjan.lukovic [GUI Code] |
||
|---|---|---|---|
| Line 47: | Line 47: | ||
| SoloistServiceServlet.registerApplication(application); | SoloistServiceServlet.registerApplication(application); | ||
| GUIPanelComponent root = GUIPanelComponent.createFlow(application); | GUIPanelComponent root = GUIPanelComponent.createFlow(application); | ||
| - | + | ||
| GUILabelComponent title = GUILabelComponent.create(root, "Menus"); | GUILabelComponent title = GUILabelComponent.create(root, "Menus"); | ||
| title.setStyle("titleStyle"); | title.setStyle("titleStyle"); | ||
| - | + | ||
| GUIPanelComponent menuPanel = GUIPanelComponent.createFlow(root); | GUIPanelComponent menuPanel = GUIPanelComponent.createFlow(root); | ||
| GUIDeckComponent deck = GUIDeckComponent.create(root); | GUIDeckComponent deck = GUIDeckComponent.create(root); | ||
| - | + | ||
| - | strings = new String[] {"", "A", "A1", "A2", "B", "B1", "B2", "C", "C1", "C2", "D", "D1", "D2", "E", "E1", "E2", "F", "F1", "F2", "G", "G1", "G2", "H"}; | + | strings = new String[] { "", "A", "A1", "A2", "B", "B1", "B2", "C", "C1", "C2", "D", "D1", "D2", "E", "E1", "E2", "F", "F1", "F2", "G", "G1", "G2", "H" }; |
| array = new GUIPanelComponent[strings.length]; | array = new GUIPanelComponent[strings.length]; | ||
| for (int i = 0; i < strings.length; i++) { | for (int i = 0; i < strings.length; i++) { | ||
| Line 60: | Line 60: | ||
| GUILabelComponent.create(array[i], strings[i]).setStyle("largeText"); | GUILabelComponent.create(array[i], strings[i]).setStyle("largeText"); | ||
| } | } | ||
| - | + | ||
| createGWTMenu(menuPanel, true); | createGWTMenu(menuPanel, true); | ||
| createGWTMenu(menuPanel, false); | createGWTMenu(menuPanel, false); | ||
| createDropDownMenu(menuPanel); | createDropDownMenu(menuPanel); | ||
| - | } | + | } |
| /** | /** | ||
| * Custom drop down menu using links, depends highly on CSS | * Custom drop down menu using links, depends highly on CSS | ||
| Line 74: | Line 74: | ||
| GUIPanelComponent menuWrapper = GUIPanelComponent.createFlow(menu); | GUIPanelComponent menuWrapper = GUIPanelComponent.createFlow(menu); | ||
| menuWrapper.setStyle("#menu_wrapper"); | menuWrapper.setStyle("#menu_wrapper"); | ||
| - | + | ||
| GUILinkComponent[] links = new GUILinkComponent[strings.length]; | GUILinkComponent[] links = new GUILinkComponent[strings.length]; | ||
| - | + | ||
| for (int i = 0; i < strings.length; i++) { | for (int i = 0; i < strings.length; i++) { | ||
| if (i == 0) { | if (i == 0) { | ||
| Line 83: | Line 83: | ||
| } else if (i == strings.length - 1) { | } else if (i == strings.length - 1) { | ||
| links[i] = GUILinkComponent.create(menuWrapper, "H", "javascript:void"); | links[i] = GUILinkComponent.create(menuWrapper, "H", "javascript:void"); | ||
| - | } else if (i % 3 == 1){ | + | } else if (i % 3 == 1) { |
| GUIPanelComponent top = GUIPanelComponent.createFlow(menuWrapper); | GUIPanelComponent top = GUIPanelComponent.createFlow(menuWrapper); | ||
| top.setStyle("#topmenu"); | top.setStyle("#topmenu"); | ||
| Line 125: | Line 125: | ||
| GUIMenuComponent myMainMenu = GUIMenuComponent.create(mainPanel, isHorizontal); | GUIMenuComponent myMainMenu = GUIMenuComponent.create(mainPanel, isHorizontal); | ||
| GUIMenuItemComponent[] items = new GUIMenuItemComponent[strings.length]; | GUIMenuItemComponent[] items = new GUIMenuItemComponent[strings.length]; | ||
| - | + | ||
| for (int i = 0; i < strings.length; i++) { | for (int i = 0; i < strings.length; i++) { | ||
| if (i == 0) { | if (i == 0) { | ||
| Line 131: | Line 131: | ||
| } else if (i == strings.length - 1) { | } else if (i == strings.length - 1) { | ||
| items[i] = GUIMenuItemComponent.create(myMainMenu, strings[i]); | items[i] = GUIMenuItemComponent.create(myMainMenu, strings[i]); | ||
| - | } else if (i % 3 == 1){ | + | } else if (i % 3 == 1) { |
| items[i] = GUIMenuItemComponent.create(myMainMenu, strings[i]); | items[i] = GUIMenuItemComponent.create(myMainMenu, strings[i]); | ||
| - | GUIMenuComponent subA = GUIMenuComponent.createSubMenu(items[i], !isHorizontal); | + | GUIMenuComponent subA = GUIMenuComponent.createSubMenu(items[i], !isHorizontal); |
| - | items[i + 1] = GUIMenuItemComponent.create(subA, strings[i + 1]); | + | items[i + 1] = GUIMenuItemComponent.create(subA, strings[i + 1]); |
| - | items[i + 2] = GUIMenuItemComponent.create(subA, strings[i + 2]); | + | items[i + 2] = GUIMenuItemComponent.create(subA, strings[i + 2]); |
| } | } | ||
| GUIComponentBinding.create(items[i].opClick(), array[i].ipShow()); | GUIComponentBinding.create(items[i].opClick(), array[i].ipShow()); | ||