Example usage for com.vaadin.ui CssLayout setHeight

List of usage examples for com.vaadin.ui CssLayout setHeight

Introduction

In this page you can find the example usage for com.vaadin.ui CssLayout setHeight.

Prototype

@Override
    public void setHeight(String height) 

Source Link

Usage

From source file:com.esofthead.mycollab.community.ui.chart.GenericChartWrapper.java

License:Open Source License

public void setSearchCriteria(final S criteria) {
    this.searchCriteria = criteria;

    final JFreeChart chart = createChart();
    final JFreeChartWrapper chartWrapper = new JFreeChartWrapper(chart);

    removeAllComponents();//  w w w .ja v a  2s.  c o  m
    final CssLayout borderWrap = new CssLayout();
    borderWrap.addComponent(chartWrapper);
    borderWrap.setStyleName("chart-wrapper");
    borderWrap.setHeight(height + "px");
    borderWrap.setWidth(width + "px");
    chartWrapper.setHeight(height + "px");
    chartWrapper.setWidth(width + "px");
    chartWrapper.setGraphHeight(height);
    chartWrapper.setGraphWidth(width);
    this.addComponent(borderWrap);
    this.setComponentAlignment(borderWrap, Alignment.MIDDLE_CENTER);
    final Component legendBox = createLegendBox();
    this.addComponent(legendBox);
    this.setComponentAlignment(legendBox, Alignment.MIDDLE_CENTER);
}

From source file:com.esofthead.mycollab.mobile.module.user.view.LoginViewImpl.java

License:Open Source License

private void initUI() {
    this.setStyleName("login-view");
    this.setSizeFull();

    VerticalLayout contentLayout = new VerticalLayout();
    contentLayout.setStyleName("content-wrapper");
    contentLayout.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    contentLayout.setMargin(true);// ww  w  . j  a  va2 s  . c  o  m
    contentLayout.setSpacing(true);
    contentLayout.setWidth("320px");

    Image mainLogo = new Image(null, new ThemeResource("icons/logo_m.png"));
    contentLayout.addComponent(mainLogo);

    Label introText = new Label(
            "MyCollab helps you do all your office jobs on the computers, phones and tablets you use");
    introText.setStyleName("intro-text");
    contentLayout.addComponent(introText);

    CssLayout welcomeTextWrapper = new CssLayout();
    welcomeTextWrapper.setStyleName("welcometext-wrapper");
    welcomeTextWrapper.setWidth("100%");
    welcomeTextWrapper.setHeight("15px");
    Label welcomeText = new Label("Welcome Back!");
    welcomeText.setWidth("150px");
    welcomeTextWrapper.addComponent(welcomeText);
    contentLayout.addComponent(welcomeTextWrapper);

    final EmailField emailField = new EmailField();
    emailField.setWidth("100%");
    emailField.setInputPrompt("E-mail Address");
    emailField.setStyleName("email-input");
    contentLayout.addComponent(emailField);

    final PasswordField pwdField = new PasswordField();
    pwdField.setWidth("100%");
    pwdField.setInputPrompt("Password");
    pwdField.setStyleName("password-input");
    contentLayout.addComponent(pwdField);

    final CheckBox rememberPassword = new CheckBox();
    rememberPassword.setWidth("100%");
    rememberPassword.setCaption("Remember password");
    rememberPassword.setValue(true);
    contentLayout.addComponent(rememberPassword);

    Button signInBtn = new Button("Sign In");
    signInBtn.setWidth("100%");
    signInBtn.addStyleName(UIConstants.BUTTON_BIG);
    signInBtn.addStyleName(UIConstants.COLOR_BLUE);
    signInBtn.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            ShellController.doLogin(emailField.getValue(), pwdField.getValue(), rememberPassword.getValue());
        }
    });
    contentLayout.addComponent(signInBtn);

    Button createAccountBtn = new Button("Create Account");
    createAccountBtn.setWidth("100%");
    createAccountBtn.addStyleName(UIConstants.BUTTON_BIG);
    createAccountBtn.addStyleName(UIConstants.COLOR_GRAY);
    contentLayout.addComponent(createAccountBtn);

    this.addComponent(contentLayout);
}

From source file:com.esofthead.mycollab.mobile.shell.ui.MainView.java

License:Open Source License

private void initUI() {
    this.setStyleName("main-view");
    this.setSizeFull();

    VerticalLayout contentLayout = new VerticalLayout();
    contentLayout.setStyleName("content-wrapper");
    contentLayout.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    contentLayout.setMargin(true);/*w  w w  .jav  a2 s .co m*/
    contentLayout.setSpacing(true);
    contentLayout.setWidth("320px");

    Image mainLogo = new Image(null, new ThemeResource("icons/logo_m.png"));
    contentLayout.addComponent(mainLogo);

    Label introText = new Label(
            "MyCollab helps you do all your office jobs on the computers, phones and tablets you use");
    introText.setStyleName("intro-text");
    contentLayout.addComponent(introText);

    CssLayout welcomeTextWrapper = new CssLayout();
    welcomeTextWrapper.setStyleName("welcometext-wrapper");
    welcomeTextWrapper.setWidth("100%");
    welcomeTextWrapper.setHeight("15px");
    contentLayout.addComponent(welcomeTextWrapper);

    ModuleButton crmButton = new ModuleButton(AppContext.getMessage(GenericI18Enum.MODULE_CRM));
    crmButton.setWidth("100%");
    crmButton.addStyleName("crm");
    crmButton.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = -1218427186205574547L;

        @Override
        public void buttonClick(ClickEvent event) {
            EventBusFactory.getInstance().post(new ShellEvent.GotoCrmModule(this, null));
        }
    });

    contentLayout.addComponent(crmButton);

    ModuleButton pmButton = new ModuleButton(AppContext.getMessage(GenericI18Enum.MODULE_PROJECT));
    pmButton.setWidth("100%");
    pmButton.addStyleName("project");
    pmButton.addClickListener(new Button.ClickListener() {

        private static final long serialVersionUID = -5323408319082242586L;

        @Override
        public void buttonClick(ClickEvent event) {
            EventBusFactory.getInstance().post(new ShellEvent.GotoProjectModule(this, null));
        }
    });
    contentLayout.addComponent(pmButton);

    ModuleButton fileButton = new ModuleButton(AppContext.getMessage(GenericI18Enum.MODULE_DOCUMENT));
    fileButton.setWidth("100%");
    fileButton.addStyleName("document");
    contentLayout.addComponent(fileButton);

    this.addComponent(contentLayout);
}

From source file:com.esofthead.mycollab.mobile.shell.view.MainView.java

License:Open Source License

public MainView() {
    super();//from ww w . j  a  v a  2  s.com
    this.setSizeFull();

    MVerticalLayout contentLayout = new MVerticalLayout().withStyleName("content-wrapper").withFullWidth();
    contentLayout.setDefaultComponentAlignment(Alignment.TOP_CENTER);

    Image mainLogo = new Image(null, new ThemeResource("icons/logo_m.png"));
    contentLayout.addComponent(mainLogo);

    Label introText = new Label(
            "MyCollab helps you do all your office jobs on the computers, phones and tablets you use");
    introText.setStyleName("intro-text");
    contentLayout.addComponent(introText);

    CssLayout welcomeTextWrapper = new CssLayout();
    welcomeTextWrapper.setStyleName("welcometext-wrapper");
    welcomeTextWrapper.setWidth("100%");
    welcomeTextWrapper.setHeight("15px");
    contentLayout.addComponent(welcomeTextWrapper);

    Button crmButton = new Button(AppContext.getMessage(GenericI18Enum.MODULE_CRM), new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent clickEvent) {
            EventBusFactory.getInstance().post(new ShellEvent.GotoCrmModule(this, null));
        }
    });
    crmButton.addStyleName(UIConstants.BUTTON_ACTION);
    crmButton.setWidth("100%");

    contentLayout.addComponent(crmButton);

    Button pmButton = new Button(AppContext.getMessage(GenericI18Enum.MODULE_PROJECT),
            new Button.ClickListener() {
                @Override
                public void buttonClick(ClickEvent clickEvent) {
                    EventBusFactory.getInstance().post(new ShellEvent.GotoProjectModule(this, null));
                }
            });
    pmButton.setWidth("100%");
    pmButton.addStyleName(UIConstants.BUTTON_ACTION);
    contentLayout.addComponent(pmButton);

    this.addComponent(contentLayout);
}

From source file:com.esofthead.mycollab.mobile.ui.MobileAttachmentUtils.java

License:Open Source License

public static Component renderAttachmentRow(final Content attachment) {
    String docName = attachment.getPath();
    int lastIndex = docName.lastIndexOf("/");
    HorizontalLayout attachmentRow = new HorizontalLayout();
    attachmentRow.setStyleName("attachment-row");
    attachmentRow.setWidth("100%");
    attachmentRow.setSpacing(true);//w  w  w . j av  a  2s . co  m
    attachmentRow.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    CssLayout thumbnailWrap = new CssLayout();
    thumbnailWrap.setWidth("25px");
    thumbnailWrap.setHeight("40px");
    thumbnailWrap.setStyleName("thumbnail-wrap");

    Image thumbnail = new Image(null);
    if (org.apache.commons.lang3.StringUtils.isBlank(attachment.getThumbnail())) {
        thumbnail.setSource(DEFAULT_SOURCE);
    } else {
        thumbnail.setSource(VaadinResourceManager.getResourceManager()
                .getImagePreviewResource(attachment.getThumbnail(), DEFAULT_SOURCE));
    }
    thumbnail.setWidth("100%");
    thumbnailWrap.addComponent(thumbnail);
    attachmentRow.addComponent(thumbnailWrap);

    if (lastIndex != -1) {
        docName = docName.substring(lastIndex + 1, docName.length());
    }

    if (MimeTypesUtil.isImageType(docName)) {
        Button b = new Button(attachment.getTitle(), new Button.ClickListener() {

            private static final long serialVersionUID = -1713187920922886934L;

            @Override
            public void buttonClick(Button.ClickEvent event) {
                AttachmentPreviewView previewView = new AttachmentPreviewView(VaadinResourceManager
                        .getResourceManager().getImagePreviewResource(attachment.getPath(), DEFAULT_SOURCE));
                EventBusFactory.getInstance().post(new ShellEvent.PushView(this, previewView));
            }
        });
        b.setWidth("100%");
        attachmentRow.addComponent(b);
        attachmentRow.setExpandRatio(b, 1.0f);
    } else {
        Label l = new Label(attachment.getTitle());
        l.setWidth("100%");
        attachmentRow.addComponent(l);
        attachmentRow.setExpandRatio(l, 1.0f);
    }
    return attachmentRow;
}

From source file:com.esofthead.mycollab.mobile.ui.MobileAttachmentUtils.java

License:Open Source License

public static Component renderAttachmentFieldRow(final Content attachment,
        Button.ClickListener additionalListener) {
    String docName = attachment.getPath();
    int lastIndex = docName.lastIndexOf("/");
    if (lastIndex != -1) {
        docName = docName.substring(lastIndex + 1, docName.length());
    }/*from www  . j  av  a  2 s .  c o  m*/

    final HorizontalLayout attachmentLayout = new HorizontalLayout();
    attachmentLayout.setSpacing(true);
    attachmentLayout.setStyleName("attachment-row");
    attachmentLayout.setWidth("100%");
    attachmentLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    CssLayout thumbnailWrap = new CssLayout();
    thumbnailWrap.setWidth("25px");
    thumbnailWrap.setHeight("40px");
    thumbnailWrap.setStyleName("thumbnail-wrap");

    Image thumbnail = new Image(null);
    if (org.apache.commons.lang3.StringUtils.isBlank(attachment.getThumbnail())) {
        thumbnail.setSource(DEFAULT_SOURCE);
    } else {
        thumbnail.setSource(VaadinResourceManager.getResourceManager()
                .getImagePreviewResource(attachment.getThumbnail(), DEFAULT_SOURCE));
    }
    thumbnail.setWidth("100%");
    thumbnailWrap.addComponent(thumbnail);
    attachmentLayout.addComponent(thumbnailWrap);

    Label attachmentLink = new Label(docName);
    attachmentLayout.addComponent(attachmentLink);
    attachmentLayout.setExpandRatio(attachmentLink, 1.0f);

    Button removeAttachment = new Button(
            "<span aria-hidden=\"true\" data-icon=\"" + IconConstants.DELETE + "\"></span>",
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(ClickEvent event) {

                    ConfirmDialog.show(UI.getCurrent(),
                            AppContext.getMessage(GenericI18Enum.CONFIRM_DELETE_ATTACHMENT),
                            AppContext.getMessage(GenericI18Enum.BUTTON_YES),
                            AppContext.getMessage(GenericI18Enum.BUTTON_NO), new ConfirmDialog.CloseListener() {
                                private static final long serialVersionUID = 1L;

                                @Override
                                public void onClose(ConfirmDialog dialog) {
                                    if (dialog.isConfirmed()) {
                                        ResourceService attachmentService = ApplicationContextUtil
                                                .getSpringBean(ResourceService.class);
                                        attachmentService.removeResource(attachment.getPath(),
                                                AppContext.getUsername(), AppContext.getAccountId());
                                        ((ComponentContainer) attachmentLayout.getParent())
                                                .removeComponent(attachmentLayout);
                                    }
                                }
                            });

                }
            });
    if (additionalListener != null) {
        removeAttachment.addClickListener(additionalListener);
    }
    removeAttachment.setHtmlContentAllowed(true);
    removeAttachment.setStyleName("link");
    attachmentLayout.addComponent(removeAttachment);

    return attachmentLayout;
}

From source file:com.esofthead.mycollab.ui.chart.GenericChartWrapper.java

License:Open Source License

final protected void displayChart() {
    removeAllComponents();//  w  w w  . jav  a 2 s  .  com
    final JFreeChart chart = createChart();
    final JFreeChartWrapper chartWrapper = new JFreeChartWrapper(chart);

    final CssLayout borderWrap = new CssLayout();
    borderWrap.addComponent(chartWrapper);
    borderWrap.setStyleName("chart-wrapper");
    borderWrap.setHeight(height + "px");
    borderWrap.setWidth(width + "px");
    chartWrapper.setHeight(height + "px");
    chartWrapper.setWidth(width + "px");
    chartWrapper.setGraphHeight(height);
    chartWrapper.setGraphWidth(width);
    this.addComponent(borderWrap);
    final Component legendBox = createLegendBox();
    if (legendBox != null) {
        this.addComponent(legendBox);
    }
}

From source file:com.mycollab.mobile.shell.view.MainView.java

License:Open Source License

public MainView() {
    super();// ww  w  . j  a  v  a 2 s . c o m
    this.setSizeFull();

    MVerticalLayout contentLayout = new MVerticalLayout().withStyleName("content-wrapper").withFullWidth();
    contentLayout.setDefaultComponentAlignment(Alignment.TOP_CENTER);

    Image mainLogo = new Image(null, new ThemeResource("icons/logo_m.png"));
    contentLayout.addComponent(mainLogo);

    Label introText = new Label(
            "MyCollab helps you do all your office jobs on the computers, phones and tablets you use");
    introText.setStyleName("intro-text");
    contentLayout.addComponent(introText);

    CssLayout welcomeTextWrapper = new CssLayout();
    welcomeTextWrapper.setStyleName("welcometext-wrapper");
    welcomeTextWrapper.setWidth("100%");
    welcomeTextWrapper.setHeight("15px");
    contentLayout.addComponent(welcomeTextWrapper);

    Button crmButton = new Button(UserUIContext.getMessage(GenericI18Enum.MODULE_CRM),
            clickEvent -> EventBusFactory.getInstance().post(new ShellEvent.GotoCrmModule(this, null)));
    crmButton.addStyleName(MobileUIConstants.BUTTON_ACTION);
    crmButton.setWidth("100%");

    contentLayout.addComponent(crmButton);

    Button pmButton = new Button(UserUIContext.getMessage(GenericI18Enum.MODULE_PROJECT),
            clickEvent -> EventBusFactory.getInstance().post(new ShellEvent.GotoProjectModule(this, null)));
    pmButton.setWidth("100%");
    pmButton.addStyleName(MobileUIConstants.BUTTON_ACTION);
    contentLayout.addComponent(pmButton);

    this.addComponent(contentLayout);
}

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);/* w  ww .  j a  v  a  2  s  .c o  m*/
    menuContent.setHeight("100%");

    menuContent.addComponent(buildTitle());
    menuContent.addComponent(buildUserMenu());
    menuContent.addComponent(buildToggleButton());
    menuContent.addComponent(new PFSearchBar());

    reloadFolderUI();
    //   menuContent.addComponent(buildMenuItems());
    menuContent.addComponent(folderUI);

    return menuContent;
}

From source file:edu.nps.moves.mmowgli.modules.maps.OpenLayersMap.java

License:Open Source License

public void initGuiTL() {
    setSpacing(true);//ww  w. ja  v a 2 s .c  om
    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);
}