List of usage examples for com.vaadin.ui Button addStyleName
@Override public void addStyleName(String style)
From source file:me.uni.emuseo.view.menu.MenuView.java
License:Open Source License
private CssLayout buildMenu() { // Add items//w ww .j ava 2s.com if (authManager.isAuthorizedTo(Permissions.MENU_USERS_VIEW)) { menuItems.put(Permissions.MENU_USERS_VIEW, "Uytkownicy"); } if (authManager.isAuthorizedTo(Permissions.MENU_EXHIBIT_VIEW)) { menuItems.put(Permissions.MENU_EXHIBIT_VIEW, "Katalog eksponatw"); } if (authManager.isAuthorizedTo(Permissions.MENU_CATEGORIES_VIEW)) { menuItems.put(Permissions.MENU_CATEGORIES_VIEW, "Kategorie"); } if (authManager.isAuthorizedTo(Permissions.MENU_RESOURCES_VIEW)) { menuItems.put(Permissions.MENU_RESOURCES_VIEW, "Zasoby"); } final HorizontalLayout top = new HorizontalLayout(); top.setWidth("100%"); top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); top.addStyleName("valo-menu-title"); menu.addComponent(top); final Button showMenu = new Button("Menu", new ClickListener() { private static final long serialVersionUID = -719702284721453362L; @Override public void buttonClick(final ClickEvent event) { if (menu.getStyleName().contains("valo-menu-visible")) { menu.removeStyleName("valo-menu-visible"); } else { menu.addStyleName("valo-menu-visible"); } } }); showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY); showMenu.addStyleName(ValoTheme.BUTTON_SMALL); showMenu.addStyleName("valo-menu-toggle"); showMenu.setIcon(FontAwesome.LIST); menu.addComponent(showMenu); final Label title = new Label("<h3>e<strong>Museo</strong></h3>", ContentMode.HTML); title.setSizeUndefined(); top.addComponent(title); top.setExpandRatio(title, 1); final MenuBar settings = new MenuBar(); settings.addStyleName("user-menu"); settingsItem = settings.addItem("Jan Kowalski", defaultIcon, null); if (authManager.isAuthorizedTo(Permissions.MENU_MY_ACCOUNT_VIEW)) { settingsItem.addItem("Moje konto", new MenuBar.Command() { private static final long serialVersionUID = 7015035735144235104L; @Override public void menuSelected(MenuItem selectedItem) { navigator.navigateTo(Permissions.MENU_MY_ACCOUNT_VIEW); } }); } if (authManager.isAuthorizedTo(Permissions.MENU_SETTINGS_VIEW)) { settingsItem.addItem("Ustawienia", new MenuBar.Command() { private static final long serialVersionUID = 7015035735144235105L; @Override public void menuSelected(MenuItem selectedItem) { navigator.navigateTo(Permissions.MENU_SETTINGS_VIEW); } }); } settingsItem.addSeparator(); settingsItem.addItem("Wyloguj", new MenuBar.Command() { private static final long serialVersionUID = 1333473616079310225L; @Override public void menuSelected(MenuItem selectedItem) { final AuthManager authManager = EMuseoUtil.getAppContext().getBean(AuthManager.class); authManager.logout(); } }); menu.addComponent(settings); menuItemsLayout.setPrimaryStyleName("valo-menuitems"); menu.addComponent(menuItemsLayout); for (final Entry<String, String> item : menuItems.entrySet()) { FontIcon icon = null; if (item.getKey().equals(Permissions.MENU_USERS_VIEW)) { icon = FontAwesome.USERS; } else if (item.getKey().endsWith(Permissions.MENU_EXHIBIT_VIEW)) { icon = FontAwesome.UNIVERSITY; } else if (item.getKey().endsWith(Permissions.MENU_CATEGORIES_VIEW)) { icon = FontAwesome.ARCHIVE; } else if (item.getKey().endsWith(Permissions.MENU_RESOURCES_VIEW)) { icon = FontAwesome.IMAGE; } final Button b = new Button(item.getValue(), new ClickListener() { private static final long serialVersionUID = -7089398070311521853L; @Override public void buttonClick(final ClickEvent event) { navigator.navigateTo(item.getKey()); } }); b.setHtmlContentAllowed(true); b.setPrimaryStyleName("valo-menu-item"); if (icon != null) { b.setIcon(icon); } menuItemsLayout.addComponent(b); } return menu; }
From source file:me.uni.emuseo.view.settings.MyAccountView.java
License:Open Source License
public MyAccountView() { authManager = EMuseoUtil.getAppContext().getBean(AuthManager.class); userService = EMuseoUtil.getAppContext().getBean(UserService.class); final Long userId = authManager.getLoggedUserId(); UserDTO user = userService.getUser(userId); FormWithButtonsLayout<UserDTO> formLayout = new FormWithButtonsLayout<UserDTO>(user) { private static final long serialVersionUID = -1826989504302110056L; @Override//from ww w . ja v a 2 s .com protected void onSave(UserDTO bean) { userService.editUser(bean); } @Override protected FormBuilder<UserDTO> buildForm(UserDTO bean) { return new MyAccountFormLayout(bean); } }; ExpandingPanel myAccountPanel = new ExpandingPanel(); myAccountPanel.setCaption("Moje dane"); myAccountPanel.setContent(formLayout); myAccountPanel.setExpanded(true); Button addButton = new Button("Zmie haso"); addButton.setIcon(FontAwesome.LOCK); addButton.addStyleName("emuseo-button-icon"); addButton.addStyleName("emuseo-button-margin"); addButton.setWidth(100, Unit.PERCENTAGE); addComponent(myAccountPanel); addComponent(addButton); // setComponentAlignment(formLayout, Alignment.MIDDLE_CENTER); addButton.addClickListener(new ClickListener() { private static final long serialVersionUID = -263205007196895260L; @Override public void buttonClick(ClickEvent event) { PasswordPopUpWindow exhibitPopUpWidow = new PasswordPopUpWindow("Zmie haso") { private static final long serialVersionUID = 3776311059670953583L; @Override protected boolean onSave(PasswordDTO bean) throws InvalidBeanException { try { userService.changePassword(userId, bean); return true; } catch (PasswordChangeException e) { new Notification("Bd", e.getReason(), Type.ERROR_MESSAGE, true) .show(Page.getCurrent()); } return false; } }; UI.getCurrent().addWindow(exhibitPopUpWidow); } }); }
From source file:module.pandabox.presentation.PandaBox.java
License:Open Source License
private Layout getSotisFrontPage() { GridSystemLayout layout = new GridSystemLayout(12); Label title = new Label( "O <strong>SOTIS</strong> o Repositrio Institucional do Instituto Superior Tcnico.", Label.CONTENT_XHTML); title.addStyleName(BennuTheme.LABEL_BIG); layout.setCell("title", 12, title); Label description = new Label( "Aqui poder encontrar artigos publicados em <a href=\"\">Revistas</a>, <a href=\"\">Conferncias</a>, <a href=\"\">Livros</a>, <a href=\"\">Manuais</a> e <a href=\"\">Outros</a>, categorizados por <a href=\"\">Unidades de Investigao</a> e <a href=\"\">Unidades Acadmicas</a>.", Label.CONTENT_XHTML); description.addStyleName(BennuTheme.LABEL_BIG); layout.setCell("description", 12, description); VerticalLayout searchPanel = new VerticalLayout(); layout.setCell("search", 2, 8, 2, searchPanel); searchPanel.addStyleName("big"); searchPanel.addStyleName("inset"); searchPanel.setMargin(true);//from ww w . j a v a 2 s. c o m searchPanel.setSpacing(true); HorizontalLayout searchForm = new HorizontalLayout(); searchPanel.addComponent(searchForm); searchForm.setSpacing(true); searchForm.setWidth("100%"); TextField searchText = new TextField(); searchForm.addComponent(searchText); searchText.setInputPrompt("Introduza o termo a pesquisar"); searchText.setWidth("100%"); Button searchSubmit = new Button("Pesquisar"); searchForm.addComponent(searchSubmit); searchSubmit.addStyleName(BennuTheme.BUTTON_DEFAULT); searchForm.setExpandRatio(searchText, 1f); Link advanced = new Link("advanced search", null); searchPanel.addComponent(advanced); Panel browseByType = new Panel("Publicaes por Tipo"); browseByType.addStyleName(BennuTheme.PANEL_LIGHT); layout.setCell("type", 4, browseByType); Panel browseByDept = new Panel("Publicaes por Departamento"); browseByDept.addStyleName(BennuTheme.PANEL_LIGHT); layout.setCell("dept", 4, browseByDept); Panel contacts = new Panel("Contactos"); contacts.addStyleName(BennuTheme.PANEL_LIGHT); layout.setCell("contacts", 4, contacts); return layout; }
From source file:module.pandabox.presentation.PandaBox.java
License:Open Source License
private Layout getButtonPreviews() { Layout grid = getPreviewLayout("Buttons"); Button button = new Button("Button"); grid.addComponent(button);/* ww w. j av a2 s . c o m*/ button = new Button("Default"); button.setStyleName("default"); grid.addComponent(button); button = new Button("Small"); button.setStyleName("small"); grid.addComponent(button); button = new Button("Small Default"); button.setStyleName("small default"); grid.addComponent(button); button = new Button("Big"); button.setStyleName("big"); grid.addComponent(button); button = new Button("Big Default"); button.setStyleName("big default"); grid.addComponent(button); button = new Button("Disabled"); button.setEnabled(false); grid.addComponent(button); button = new Button("Disabled default"); button.setEnabled(false); button.setStyleName("default"); grid.addComponent(button); button = new Button("Link style"); button.setStyleName(BaseTheme.BUTTON_LINK); grid.addComponent(button); button = new Button("Disabled link"); button.setStyleName(BaseTheme.BUTTON_LINK); button.setEnabled(false); grid.addComponent(button); button = new Button("120px overflows out of the button"); button.setIcon(new ThemeResource("../runo/icons/16/document.png")); button.setWidth("120px"); grid.addComponent(button); button = new Button("Small"); button.setStyleName("small"); button.setIcon(new ThemeResource("../runo/icons/16/document.png")); grid.addComponent(button); button = new Button("Big"); button.setStyleName("big"); button.setIcon(new ThemeResource("../runo/icons/16/document.png")); grid.addComponent(button); button = new Button("Big Default"); button.setStyleName("big default"); button.setIcon(new ThemeResource("../runo/icons/32/document-txt.png")); grid.addComponent(button); button = new Button("Big link"); button.setStyleName(BaseTheme.BUTTON_LINK + " big"); button.setIcon(new ThemeResource("../runo/icons/32/document.png")); grid.addComponent(button); button = new Button("Borderless"); button.setStyleName("borderless"); button.setIcon(new ThemeResource("../runo/icons/32/note.png")); grid.addComponent(button); button = new Button("Borderless icon on top"); button.setStyleName("borderless icon-on-top"); button.setIcon(new ThemeResource("../runo/icons/32/note.png")); grid.addComponent(button); button = new Button("Icon on top"); button.setStyleName("icon-on-top"); button.setIcon(new ThemeResource("../runo/icons/32/users.png")); grid.addComponent(button); button = new Button("Wide Default"); button.setStyleName("wide default"); grid.addComponent(button); button = new Button("Wide"); button.setStyleName("wide"); grid.addComponent(button); button = new Button("Tall"); button.setStyleName("tall"); grid.addComponent(button); button = new Button("Wide, Tall & Big"); button.setStyleName("wide tall big"); grid.addComponent(button); button = new Button("Icon on right"); button.setStyleName("icon-on-right"); button.setIcon(new ThemeResource("../runo/icons/16/document.png")); grid.addComponent(button); button = new Button("Big icon"); button.setStyleName("icon-on-right big"); button.setIcon(new ThemeResource("../runo/icons/16/document.png")); grid.addComponent(button); button = new Button("Toggle (down)"); button.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { if (event.getButton().getStyleName().endsWith("down")) { event.getButton().removeStyleName("down"); } else { event.getButton().addStyleName("down"); } } }); button.addStyleName("down"); grid.addComponent(button); button.setDescription( button.getDescription() + "<br><strong>Stylename switching logic must be done separately</strong>"); button = new Button(); button.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { if (event.getButton().getStyleName().endsWith("down")) { event.getButton().removeStyleName("down"); } else { event.getButton().addStyleName("down"); } } }); button.addStyleName("icon-only"); button.addStyleName("down"); button.setIcon(new ThemeResource("../runo/icons/16/user.png")); grid.addComponent(button); button.setDescription( button.getDescription() + "<br><strong>Stylename switching logic must be done separately</strong>"); Link l = new Link("Link: vaadin.com", new ExternalResource("http://vaadin.com")); grid.addComponent(l); l = new Link("Link: vaadin.com", new ExternalResource("http://vaadin.com")); l.setIcon(new ThemeResource("../runo/icons/32/globe.png")); grid.addComponent(l); return grid; }
From source file:module.pandabox.presentation.PandaBox.java
License:Open Source License
Layout getCompoundButtons() { Layout grid = getPreviewLayout("Compound Buttons"); Label title = new Label("Segment"); title.setStyleName("h1"); grid.addComponent(title);/*ww w.ja va 2 s . co m*/ ((GridLayout) grid).newLine(); Label segments = new Label( "The segment control is just a set of buttons inside a HorizontalLayout. Use the structure shown on the right, <strong>and remember that you need to implement all logic yourself</strong>. This theme just provides suitable stylenames for you to use.", Label.CONTENT_XHTML); grid.addComponent(segments); segments = new Label( "HorizontalLayout.setStyleName(\"segment\") and .addStyleName(\"segment-alternate\")\n + Button.addStyleName(\"first\") and .addStyleName(\"down\")\n + Button\n\t...\n + Button.addStyleName(\"last\")", Label.CONTENT_PREFORMATTED); ((GridLayout) grid).addComponent(segments, 1, 1, 2, 1); Segment segment = new Segment(); segment.setCaption("Segment"); Button b = new Button("One"); b.setStyleName("down"); b.setIcon(new ThemeResource("../runo/icons/16/document-txt.png")); segment.addButton(b).addButton(new Button("Two")).addButton(new Button("Three")) .addButton(new Button("Four")); grid.addComponent(segment); segment = new Segment(); segment.addStyleName("segment-alternate"); segment.setCaption("Segment (alternate)"); b = new Button("One"); b.setStyleName("down"); b.setIcon(new ThemeResource("../runo/icons/16/document-txt.png")); segment.addButton(b).addButton(new Button("Two")).addButton(new Button("Three")) .addButton(new Button("Four")); grid.addComponent(segment); segment = new Segment(); segment.setCaption("Small segment"); b = new Button("Apples"); b.setStyleName("small"); b.addStyleName("down"); segment.addButton(b); b = new Button("Oranges"); b.setStyleName("small"); segment.addButton(b); b = new Button("Bananas"); b.setStyleName("small"); segment.addButton(b); b = new Button("Grapes"); b.setStyleName("small"); segment.addButton(b); grid.addComponent(segment); return grid; }
From source file:module.pandabox.presentation.PandaBox.java
License:Open Source License
Layout getCompoundMenus() { Layout grid = getPreviewLayout("Compound Menus"); Label title = new Label("Sidebar Menu"); title.setStyleName("h1"); grid.addComponent(title);// www. j a v a2 s . c o m ((GridLayout) grid).newLine(); Label menus = new Label( "<strong>The sidebar menu</strong> control is just a set of labels and buttons inside a CssLayout or a VerticalLayout. Use the structure shown on the right, <strong>and remember that you need to implement all logic yourself</strong>. This theme just provides suitable stylenames for you to use.<br><br>You can also use the <a href=\"http://vaadin.com/forum/-/message_boards/message/119172\">DetachedTabs add-on</a> inside the sidebar-menu, it will style automatically.<br><br><strong>Note: only NativeButtons are styled inside the menu, normal buttons are left untouched.</strong>", Label.CONTENT_XHTML); grid.addComponent(menus); menus = new Label( "CssLayout.setStyleName(\"sidebar-menu\")\n + Label\n + NativeButton\n + NativeButton\n\t...\n + Label\n + DetachedTabs\n\t...", Label.CONTENT_PREFORMATTED); grid.addComponent(menus); SidebarMenu sidebar = new SidebarMenu(); sidebar.setWidth("200px"); sidebar.addComponent(new Label("Fruits")); NativeButton b = new NativeButton("Apples"); b.setIcon(new ThemeResource("../runo/icons/16/note.png")); sidebar.addButton(b); sidebar.setSelected(b); sidebar.addButton(new NativeButton("Oranges")); sidebar.addButton(new NativeButton("Bananas")); sidebar.addButton(new NativeButton("Grapes")); sidebar.addComponent(new Label("Vegetables")); sidebar.addButton(new NativeButton("Tomatoes")); sidebar.addButton(new NativeButton("Cabbages")); sidebar.addButton(new NativeButton("Potatoes")); sidebar.addButton(new NativeButton("Carrots")); grid.addComponent(sidebar); ((GridLayout) grid).setColumnExpandRatio(0, 1); ((GridLayout) grid).setColumnExpandRatio(1, 1); title = new Label("Toolbar"); title.setStyleName("h1"); grid.addComponent(title); ((GridLayout) grid).newLine(); CssLayout toolbars = new CssLayout(); menus = new Label( "<strong>Toolbar</strong> is a simple CssLayout with a stylename. It provides the background and a little padding for its contents. Normally you will want to put buttons inside it, but segment controls fit in nicely as well.", Label.CONTENT_XHTML); grid.addComponent(menus); menus = new Label("CssLayout.setStyleName(\"toolbar\")", Label.CONTENT_PREFORMATTED); grid.addComponent(menus); CssLayout toolbar = new CssLayout(); toolbar.setStyleName("toolbar"); toolbar.setWidth("300px"); Button b2 = new Button("Action"); b2.setStyleName("small"); toolbar.addComponent(b2); Segment segment = new Segment(); segment.addStyleName("segment-alternate"); b2 = new Button("Apples"); b2.setStyleName("small"); b2.addStyleName("down"); segment.addButton(b2); b2 = new Button("Oranges"); b2.setStyleName("small"); segment.addButton(b2); toolbar.addComponent(segment); b2 = new Button("Notes"); b2.setStyleName("small borderless"); b2.setIcon(new ThemeResource("../runo/icons/16/note.png")); toolbar.addComponent(b2); toolbars.addComponent(toolbar); toolbar = new CssLayout(); toolbar.setStyleName("toolbar"); toolbar.setWidth("300px"); b2 = new Button("Action"); b2.setIcon(new ThemeResource("../runo/icons/32/document.png")); b2.setStyleName("borderless"); toolbar.addComponent(b2); b2 = new Button("Action 2"); b2.setStyleName("borderless"); b2.setIcon(new ThemeResource("../runo/icons/32/user.png")); toolbar.addComponent(b2); b2 = new Button("Action 3"); b2.setStyleName("borderless"); b2.setIcon(new ThemeResource("../runo/icons/32/note.png")); toolbar.addComponent(b2); toolbars.addComponent(toolbar); grid.addComponent(toolbars); return grid; }
From source file:my.vaadin.profile.Forms.java
public Forms() { setSpacing(true);// ww w . ja va 2 s . c om setMargin(true); Label title = new Label("Signup Form"); title.addStyleName("h1"); addComponent(title); final FormLayout form = new FormLayout(); form.setMargin(false); form.setWidth("900px"); form.addStyleName("light"); addComponent(form); Label section = new Label("Personal Info"); section.addStyleName("h2"); section.addStyleName("colored"); form.addComponent(section); //StringGenerator sg = new StringGenerator(); TextField zID = new TextField("zID"); zID.setValue("z123456"); zID.setRequired(true); form.addComponent(zID); TextField name = new TextField("Name"); name.setValue("loreum"); //name.setWidth("50%"); form.addComponent(name); PasswordField pw = new PasswordField("Set Password"); pw.setRequired(true); form.addComponent(pw); DateField birthday = new DateField("Birthday"); birthday.setDateFormat("dd-MM-yyyy"); birthday.setValue(new java.util.Date()); form.addComponent(birthday); OptionGroup gender = new OptionGroup("Gender"); gender.addItem("Male"); gender.addItem("Female"); //sex.select("Male"); gender.addStyleName("horizontal"); form.addComponent(gender); section = new Label("Class Info"); section.addStyleName("h2"); section.addStyleName("colored"); form.addComponent(section); TextField classID = new TextField("Class ID"); classID.setValue("INFS2605"); classID.setRequired(true); //classID.setWidth("50%"); form.addComponent(classID); TextField groupID = new TextField("Group ID"); groupID.setValue("1"); //groupID.setWidth("50%"); groupID.setRequired(true); form.addComponent(groupID); Button confirm = new Button("Confirm"); confirm.addStyleName("primary"); form.addComponent(confirm); HorizontalLayout footer = new HorizontalLayout(); footer.setMargin(new MarginInfo(true, false, true, false)); footer.setSpacing(true); footer.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); form.addComponent(footer); footer.addComponent(confirm); }
From source file:my.vaadin.profile.MainLayout.java
public MainLayout() { Label header = new Label("Student"); header.addStyleName("colored"); header.addStyleName("h2"); //header.addStyleName("alignRight"); header.setSizeUndefined();// w w w .ja va 2 s. c om Button signOut = new Button("Sign-Out"); signOut.setSizeUndefined(); signOut.addStyleName("small"); Label menu = new Label("Menu"); menu.addStyleName("colored"); menu.addStyleName("h2"); upperSection.setSizeFull(); innerUpperSection.addComponent(header); innerUpperSection.addComponent(signOut); innerUpperSection.setExpandRatio(signOut, 1); innerUpperSection.setSpacing(true); innerUpperSection.setComponentAlignment(signOut, Alignment.MIDDLE_RIGHT); upperSection.addComponent(innerUpperSection); upperSection.setMargin(new MarginInfo(false, true, false, false)); upperSection.setComponentAlignment(innerUpperSection, Alignment.TOP_RIGHT); upperSection.addStyleName("borderBottom"); menuTitle.addComponent(menu); menuLayout.addComponent(menuTitle); menuLayout.setWidth("100%"); menuLayout.setComponentAlignment(menuTitle, Alignment.MIDDLE_CENTER); //menuLayout.addStyleName("whiteStuff"); // menuLayout.setExpandRatio(, 1); //contentLayout.addComponent(); lowerSection.addComponent(menuLayout); lowerSection.addComponent(contentLayout); addComponent(upperSection); addComponent(lowerSection); upperSection.setHeight(4, UNITS_EM); //showBorders(); setSizeFull(); lowerSection.setSizeFull(); //menuLayout.setSizeFull(); contentLayout.setSizeFull(); setExpandRatio(lowerSection, 1); lowerSection.setSplitPosition(15); Button lolol = new Button("hi"); menuLayout.addComponent(lolol); lolol.setWidth("100%"); lolol.setStyleName("borderless"); }
From source file:net.sf.gazpachoquest.questionnaires.views.QuestionnaireView.java
License:Open Source License
private HorizontalLayout createHeader() { final HorizontalLayout layout = new HorizontalLayout(); layout.setWidth("100%"); layout.setMargin(true);/* w w w . j ava 2s.co m*/ layout.setSpacing(true); final Label title = new Label("Activiti + Vaadin - A Match Made in Heaven"); title.addStyleName(Reindeer.LABEL_H1); layout.addComponent(title); layout.setExpandRatio(title, 1.0f); Label currentUser = new Label(); currentUser.setSizeUndefined(); layout.addComponent(currentUser); layout.setComponentAlignment(currentUser, Alignment.MIDDLE_RIGHT); Button logout = new Button("Logout"); logout.addStyleName(Reindeer.BUTTON_SMALL); // logout.addListener(createLogoutButtonListener()); layout.addComponent(logout); layout.setComponentAlignment(logout, Alignment.MIDDLE_RIGHT); return layout; }
From source file:net.sourceforge.javydreamercsw.validation.manager.web.tester.ExecutionScreen.java
License:Apache License
public ExecutionScreen() { testCaseTree = new TreeTable("available.tests"); testCaseTree.setAnimationsEnabled(true); testCaseTree.addContainerProperty("general.name", String.class, ""); testCaseTree.addGeneratedColumn("general.status", (Table source, Object itemId, Object columnId) -> { if ("general.status".equals(columnId) && itemId instanceof String) { String id = (String) itemId; String message;/* w w w . j ava 2 s . c om*/ HorizontalLayout icons = new HorizontalLayout(); Button label = new Button(); Button label2 = new Button(); icons.addComponent(label2); icons.addComponent(label); label.addStyleName(ValoTheme.BUTTON_BORDERLESS + " labelButton"); label2.addStyleName(ValoTheme.BUTTON_BORDERLESS + " labelButton"); Map<String, Integer> summary = new HashMap<>(); boolean locked = false; if (id.startsWith("tce")) { TestCaseExecutionServer tce = new TestCaseExecutionServer(Integer.parseInt(id.substring(3))); summary = getSummary(tce, -1); locked = isLocked(tce); } else if (id.startsWith("es")) { ExecutionStepServer es = new ExecutionStepServer(extractExecutionStepPK(id)); summary = getSummary(es.getTestCaseExecution(), Integer.parseInt(id.substring(id.lastIndexOf("-") + 1))); locked = es.getLocked(); } if (locked) { label2.setIcon(VaadinIcons.LOCK); label2.setDescription(TRANSLATOR.translate("message.locked")); } if (!summary.isEmpty()) { if (summary.containsKey("result.fail")) { //At least one failure means the test case is failing message = "result.fail"; } else if (summary.containsKey("result.blocked")) { //It is blocked message = "result.blocked"; } else if (summary.containsKey("result.pending") && !summary.containsKey("result.pass")) { //Still not done message = "result.pending"; } else if (summary.containsKey("result.pending") && summary.containsKey("result.pass")) { //In progress message = "result.progress"; } else { //All is pass message = "result.pass"; } label.setCaption(TRANSLATOR.translate(message)); label.setDescription(TRANSLATOR.translate(message)); //Completed. Now check result switch (message) { case "result.pass": label.setIcon(VaadinIcons.CHECK); break; case "result.fail": label.setIcon(VaadinIcons.CLOSE); break; case "result.blocked": label.setIcon(VaadinIcons.PAUSE); break; case "result.pending": label.setIcon(VaadinIcons.CLOCK); break; case "result.progress": label.setIcon(VaadinIcons.AUTOMATION); break; default: label.setIcon(VaadinIcons.CLOCK); break; } return icons; } } return new Label(); }); testCaseTree.addContainerProperty("general.summary", String.class, ""); testCaseTree.addContainerProperty("general.assignment.date", String.class, ""); testCaseTree.setVisibleColumns( new Object[] { "general.name", "general.status", "general.summary", "general.assignment.date" }); testCaseTree.addActionHandler(new Action.Handler() { @Override public Action[] getActions(Object target, Object sender) { List<Action> actions = new ArrayList<>(); if (target instanceof String) { String t = (String) target; int tcID = -1; TestCaseExecutionServer tce = null; if (t.startsWith("es")) { tce = new TestCaseExecutionServer( new ExecutionStepServer(extractExecutionStepPK(t)).getTestCaseExecution().getId()); tcID = Integer.parseInt(t.substring(t.lastIndexOf("-") + 1)); } else if (t.startsWith("tce")) { tce = new TestCaseExecutionServer(Integer.parseInt(t.substring(3))); } if (!isLocked(tce, tcID) && ExecutionScreen.this instanceof TesterScreenProvider) { actions.add(new Action(TRANSLATOR.translate("general.execute"), VMUI.EXECUTION_ICON)); } else if (isLocked(tce, tcID) && ExecutionScreen.this instanceof QualityScreenProvider) { actions.add(new Action(TRANSLATOR.translate("general.review"), VaadinIcons.EYE)); } actions.add(new Action(TRANSLATOR.translate("general.export"), VaadinIcons.DOWNLOAD)); } return actions.toArray(new Action[actions.size()]); } @Override public void handleAction(Action action, Object sender, Object target) { List<TestCaseExecutionServer> executions = new ArrayList<>(); int tcID = -1; if (((String) target).startsWith("tce")) { executions.add(new TestCaseExecutionServer(Integer.parseInt(((String) target).substring(3)))); } else if (((String) target).startsWith("es")) { executions.add(new TestCaseExecutionServer( new ExecutionStepServer(extractExecutionStepPK((String) target)).getTestCaseExecution() .getId())); tcID = Integer.parseInt(((String) target).substring(((String) target).lastIndexOf("-") + 1)); } //Parse the information to get the exact Execution Step if (action.getCaption().equals(TRANSLATOR.translate("general.export"))) { viewExecutionScreen(executions, tcID); } else { showExecutionScreen(executions, tcID); } } }); }