List of usage examples for com.vaadin.ui Label setSizeUndefined
@Override public void setSizeUndefined()
From source file:lu.uni.lassy.excalibur.examples.icrash.dev.web.java.views.AdminAuthView.java
License:Open Source License
public AdminAuthView() { setSizeFull();//from w w w. ja v a 2s.co m VerticalLayout header = new VerticalLayout(); header.setSizeFull(); HorizontalLayout content = new HorizontalLayout(); content.setSizeFull(); addComponents(header, content); setExpandRatio(header, 1); setExpandRatio(content, 6); welcomeText.setValue("<h1>Welcome to the iCrash Administrator console!</h1>"); welcomeText.setContentMode(ContentMode.HTML); welcomeText.setSizeUndefined(); header.addComponent(welcomeText); header.setComponentAlignment(welcomeText, Alignment.MIDDLE_CENTER); Panel controlPanel = new Panel("Administrator control panel"); controlPanel.setSizeUndefined(); Panel addCoordPanel = new Panel("Create a new coordinator"); addCoordPanel.setSizeUndefined(); Panel messagesPanel = new Panel("Administrator messages"); messagesPanel.setWidth("580px"); Table adminMessagesTable = new Table(); adminMessagesTable.setContainerDataSource(actAdmin.getMessagesDataSource()); adminMessagesTable.setColumnWidth("inputEvent", 180); adminMessagesTable.setSizeFull(); VerticalLayout controlLayout = new VerticalLayout(controlPanel); controlLayout.setSizeFull(); controlLayout.setMargin(false); controlLayout.setComponentAlignment(controlPanel, Alignment.TOP_CENTER); VerticalLayout coordOperationsLayout = new VerticalLayout(addCoordPanel); coordOperationsLayout.setSizeFull(); coordOperationsLayout.setMargin(false); coordOperationsLayout.setComponentAlignment(addCoordPanel, Alignment.TOP_CENTER); /******************************************/ coordOperationsLayout.setVisible(true); // main layout in the middle addCoordPanel.setVisible(false); // ...which contains the panel "Create a new coordinator" /******************************************/ HorizontalLayout messagesExternalLayout = new HorizontalLayout(messagesPanel); VerticalLayout messagesInternalLayout = new VerticalLayout(adminMessagesTable); messagesExternalLayout.setSizeFull(); messagesExternalLayout.setMargin(false); messagesExternalLayout.setComponentAlignment(messagesPanel, Alignment.TOP_CENTER); messagesInternalLayout.setMargin(false); messagesInternalLayout.setSizeFull(); messagesInternalLayout.setComponentAlignment(adminMessagesTable, Alignment.TOP_CENTER); messagesPanel.setContent(messagesInternalLayout); TextField idCoordAdd = new TextField(); TextField loginCoord = new TextField(); PasswordField pwdCoord = new PasswordField(); Label idCaptionAdd = new Label("ID"); Label loginCaption = new Label("Login"); Label pwdCaption = new Label("Password"); idCaptionAdd.setSizeUndefined(); idCoordAdd.setSizeUndefined(); loginCaption.setSizeUndefined(); loginCoord.setSizeUndefined(); pwdCaption.setSizeUndefined(); pwdCoord.setSizeUndefined(); Button validateNewCoord = new Button("Validate"); validateNewCoord.setClickShortcut(KeyCode.ENTER); validateNewCoord.setStyleName(ValoTheme.BUTTON_PRIMARY); GridLayout addCoordinatorLayout = new GridLayout(2, 4); addCoordinatorLayout.setSpacing(true); addCoordinatorLayout.setMargin(true); addCoordinatorLayout.setSizeFull(); addCoordinatorLayout.addComponents(idCaptionAdd, idCoordAdd, loginCaption, loginCoord, pwdCaption, pwdCoord); addCoordinatorLayout.addComponent(validateNewCoord, 1, 3); addCoordinatorLayout.setComponentAlignment(idCaptionAdd, Alignment.MIDDLE_LEFT); addCoordinatorLayout.setComponentAlignment(idCoordAdd, Alignment.MIDDLE_LEFT); addCoordinatorLayout.setComponentAlignment(loginCaption, Alignment.MIDDLE_LEFT); addCoordinatorLayout.setComponentAlignment(loginCoord, Alignment.MIDDLE_LEFT); addCoordinatorLayout.setComponentAlignment(pwdCaption, Alignment.MIDDLE_LEFT); addCoordinatorLayout.setComponentAlignment(pwdCoord, Alignment.MIDDLE_LEFT); addCoordPanel.setContent(addCoordinatorLayout); content.addComponents(controlLayout, coordOperationsLayout, messagesExternalLayout); content.setComponentAlignment(messagesExternalLayout, Alignment.TOP_CENTER); content.setComponentAlignment(controlLayout, Alignment.TOP_CENTER); content.setComponentAlignment(messagesExternalLayout, Alignment.TOP_CENTER); content.setExpandRatio(controlLayout, 20); content.setExpandRatio(coordOperationsLayout, 10); content.setExpandRatio(messagesExternalLayout, 28); Button addCoordinator = new Button("Add coordinator"); Button deleteCoordinator = new Button("Delete coordinator"); addCoordinator.addStyleName(ValoTheme.BUTTON_HUGE); deleteCoordinator.addStyleName(ValoTheme.BUTTON_HUGE); logoutBtn.addStyleName(ValoTheme.BUTTON_HUGE); VerticalLayout buttons = new VerticalLayout(); buttons.setMargin(true); buttons.setSpacing(true); buttons.setSizeFull(); buttons.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); controlPanel.setContent(buttons); buttons.addComponents(addCoordinator, deleteCoordinator, logoutBtn); /******* DELETE COORDINATOR PANEL BEGIN *********/ Label idCaptionDel = new Label("ID"); TextField idCoordDel = new TextField(); Panel delCoordPanel = new Panel("Delete a coordinator"); coordOperationsLayout.addComponent(delCoordPanel); delCoordPanel.setVisible(false); coordOperationsLayout.setComponentAlignment(delCoordPanel, Alignment.TOP_CENTER); delCoordPanel.setSizeUndefined(); GridLayout delCoordinatorLayout = new GridLayout(2, 2); delCoordinatorLayout.setSpacing(true); delCoordinatorLayout.setMargin(true); delCoordinatorLayout.setSizeFull(); Button deleteCoordBtn = new Button("Delete"); deleteCoordBtn.setClickShortcut(KeyCode.ENTER); deleteCoordBtn.setStyleName(ValoTheme.BUTTON_PRIMARY); delCoordinatorLayout.addComponents(idCaptionDel, idCoordDel); delCoordinatorLayout.addComponent(deleteCoordBtn, 1, 1); delCoordinatorLayout.setComponentAlignment(idCaptionDel, Alignment.MIDDLE_LEFT); delCoordinatorLayout.setComponentAlignment(idCoordDel, Alignment.MIDDLE_LEFT); delCoordPanel.setContent(delCoordinatorLayout); /******* DELETE COORDINATOR PANEL END *********/ /************************************************* MAIN BUTTONS LOGIC BEGIN *************************************************/ addCoordinator.addClickListener(event -> { if (!addCoordPanel.isVisible()) { delCoordPanel.setVisible(false); addCoordPanel.setVisible(true); idCoordAdd.focus(); } else addCoordPanel.setVisible(false); }); deleteCoordinator.addClickListener(event -> { if (!delCoordPanel.isVisible()) { addCoordPanel.setVisible(false); delCoordPanel.setVisible(true); idCoordDel.focus(); } else delCoordPanel.setVisible(false); }); /************************************************* MAIN BUTTONS LOGIC END *************************************************/ /************************************************* ADD COORDINATOR FORM LOGIC BEGIN *************************************************/ validateNewCoord.addClickListener(event -> { String currentURL = Page.getCurrent().getLocation().toString(); int strIndexCreator = currentURL.lastIndexOf(AdministratorLauncher.adminPageName); String iCrashURL = currentURL.substring(0, strIndexCreator); String googleShebang = "#!"; String coordURL = iCrashURL + CoordinatorServlet.coordinatorsName + googleShebang; try { sys.oeAddCoordinator(new DtCoordinatorID(new PtString(idCoordAdd.getValue())), new DtLogin(new PtString(loginCoord.getValue())), new DtPassword(new PtString(pwdCoord.getValue()))); // open new browser tab with the newly created coordinator console... // "_blank" instructs the browser to open a new tab instead of a new window... // unhappily not all browsers interpret it correctly, // some versions of some browsers might still open a new window instead (notably Firefox)! Page.getCurrent().open(coordURL + idCoordAdd.getValue(), "_blank"); } catch (Exception e) { e.printStackTrace(); } idCoordAdd.setValue(""); loginCoord.setValue(""); pwdCoord.setValue(""); idCoordAdd.focus(); }); /************************************************* ADD COORDINATOR FORM LOGIC END *************************************************/ /************************************************* DELETE COORDINATOR FORM LOGIC BEGIN *************************************************/ deleteCoordBtn.addClickListener(event -> { IcrashSystem sys = IcrashSystem.getInstance(); try { sys.oeDeleteCoordinator(new DtCoordinatorID(new PtString(idCoordDel.getValue()))); } catch (Exception e) { e.printStackTrace(); } idCoordDel.setValue(""); idCoordDel.focus(); }); /************************************************* DELETE COORDINATOR FORM LOGIC END *************************************************/ }
From source file:lu.uni.lassy.excalibur.examples.icrash.dev.web.java.views.ComCompanyErrorView.java
License:Open Source License
public ComCompanyErrorView() { setSizeFull();//from w w w . j a v a 2 s . c o m Label message = new Label("<h1>Error: the console does not exist, you should run MsrCreator first.</h1>"); message.setSizeUndefined(); message.setContentMode(ContentMode.HTML); addComponent(message); setComponentAlignment(message, Alignment.MIDDLE_CENTER); }
From source file:lu.uni.lassy.excalibur.examples.icrash.dev.web.java.views.CoordMobileForbidden.java
License:Open Source License
public CoordMobileForbidden() { setSizeFull();//from w ww. j av a 2 s .co m Label forbiddenMessage = new Label(); // forbiddenMessage.setContentMode(ContentMode.HTML); // forbiddenMessage.setValue("<h1>The following Messir operation is not allowed in this context</h1>"); forbiddenMessage.setValue("The following Messir operation is not allowed in this context"); forbiddenMessage.setSizeUndefined(); addComponent(forbiddenMessage); setComponentAlignment(forbiddenMessage, Alignment.MIDDLE_CENTER); }
From source file:lv.polarisit.demosidemenu.ValoThemeUI.java
License:Apache License
CssLayout buildMenu() { // Add items// www. j a v a 2 s . c om menuItems.put("MessageView", "First Message"); menuItems.put("MessageView1", "Second Message"); /* menuItems.put("labels", "Labels"); menuItems.put("buttons-and-links", "Buttons & Links"); menuItems.put("textfields", "Text Fields"); menuItems.put("datefields", "Date Fields"); menuItems.put("comboboxes", "Combo Boxes"); menuItems.put("selects", "Selects"); menuItems.put("checkboxes", "Check Boxes & Option Groups"); menuItems.put("sliders", "Sliders & Progress Bars"); menuItems.put("colorpickers", "Color Pickers"); menuItems.put("menubars", "Menu Bars"); menuItems.put("trees", "Trees"); menuItems.put("tables", "Tables"); menuItems.put("dragging", "Drag and Drop"); menuItems.put("panels", "Panels"); menuItems.put("splitpanels", "Split Panels"); menuItems.put("tabs", "Tabs"); menuItems.put("accordions", "Accordions"); menuItems.put("popupviews", "Popup Views"); // menuItems.put("calendar", "Calendar"); menuItems.put("forms", "Forms"); */ final HorizontalLayout top = new HorizontalLayout(); top.setWidth("100%"); top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); top.addStyleName("valo-menu-title"); menu.addComponent(top); menu.addComponent(createThemeSelect()); final Button showMenu = new Button("Menu", new ClickListener() { @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>Vaadin <strong>Valo Theme</strong></h3>", ContentMode.HTML); title.setSizeUndefined(); top.addComponent(title); top.setExpandRatio(title, 1); final MenuBar settings = new MenuBar(); settings.addStyleName("user-menu"); /* final StringGenerator sg = new StringGenerator(); final MenuItem settingsItem = settings.addItem(sg.nextString(true) + " " + sg.nextString(true) + sg.nextString(false), new ThemeResource("../tests-valo/img/profile-pic-300px.jpg"), null); settingsItem.addItem("Edit Profile", null); settingsItem.addItem("Preferences", null); settingsItem.addSeparator(); settingsItem.addItem("Sign Out", null); */ menu.addComponent(settings); menuItemsLayout.setPrimaryStyleName("valo-menuitems"); menu.addComponent(menuItemsLayout); Label label = null; int count = -1; for (final Entry<String, String> item : menuItems.entrySet()) { if (item.getKey().equals("labels")) { label = new Label("Components", ContentMode.HTML); label.setPrimaryStyleName("valo-menu-subtitle"); label.addStyleName("h4"); label.setSizeUndefined(); menuItemsLayout.addComponent(label); } if (item.getKey().equals("panels")) { label.setValue(label.getValue() + " <span class=\"valo-menu-badge\">" + count + "</span>"); count = 0; label = new Label("Containers", ContentMode.HTML); label.setPrimaryStyleName("valo-menu-subtitle"); label.addStyleName("h4"); label.setSizeUndefined(); menuItemsLayout.addComponent(label); } if (item.getKey().equals("forms")) { label.setValue(label.getValue() + " <span class=\"valo-menu-badge\">" + count + "</span>"); count = 0; label = new Label("Other", ContentMode.HTML); label.setPrimaryStyleName("valo-menu-subtitle"); label.addStyleName("h4"); label.setSizeUndefined(); menuItemsLayout.addComponent(label); } final Button b = new Button(item.getValue(), new ClickListener() { @Override public void buttonClick(final ClickEvent event) { navigator.navigateTo(item.getKey()); } }); if (count == 2) { b.setCaption(b.getCaption() + " <span class=\"valo-menu-badge\">123</span>"); } b.setHtmlContentAllowed(true); b.setPrimaryStyleName("valo-menu-item"); // b.setIcon(testIcon.get()); menuItemsLayout.addComponent(b); count++; } if (label != null) label.setValue(label.getValue() + " <span class=\"valo-menu-badge\">" + count + "</span>"); return menu; }
From source file:me.uni.emuseo.view.menu.MenuStartLayout.java
License:Open Source License
public MenuStartLayout() { Label welcome = new Label("Witaj w systemie"); Label systemName = new Label("<h1>e<strong>Museo</strong></h1>", ContentMode.HTML); addComponent(welcome);/* w w w . j a v a 2s . co m*/ addComponent(systemName); setComponentAlignment(welcome, Alignment.BOTTOM_CENTER); setComponentAlignment(systemName, Alignment.TOP_CENTER); welcome.setSizeUndefined(); systemName.setSizeUndefined(); setWidth(100, Unit.PERCENTAGE); setHeight(60, Unit.PERCENTAGE); }
From source file:me.uni.emuseo.view.menu.MenuView.java
License:Open Source License
private CssLayout buildMenu() { // Add items//from www. ja v a2 s . co m 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:module.pandabox.presentation.PandaBox.java
License:Open Source License
private Layout getLabelPreviews() { Layout grid = getPreviewLayout("Labels"); Label label = new Label("<h4>Paragraph Header</h4>Plain text, lorem ipsum dolor sit amet consectetur amit.", Label.CONTENT_XHTML); label.setWidth("200px"); grid.addComponent(label);//from w w w. j av a 2s . com label = new Label("Big plain text, lorem ipsum dolor sit amet consectetur amit."); label.setWidth("200px"); label.setStyleName("big"); grid.addComponent(label); label = new Label("Small plain text, lorem ipsum dolor sit amet consectetur amit."); label.setWidth("200px"); label.setStyleName("small"); grid.addComponent(label); label = new Label("Tiny plain text, lorem ipsum dolor sit amet consectetur amit."); label.setWidth("200px"); label.setStyleName("tiny"); grid.addComponent(label); label = new Label("<h1>Top Level Header</h1>", Label.CONTENT_XHTML); label.setSizeUndefined(); grid.addComponent(label); label.setDescription( "Label.addStyleName(\"h1\");<br>or<br>new Label(\"<h1>Top Level Header</h1>\", Label.CONTENT_XHTML);"); label = new Label("<h2>Second Header</h2>", Label.CONTENT_XHTML); label.setSizeUndefined(); grid.addComponent(label); label.setDescription( "Label.addStyleName(\"h2\");<br>or<br>new Label(\"<h2>Second Header</h2>\", Label.CONTENT_XHTML);"); label = new Label("<h3>Subtitle</h3>", Label.CONTENT_XHTML); label.setSizeUndefined(); grid.addComponent(label); label.setDescription( "Label.addStyleName(\"h3\");<br>or<br>new Label(\"<h3>Subtitle</h3>\", Label.CONTENT_XHTML);"); label = new Label("<h4>Paragraph Header</h4>Plain text, lorem ipsum dolor sit amet consectetur amit.", Label.CONTENT_XHTML); label.setWidth("200px"); label.setStyleName("color"); grid.addComponent(label); label = new Label("Big plain text, lorem ipsum dolor sit amet consectetur amit."); label.setWidth("200px"); label.setStyleName("big color"); grid.addComponent(label); label = new Label("Small plain text, lorem ipsum dolor sit amet consectetur amit."); label.setWidth("200px"); label.setStyleName("small color"); grid.addComponent(label); label = new Label("Tiny plain text, lorem ipsum dolor sit amet consectetur amit."); label.setWidth("200px"); label.setStyleName("tiny color"); grid.addComponent(label); label = new Label("Top Level Header"); label.setSizeUndefined(); label.setStyleName("h1 color"); grid.addComponent(label); label = new Label("Second Header"); label.setSizeUndefined(); label.setStyleName("h2 color"); grid.addComponent(label); label = new Label("Subtitle"); label.setSizeUndefined(); label.setStyleName("h3 color"); grid.addComponent(label); label = new Label("Warning text, lorem ipsum dolor sit."); label.setStyleName("warning"); grid.addComponent(label); label = new Label("Error text, lorem ipsum dolor."); label.setStyleName("error"); grid.addComponent(label); label = new Label("Big warning text"); label.setStyleName("big warning"); grid.addComponent(label); label = new Label("Big error text"); label.setStyleName("big error"); grid.addComponent(label); label = new Label("Loading text..."); label.setStyleName("h3 loading"); grid.addComponent(label); label = new Label("1"); label.setSizeUndefined(); label.addStyleName("numeral"); label.addStyleName("green"); grid.addComponent(label); label = new Label("2"); label.setSizeUndefined(); label.addStyleName("numeral"); label.addStyleName("yellow"); grid.addComponent(label); label = new Label("3"); label.setSizeUndefined(); label.addStyleName("numeral"); label.addStyleName("blue"); grid.addComponent(label); label = new Label("1"); label.setSizeUndefined(); label.addStyleName("numeral"); label.addStyleName("green"); label.addStyleName("big"); grid.addComponent(label); label = new Label("2"); label.setSizeUndefined(); label.addStyleName("numeral"); label.addStyleName("yellow"); label.addStyleName("big"); grid.addComponent(label); label = new Label("3"); label.setSizeUndefined(); label.addStyleName("numeral"); label.addStyleName("blue"); label.addStyleName("big"); grid.addComponent(label); return grid; }
From source file:module.pandabox.presentation.PandaBox.java
License:Open Source License
Layout getPopupViewPreviews() { Layout grid = getPreviewLayout("Popup views"); Label content = new Label("Simple popup content"); content.setSizeUndefined(); PopupView pv = new PopupView("Default popup", content); grid.addComponent(pv);/*from www . j av a 2s .co m*/ return grid; }
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(); Button signOut = new Button("Sign-Out"); signOut.setSizeUndefined();/* w w w. j a v a 2s . c om*/ 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.antoinecomte.regex.RegExTesterApplication.java
License:Apache License
private void showResult(String regexValue, String textValue) { Matcher matcher;//from w ww . j av a 2s. c o m try { result.setVisible(!"".equals(regexValue)); Label match = new Label("no match"); match.addStyleName("h3 color"); result.removeAllComponents(); result.addComponent(match); matcher = Pattern.compile(regexValue).matcher(textValue); if (matcher.matches()) { if (matcher.groupCount() > 0) for (int i = 1; i <= matcher.groupCount(); i++) { Label g = new Label("group " + i + " = " + matcher.group(i)); g.addStyleName("h3 color"); g.setSizeUndefined(); result.addComponent(g); } match.setValue("match"); } matcher.reset(); if (matcher.find()) { Label findresult = new Label("find=true, start = " + matcher.start() + " end = " + matcher.end()); findresult.addStyleName("h3 color"); result.addComponent(findresult); } Label javaString = new Label("java string : \"" + StringEscapeUtils.escapeJava(regexValue) + "\""); javaString.addStyleName("small color"); result.addComponent(javaString); } catch (Exception e) { result.removeAllComponents(); Label error = new Label(e.getMessage()); error.addStyleName("error"); result.addComponent(error); } }