List of usage examples for com.vaadin.ui CssLayout addStyleName
@Override public void addStyleName(String style)
From source file:de.symeda.sormas.ui.SubMenu.java
License:Open Source License
public void addView(final String name, String caption, String params, boolean isBackNavigation) { String target = "#!" + name + (params != null ? "/" + params : ""); CssLayout tabItemCell = new CssLayout(); tabItemCell.setSizeUndefined();//from w ww . j av a2 s .c o m tabItemCell.setPrimaryStyleName("v-tabsheet-tabitemcell"); CssLayout tabItem = new CssLayout(); tabItem.setSizeUndefined(); tabItem.setPrimaryStyleName("v-tabsheet-tabitem"); if (isBackNavigation) { tabItem.addStyleName("back"); } tabItemCell.addComponent(tabItem); Link link = new Link(caption, new ExternalResource(target)); link.addStyleName("v-caption"); if (isBackNavigation) link.setIcon(VaadinIcons.ARROW_CIRCLE_LEFT); tabItem.addComponent(link); menuItemsLayout.addComponent(tabItemCell); viewMenuItemMap.put(name, tabItem); }
From source file:dhbw.clippinggorilla.userinterface.views.GroupView.java
public GroupView() { User user = UserUtils.getCurrent();//www .j a v a2 s .c om Set<Group> groups = UserUtils.getAllGroups(user); CssLayout newGroupGroup = new CssLayout(); newGroupGroup.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); TextField textFieldNewGroupName = new TextField(); Language.setCustom(Word.GROUP_NAME, s -> textFieldNewGroupName.setPlaceholder(s)); textFieldNewGroupName.setWidth("260px"); textFieldNewGroupName.setMaxLength(255); newGroupGroup.addComponent(textFieldNewGroupName); Button buttonNewGroup = new Button(); buttonNewGroup.setIcon(VaadinIcons.PLUS); buttonNewGroup.addStyleName(ValoTheme.BUTTON_PRIMARY); buttonNewGroup.addClickListener(e -> { TabSheet.Tab newTab = accordion.addTab(createTab(createEmptyGroup(textFieldNewGroupName.getValue())), textFieldNewGroupName.getValue()); accordion.setSelectedTab(newTab); accordion.setWidth("100%"); textFieldNewGroupName.clear(); }); newGroupGroup.addComponent(buttonNewGroup); textFieldNewGroupName .addFocusListener(f -> buttonNewGroup.setClickShortcut(ShortcutAction.KeyCode.ENTER, null)); textFieldNewGroupName.addBlurListener(f -> buttonNewGroup.removeClickShortcut()); groups.forEach(g -> { accordion.addTab(createTab(g), g.getName()); }); addComponents(newGroupGroup, accordion); //SESSIONS.put(user, this); }
From source file:dhbw.clippinggorilla.userinterface.views.GroupView.java
private Component getProfiles(Group g) { VerticalLayout layoutRootProfiles = new VerticalLayout(); layoutRootProfiles.setMargin(false); layoutRootProfiles.setWidth("100%"); Panel panelProfiles = new Panel(Language.get(Word.PROFILES)); Language.setCustom(Word.PROFILES, s -> panelProfiles.setCaption(s)); panelProfiles.setWidth("100%"); panelProfiles.setHeight("200px"); VerticalLayout layoutProfiles = new VerticalLayout(); mapLayoutProfiles.put(g, layoutProfiles); layoutProfiles.setWidth("100%"); refreshProfiles(g, layoutProfiles);/* w ww . j av a 2 s. c o m*/ panelProfiles.setContent(layoutProfiles); layoutRootProfiles.addComponent(panelProfiles); if (GroupUtils.isAdmin(g, UserUtils.getCurrent())) { CssLayout addProfileGroup = new CssLayout(); addProfileGroup.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); addProfileGroup.setWidth("100%"); TextField textFieldAddProfile = new TextField(); Language.setCustom(Word.PROFILE_NAME, s -> textFieldAddProfile.setPlaceholder(s)); textFieldAddProfile.setMaxLength(255); textFieldAddProfile.setWidth("35%"); addProfileGroup.addComponent(textFieldAddProfile); Button buttonAddProfile = new Button(); buttonAddProfile.setIcon(VaadinIcons.PLUS); buttonAddProfile.addStyleName(ValoTheme.BUTTON_PRIMARY); buttonAddProfile.setWidth("15%"); buttonAddProfile.addClickListener(e -> { try { String name = textFieldAddProfile.getValue(); textFieldAddProfile.clear(); Runnable onClose = () -> refreshAll(g); UI.getCurrent().addWindow(GroupProfileWindow.create(g, name, true, onClose)); } catch (UserNotFoundException ex) { VaadinUtils.errorNotification(Language.get(Word.USER_NOT_FOUND)); } }); addProfileGroup.addComponent(buttonAddProfile); layoutRootProfiles.addComponent(addProfileGroup); } return layoutRootProfiles; }
From source file:dhbw.clippinggorilla.userinterface.views.GroupView.java
private Component getMembers(Group g) { VerticalLayout layoutRootMembers = new VerticalLayout(); layoutRootMembers.setMargin(false);/*from w w w. jav a 2s . co m*/ layoutRootMembers.setWidth("100%"); Panel panelMembers = new Panel(Language.get(Word.MEMBERS)); Language.setCustom(Word.MEMBERS, s -> panelMembers.setCaption(s)); panelMembers.setWidth("100%"); panelMembers.setHeight("200px"); VerticalLayout layoutMembers = new VerticalLayout(); mapLayoutMembers.put(g, layoutMembers); layoutMembers.setWidth("100%"); refreshMembers(g, layoutMembers); panelMembers.setContent(layoutMembers); layoutRootMembers.addComponent(panelMembers); if (GroupUtils.isAdmin(g, UserUtils.getCurrent())) { CssLayout addUserGroup = new CssLayout(); addUserGroup.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); addUserGroup.setWidth("100%"); TextField textFieldaddUser = new TextField(); Language.setCustom(Word.USERNAME, s -> textFieldaddUser.setPlaceholder(s)); textFieldaddUser.setMaxLength(255); textFieldaddUser.setWidth("70%"); addUserGroup.addComponent(textFieldaddUser); Button buttonAddUser = new Button(); buttonAddUser.setIcon(VaadinIcons.PLUS); buttonAddUser.addStyleName(ValoTheme.BUTTON_PRIMARY); buttonAddUser.setWidth("30%"); buttonAddUser.addClickListener(e -> { try { User u = UserUtils.getUser(textFieldaddUser.getValue()); textFieldaddUser.clear(); GroupUtils.addUser(g, u); refreshAll(g); } catch (UserNotFoundException ex) { VaadinUtils.errorNotification(Language.get(Word.USER_NOT_FOUND)); } }); addUserGroup.addComponent(buttonAddUser); layoutRootMembers.addComponent(addUserGroup); } return layoutRootMembers; }
From source file:dhbw.clippinggorilla.userinterface.views.InterestProfileView.java
public InterestProfileView() { User user = UserUtils.getCurrent();//from w w w . j av a2 s . c o m Set<InterestProfile> profiles = UserUtils.getAllInterestProfiles(user); CssLayout newProfileGroup = new CssLayout(); newProfileGroup.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); TextField textFieldNewProfileName = new TextField(); Language.setCustom(Word.PROFILE_NAME, s -> textFieldNewProfileName.setPlaceholder(s)); textFieldNewProfileName.setWidth("260px"); textFieldNewProfileName.setMaxLength(255); newProfileGroup.addComponent(textFieldNewProfileName); Button buttonNewProfile = new Button(); buttonNewProfile.setIcon(VaadinIcons.PLUS); buttonNewProfile.addStyleName(ValoTheme.BUTTON_PRIMARY); buttonNewProfile.addClickListener(e -> { Tab newTab = accordion.addTab(createTab(createEmptyProfile(textFieldNewProfileName.getValue())), textFieldNewProfileName.getValue()); accordion.setSelectedTab(newTab); accordion.setWidth("100%"); textFieldNewProfileName.clear(); }); newProfileGroup.addComponent(buttonNewProfile); textFieldNewProfileName .addFocusListener(f -> buttonNewProfile.setClickShortcut(ShortcutAction.KeyCode.ENTER, null)); textFieldNewProfileName.addBlurListener(f -> buttonNewProfile.removeClickShortcut()); profiles.forEach((InterestProfile profile) -> { accordion.addTab(createTab(profile), profile.getName()); }); addComponents(newProfileGroup, accordion); SESSIONS.put(user, this); }
From source file:dhbw.clippinggorilla.userinterface.views.InterestProfileView.java
private Component getAddTagGroup(InterestProfile profile, boolean included) { CssLayout newTagGroup = new CssLayout(); newTagGroup.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); TextField textFieldTag = new TextField(); textFieldTag.setWidth("325px"); textFieldTag.setMaxLength(255);//from www . j a v a 2s . co m Language.setCustom(Word.NEW_TAG, s -> textFieldTag.setPlaceholder(s)); Button buttonAddTag = new Button(VaadinIcons.PLUS); buttonAddTag.addStyleName(ValoTheme.BUTTON_PRIMARY); buttonAddTag.setClickShortcut(ShortcutAction.KeyCode.ENTER, null); buttonAddTag.addClickListener(event -> { addRow(profile, included, textFieldTag.getValue()); profile.getTags().put(textFieldTag.getValue(), included); textFieldTag.clear(); }); textFieldTag.addFocusListener(f -> buttonAddTag.setClickShortcut(ShortcutAction.KeyCode.ENTER, null)); textFieldTag.addBlurListener(f -> buttonAddTag.removeClickShortcut()); newTagGroup.addComponents(textFieldTag, buttonAddTag); newTagGroup.setWidth("100%"); return newTagGroup; }
From source file:dhbw.clippinggorilla.userinterface.windows.GroupProfileWindow.java
private Component getAddTagGroup(GroupInterestProfile profile, boolean included) { CssLayout newTagGroup = new CssLayout(); newTagGroup.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); TextField textFieldTag = new TextField(); textFieldTag.setWidth("325px"); textFieldTag.setMaxLength(255);/* w w w .ja v a2s. co m*/ Language.setCustom(Word.NEW_TAG, s -> textFieldTag.setPlaceholder(s)); Button buttonAddTag = new Button(VaadinIcons.PLUS); buttonAddTag.addStyleName(ValoTheme.BUTTON_PRIMARY); buttonAddTag.setClickShortcut(ShortcutAction.KeyCode.ENTER, null); buttonAddTag.addClickListener(event -> { addRow(profile, included, textFieldTag.getValue(), true); profile.getTags().put(textFieldTag.getValue(), included); textFieldTag.clear(); }); textFieldTag.addFocusListener(f -> buttonAddTag.setClickShortcut(ShortcutAction.KeyCode.ENTER, null)); textFieldTag.addBlurListener(f -> buttonAddTag.removeClickShortcut()); newTagGroup.addComponents(textFieldTag, buttonAddTag); newTagGroup.setWidth("100%"); return newTagGroup; }
From source file:dhbw.clippinggorilla.userinterface.windows.NewSourceWindow.java
public Component getThirdStage(Source s) { Label header = new Label(Language.get(Word.CRAWLER)); header.addStyleName(ValoTheme.LABEL_H1); Crawler crawler;//from w ww. jav a 2s .c om if (s.getCrawler() != null) { crawler = s.getCrawler(); } else { crawler = new Crawler(s); s.setCrawler(crawler); } GridLayout mainGrid = new GridLayout(2, 2); mainGrid.setSizeFull(); mainGrid.setSpacing(true); FormLayout layoutForms = new FormLayout(); //Exclude or Include RadioButtonGroup<Boolean> radios = new RadioButtonGroup<>(); radios.setItems(true, false); radios.setItemCaptionGenerator(b -> b ? Language.get(Word.INCLUDE_TAGS) : Language.get(Word.EXCLUDE_TAGS)); radios.setItemIconGenerator(b -> b ? VaadinIcons.CHECK : VaadinIcons.CLOSE); radios.setSelectedItem(true); radios.addValueChangeListener(event -> include = event.getValue()); //By Class CssLayout addByClassGroup = new CssLayout(); addByClassGroup.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); TextField textFieldAddByClass = new TextField(); textFieldAddByClass.setWidth("465px"); Button buttonAddByClass = new Button(VaadinIcons.PLUS); buttonAddByClass.addClickListener(e -> { crawler.addByClass(textFieldAddByClass.getValue(), include); refreshList(mainGrid, crawler); textFieldAddByClass.clear(); }); addByClassGroup.addComponents(textFieldAddByClass, buttonAddByClass); addByClassGroup.setCaption(Language.get(Word.BYCLASS)); //ByTag CssLayout addByTagGroup = new CssLayout(); addByTagGroup.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); TextField textFieldAddByTag = new TextField(); Button buttonAddByTag = new Button(VaadinIcons.PLUS); textFieldAddByTag.setWidth("465px"); buttonAddByTag.addClickListener(e -> { crawler.addByTag(textFieldAddByTag.getValue(), include); refreshList(mainGrid, crawler); textFieldAddByTag.clear(); }); addByTagGroup.addComponents(textFieldAddByTag, buttonAddByTag); addByTagGroup.setCaption(Language.get(Word.BYTAG)); //ByID CssLayout addByIDGroup = new CssLayout(); addByIDGroup.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); TextField textFieldAddByID = new TextField(); textFieldAddByID.setWidth("465px"); Button buttonAddByID = new Button(VaadinIcons.PLUS); buttonAddByID.addClickListener(e -> { crawler.addByID(textFieldAddByID.getValue(), include); refreshList(mainGrid, crawler); textFieldAddByID.clear(); }); addByIDGroup.addComponents(textFieldAddByID, buttonAddByID); addByIDGroup.setCaption(Language.get(Word.BYID)); //ByAttribute CssLayout addByAttributeGroup = new CssLayout(); addByAttributeGroup.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); TextField textFieldAddByAttributeKey = new TextField(); textFieldAddByAttributeKey.setWidth("233px"); TextField textFieldAddByAttributeValue = new TextField(); textFieldAddByAttributeValue.setWidth("232px"); Button buttonAddByAttribute = new Button(VaadinIcons.PLUS); buttonAddByAttribute.addClickListener(e -> { crawler.addByAttribute(textFieldAddByAttributeKey.getValue(), textFieldAddByAttributeValue.getValue(), include); refreshList(mainGrid, crawler); textFieldAddByAttributeKey.clear(); textFieldAddByAttributeValue.clear(); }); addByAttributeGroup.addComponents(textFieldAddByAttributeKey, textFieldAddByAttributeValue, buttonAddByAttribute); addByAttributeGroup.setCaption(Language.get(Word.BYATTRIBUTEVALUE)); layoutForms.addComponents(radios, addByClassGroup, addByTagGroup, addByIDGroup, addByAttributeGroup); mainGrid.addComponent(layoutForms); Label labelResult = new Label(); Panel panelResult = new Panel(labelResult); labelResult.setWidth("100%"); panelResult.setWidth("100%"); panelResult.setHeight("175px"); mainGrid.addComponent(panelResult, 0, 1, 1, 1); Button buttonTestURL = new Button(); buttonTestURL.setIcon(VaadinIcons.EXTERNAL_LINK); buttonTestURL.setCaption(Language.get(Word.OPEN_LINK)); Button buttonTest = new Button(Language.get(Word.TEST), VaadinIcons.CLIPBOARD_CHECK); buttonTest.addClickListener(ce -> { Article a = CrawlerUtils.executeRandom(crawler); labelResult.setValue(a.getBody()); if (reg != null) { reg.remove(); } reg = buttonTestURL .addClickListener(cev -> UI.getCurrent().getPage().open(a.getUrl(), "_blank", false)); }); refreshList(mainGrid, crawler); Runnable cancel = () -> close(); Runnable next = () -> validateThirdStage(s); VerticalLayout windowLayout = new VerticalLayout(); windowLayout.addComponents(header, mainGrid, getFooter(cancel, next, buttonTest, buttonTestURL)); windowLayout.setComponentAlignment(header, Alignment.MIDDLE_CENTER); windowLayout.setExpandRatio(mainGrid, 5); windowLayout.setWidth("1250px"); return windowLayout; }
From source file:edu.nps.moves.mmowgli.modules.maps.OpenLayersMap.java
License:Open Source License
public void initGuiTL() { setSpacing(true);/*from w ww . ja v a2 s . co m*/ setSizeUndefined(); setWidth("100%"); addStyleName("m-marginleft-20"); Label lab; addComponent(lab = new HtmlLabel(title)); lab.setWidth(null); setComponentAlignment(lab, Alignment.MIDDLE_CENTER); CssLayout cssLay = new CssLayout(); cssLay.addStyleName("m-greybackground"); cssLay.addStyleName("m-darkgreyborder"); cssLay.setWidth("960px"); cssLay.setHeight("600px"); cssLay.setId("mmowgliMap"); addComponent(cssLay); setComponentAlignment(cssLay, Alignment.TOP_CENTER); /* See http://wiki.openstreetmap.org/wiki/OpenLayers_Simple_Example This requires the "http://openlayers.org/api/OpenLayers.js" file to be loaded: see the annotation in Mmowgli2UI.java. */ /* One example layer: String js = "var m_map = new OpenLayers.Map('mmowgliMap');"+ "var m_wms = new OpenLayers.Layer.WMS( \"OpenLayers WMS\","+ "\"http://vmap0.tiles.osgeo.org/wms/vmap0\", {layers: 'basic'} );"+ "m_map.addLayer(m_wms);"+ "m_map.zoomToMaxExtent();"; */ String jsOSM = "mMap = new OpenLayers.Map('mmowgliMap');" + // "shadeLayer = new OpenLayers.Layer.WMS("+ // "\"Shaded Relief\"," + // "\"http://ims.cr.usgs.gov:80/servlet19/com.esri.wms.Esrimap/USGS_EDC_Elev_NED_3\","+ // "{layers: HR-NED.IMAGE, reaspect: false, transparent: true, visibility: false}); "+ "var osLay = new OpenLayers.Layer.OSM();" + "var fromProjection = new OpenLayers.Projection(\"EPSG:4326\");" + // Transform from WGS 1984 "var toProjection = new OpenLayers.Projection(\"EPSG:900913\");" + // to Spherical Mercator Projection "var position = new OpenLayers.LonLat(-121.875267, 36.599878).transform( fromProjection, toProjection);" + "var zoom = 15;" + " mMap.addLayer(osLay);" + //" mMap.addLayer(shadeLayer);"+ //" mMap.addControl(new OpenLayers.Control.LayerSwitcher());"+ " mMap.setCenter(position, zoom );"; /* String worldWind = "mMap = new OpenLayers.Map('mmowgliMap', {'maxResolution': .28125, tileSize: new OpenLayers.Size(512, 512)});"+ "var osLay = new OpenLayers.Layer.OSM();"+ "var ol_wms = new OpenLayers.Layer.WMS( \"OpenLayers WMS\", \"http://vmap0.tiles.osgeo.org/wms/vmap0?\", {layers: 'basic'} );"+ // "var ww = new OpenLayers.Layer.WorldWind( \"Bathy\",\"http://worldwind25.arc.nasa.gov/tile/tile.aspx?\", 36, 4,{T:\"bmng.topo.bathy.200406\"});"+ // "var ww2 = new OpenLayers.Layer.WorldWind( \"LANDSAT\",\"http://worldwind25.arc.nasa.gov/tile/tile.aspx\", 2.25, 4,{T:\"105\"});"+ "mMap.addLayers([osLay]); //,ol_wms]);"+ //, ww, ww2]);"+ // "mMap.addControl(new OpenLayers.Control.LayerSwitcher());"+ "var fromProjection = new OpenLayers.Projection(\"EPSG:4326\");"+ // Transform from WGS 1984 "var toProjection = new OpenLayers.Projection(\"EPSG:900913\");"+ // to Spherical Mercator Projection "var position = new OpenLayers.LonLat(-121.875267, 36.599878).transform( fromProjection, toProjection);"+ "var zoom = 15;"+ //"mMap.setCenter(new OpenLayers.LonLat(-71.4, 42.3), 6);"+ " mMap.setCenter(position, zoom );"+ ""; */ JavaScript.getCurrent().execute(jsOSM); }
From source file:fr.amapj.view.engine.menu.MenuPart.java
License:Open Source License
private CssLayout buildMenu(CssLayout menu, CssLayout menuItemsLayout, List<MenuDescription> allMenus, Navigator navigator, AmapUI ui) { final HorizontalLayout top = new HorizontalLayout(); top.setWidth("100%"); top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); top.addStyleName("valo-menu-title"); menu.addComponent(top);/* w w w. jav a2 s .c o m*/ 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); String nomAmap = new ParametresService().getParametres().nomAmap; Label title = new Label("<h2>" + nomAmap + "</h2>", ContentMode.HTML); title.setSizeUndefined(); top.addComponent(title); top.setExpandRatio(title, 1); final MenuBar settings = new MenuBar(); settings.addStyleName("user-menu"); SessionParameters p = SessionManager.getSessionParameters(); MenuItem settingsItem = settings.addItem(p.userPrenom + " " + p.userNom, null, null); settingsItem.addItem("Se dconnecter", new MenuBar.Command() { @Override public void menuSelected(MenuItem selectedItem) { new PasswordManager().disconnect(); ui.buildLoginView(null, null, null); } }); menu.addComponent(settings); menuItemsLayout.setPrimaryStyleName("valo-menuitems"); menu.addComponent(menuItemsLayout); boolean first = true; String firstEntry = null; Button firstButton = null; for (MenuDescription menuDescription : allMenus) { final String view = menuDescription.getMenuName().name().toLowerCase(); final String titleView = menuDescription.getMenuName().getTitle(); if (menuDescription.getCategorie() != null) { Label l = new Label(menuDescription.getCategorie(), ContentMode.HTML); l.setPrimaryStyleName("valo-menu-subtitle"); l.addStyleName("h4"); l.setSizeUndefined(); menuItemsLayout.addComponent(l); } final Button b = new Button(titleView, new ClickListener() { @Override public void buttonClick(final ClickEvent event) { setSelected(event.getButton(), menuItemsLayout); navigator.navigateTo("/" + view); } }); b.setId("amapj.menu." + view); b.setHtmlContentAllowed(true); b.setPrimaryStyleName("valo-menu-item"); b.setIcon(menuDescription.getMenuName().getFont()); menuItemsLayout.addComponent(b); viewNameToMenuButton.put("/" + view, b); if (first) { first = false; firstButton = b; firstEntry = view; } } // Gestion de l'url String f = Page.getCurrent().getUriFragment(); if (f != null && f.startsWith("!")) { f = f.substring(1); } if (f == null || f.equals("") || f.equals("/")) { navigateWithProtect(navigator, "/" + firstEntry); setSelected(firstButton, menuItemsLayout); } else { navigateWithProtect(navigator, f); setSelected(viewNameToMenuButton.get(f), menuItemsLayout); } return menu; }