List of usage examples for com.vaadin.ui CssLayout setWidth
@Override public void setWidth(String width)
From source file:com.mycollab.ui.chart.PieChartWrapper.java
License:Open Source License
@Override protected final ComponentContainer createLegendBox() { final CssLayout mainLayout = new CssLayout(); mainLayout.addStyleName("legendBoxContent"); mainLayout.setSizeUndefined();//from www .ja v a2 s .c o m final List keys = pieDataSet.getKeys(); for (int i = 0; i < keys.size(); i++) { MHorizontalLayout layout = new MHorizontalLayout().withMargin(new MarginInfo(false, false, false, true)) .withStyleName("inline-block").withWidthUndefined(); layout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); final Comparable key = (Comparable) keys.get(i); int colorIndex = i % CHART_COLOR_STR.size(); final String color = "<div style = \" width:13px;height:13px;background: #" + CHART_COLOR_STR.get(colorIndex) + "\" />"; final ELabel lblCircle = ELabel.html(color); String btnCaption; if (enumKeyCls == null) { if (key instanceof Key) { btnCaption = String.format("%s (%d)", StringUtils.trim(((Key) key).getDisplayName(), 20, true), pieDataSet.getValue(key).intValue()); } else { btnCaption = String.format("%s (%d)", key, pieDataSet.getValue(key).intValue()); } } else { btnCaption = String.format("%s(%d)", UserUIContext.getMessage(enumKeyCls, key.toString()), pieDataSet.getValue(key).intValue()); } MButton btnLink = new MButton(StringUtils.trim(btnCaption, 25, true), clickEvent -> { if (key instanceof Key) { clickLegendItem(((Key) key).getKey()); } else { clickLegendItem(key.toString()); } }).withStyleName(WebThemes.BUTTON_LINK).withDescription(btnCaption); layout.with(lblCircle, btnLink); mainLayout.addComponent(layout); } mainLayout.setWidth("100%"); return mainLayout; }
From source file:com.mycollab.vaadin.web.ui.MailFormWindow.java
License:Open Source License
private void initUI() { GridLayout mainLayout = new GridLayout(1, 5); mainLayout.setWidth("100%"); mainLayout.setMargin(true);/*from w ww .j a v a2s. c o m*/ mainLayout.setSpacing(true); CssLayout inputPanel = new CssLayout(); inputPanel.setWidth("100%"); inputPanel.setStyleName("mail-panel"); inputLayout = new GridLayout(3, 4); inputLayout.setSpacing(true); inputLayout.setWidth("100%"); inputLayout.setColumnExpandRatio(0, 1.0f); inputPanel.addComponent(inputLayout); mainLayout.addComponent(inputPanel); tokenFieldMailTo = new EmailTokenField(); inputLayout.addComponent(createTextFieldMail("To:", tokenFieldMailTo), 0, 0); if (lstMail != null) { for (String mail : lstMail) { if (StringUtils.isNotBlank(mail)) { if (mail.indexOf("<") > -1) { String strMail = mail.substring(mail.indexOf("<") + 1, mail.lastIndexOf(">")); if (strMail != null && !strMail.equalsIgnoreCase("null")) { } } else { } } } } final TextField subject = new TextField(); subject.setRequired(true); subject.setWidth("100%"); subjectField = createTextFieldMail("Subject:", subject); inputLayout.addComponent(subjectField, 0, 1); initButtonLinkCcBcc(); ccField = createTextFieldMail("Cc:", tokenFieldMailCc); bccField = createTextFieldMail("Bcc:", tokenFieldMailBcc); final RichTextArea noteArea = new RichTextArea(); noteArea.setWidth("100%"); noteArea.setHeight("200px"); mainLayout.addComponent(noteArea, 0, 1); mainLayout.setComponentAlignment(noteArea, Alignment.MIDDLE_CENTER); final AttachmentPanel attachments = new AttachmentPanel(); attachments.setWidth("500px"); MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> close()).withStyleName(WebThemes.BUTTON_OPTION); MButton sendBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.ACTION_SEND_EMAIL), clickEvent -> { if (tokenFieldMailTo.getListRecipient().size() <= 0 || subject.getValue().equals("")) { NotificationUtil.showErrorNotification( "To Email field and Subject field must be not empty! Please fulfil them before sending email."); return; } if (UserUIContext.getUser().getEmail() != null && UserUIContext.getUser().getEmail().length() > 0) { ExtMailService systemMailService = AppContextUtil.getSpringBean(ExtMailService.class); List<File> listFile = attachments.files(); List<AttachmentSource> attachmentSource = null; if (listFile != null && listFile.size() > 0) { attachmentSource = new ArrayList<>(); for (File file : listFile) { attachmentSource.add(new FileAttachmentSource(file)); } } systemMailService.sendHTMLMail(UserUIContext.getUser().getEmail(), UserUIContext.getUser().getDisplayName(), tokenFieldMailTo.getListRecipient(), tokenFieldMailCc.getListRecipient(), tokenFieldMailBcc.getListRecipient(), subject.getValue(), noteArea.getValue(), attachmentSource, true); close(); } else { NotificationUtil .showErrorNotification("Your email is empty value, please fulfil it before sending email!"); } }).withIcon(FontAwesome.SEND).withStyleName(WebThemes.BUTTON_ACTION); MHorizontalLayout controlsLayout = new MHorizontalLayout(attachments, cancelBtn, sendBtn) .expand(attachments).withFullWidth(); mainLayout.addComponent(controlsLayout, 0, 2); this.setContent(mainLayout); }
From source file:com.wintindustries.pfserver.interfaces.view.dashboard.DashboardMenu.java
private Component buildContent() { final CssLayout menuContent = new CssLayout(); menuContent.addStyleName("sidebar"); menuContent.addStyleName(ValoTheme.MENU_PART); menuContent.addStyleName("no-vertical-drag-hints"); menuContent.addStyleName("no-horizontal-drag-hints"); menuContent.setWidth(null); menuContent.setHeight("100%"); menuContent.addComponent(buildTitle()); menuContent.addComponent(buildUserMenu()); menuContent.addComponent(buildToggleButton()); menuContent.addComponent(new PFSearchBar()); reloadFolderUI();// w ww .j a v a 2 s . c o m // menuContent.addComponent(buildMenuItems()); menuContent.addComponent(folderUI); return menuContent; }
From source file:com.wintindustries.pfserver.interfaces.view.dashboard.DashboardMenu.java
private Component buildFolderUI() { final CssLayout folderUIComponent = new CssLayout(); folderUIComponent.setWidth("100%"); folderUIComponent.addComponent(buildFolderTree()); return folderUIComponent; }
From source file:com.wintindustries.pfserver.interfaces.view.dashboard.DashboardMenu.java
private Component buildFolderTree() { CssLayout treeLayout = new CssLayout(); treeLayout.setWidth("100%"); if (treeLayout.getComponentCount() > 0) { treeLayout.removeAllComponents(); }//ww w. j a v a 2 s . co m System.out.println("Init Dataasource"); for (PFDataSource source : PFCore.core.getDataSources()) { System.out.println("NEW TREE"); Label label = new Label(source.getName(), ContentMode.HTML); label.setPrimaryStyleName("valo-menu-subtitle"); label.addStyleName("h4"); label.setSizeUndefined(); treeLayout.addComponent(label); // label.setIcon(FontAwesome.LAPTOP); treeLayout.addStyleName("valo-menuitems"); Tree tree = new Tree(); //tree.setIcon(FontAwesome.LAPTOP); // tree.setWidth("100%"); // container.setItemSorter(new l); source.Session().OpenSession(); source.Session().getSession().beginTransaction(); source.Session().getSession().getTransaction().setTimeout(4); System.out.println(": " + source.getDatabase().getSessionManager()); Set<PFFolder> rootFolders = PFLocation.getRootDirectoriesFromDatabase(source.getDatabase()); System.out.println(": " + source.getDatabase().getSessionManager()); final PFFolderProxyContainer container = new PFFolderProxyContainer(rootFolders, source); container.setSortAlphabetic(true); tree.setContainerDataSource(container); tree.setItemCaptionMode(AbstractSelect.ItemCaptionMode.PROPERTY); tree.setItemCaptionPropertyId("Name"); tree.setItemIconPropertyId("Icon"); ItemClickListener treeclick; treeclick = new ItemClickListener() { @Override public void itemClick(final ItemClickEvent event) { // Notification note = new Notification("Notificaton", event.getItemId().toString(), Notification.Type.ERROR_MESSAGE); // note.show(Page.getCurrent()); PFFolderProxy proxyFolder = (PFFolderProxy) event.getItemId(); MyUI.getPFNavigator().navigateTo(MyUI.PAGE_FOLDERVIEW + "/" + proxyFolder.getIdentifier()); } }; tree.addItemClickListener(treeclick); // Allow all nodes to have children // .dashboard-menu-folder-wrapper // all these wrappers are a hacky workaround to a Vaadin CSS glitch CssLayout treeWrapper = new CssLayout(); treeWrapper.setStyleName(".dashboard-menu-folder-wrapper"); treeWrapper.addComponent(tree); treeWrapper.setWidth("40px"); tree.setWidth("800px"); tree.setStyleName(".dashboard-menu-folder-tree"); treeLayout.addComponent(treeWrapper); source.Session().getSession().getTransaction().commit(); source.getDatabase().getSessionManager().CloseSession(); } return treeLayout; }
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 a2s .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);// w w w . jav a 2s . c om 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
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);// w w w . j av a2 s.c o 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 .j ava 2 s .c o 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:edu.nps.moves.mmowgli.modules.maps.OpenLayersMap.java
License:Open Source License
public void initGuiTL() { setSpacing(true);/*from w w w . ja v a 2 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); }