Example usage for com.vaadin.ui Label setHeight

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

Introduction

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

Prototype

@Override
    public void setHeight(float height, Unit unit) 

Source Link

Usage

From source file:de.symeda.sormas.ui.dashboard.statistics.DashboardStatisticsSubComponent.java

License:Open Source License

public void addTwoColumnsMainContent(boolean showSeparator, int leftColumnPercentalWidth) {
    if (contentLayout == null) {
        contentLayout = new HorizontalLayout();
        contentLayout.setMargin(false);//www .j a  va 2 s  . c o  m
        contentLayout.setSpacing(true);
        contentLayout.setWidth(100, Unit.PERCENTAGE);
        contentLayout.setHeightUndefined();
        addComponent(contentLayout);
        contentLayout.setHeightUndefined();
        setExpandRatio(contentLayout, 1);

        leftContentColumnLayout = new VerticalLayout();
        leftContentColumnLayout.setMargin(false);
        leftContentColumnLayout.setWidth(100, Unit.PERCENTAGE);
        leftContentColumnLayout.setHeightUndefined();
        contentLayout.addComponent(leftContentColumnLayout);

        if (showSeparator) {
            Label separator = new Label();
            separator.setHeight(100, Unit.PERCENTAGE);
            CssStyles.style(separator, CssStyles.VR, CssStyles.HSPACE_LEFT_3, CssStyles.HSPACE_RIGHT_3);
            contentLayout.addComponent(separator);
        }

        rightContentColumnLayout = new VerticalLayout();
        rightContentColumnLayout.setMargin(false);
        rightContentColumnLayout.setWidth(100, Unit.PERCENTAGE);
        rightContentColumnLayout.setHeightUndefined();
        contentLayout.addComponent(rightContentColumnLayout);

        contentLayout.setExpandRatio(leftContentColumnLayout, leftColumnPercentalWidth);
        contentLayout.setExpandRatio(rightContentColumnLayout, 100 - leftColumnPercentalWidth);
    }
}

From source file:de.unioninvestment.eai.portal.portlet.crud.CrudUI.java

License:Apache License

/**
 * Erzeugt ein verstecktes HTML-Element mit der PortletPresenter-Window-ID
 * fr die Akzeptanztests.//  w ww  . j a  va  2s  .c  o  m
 * 
 * @param container
 */
private void addHiddenPortletId(ComponentContainer container) {
    Label labelForPortletId = new Label(getPortletId());
    labelForPortletId.setStyleName("crudPortletId");
    labelForPortletId.setHeight(0, AbstractComponent.UNITS_PIXELS);

    container.addComponent(labelForPortletId);

    Label labelForCommunityId = new Label(String.valueOf(getCommunityId()));
    labelForCommunityId.setStyleName("crudPortletCommunityId");
    labelForCommunityId.setHeight(0, AbstractComponent.UNITS_PIXELS);

    container.addComponent(labelForCommunityId);
}

From source file:dhbw.ka.mwi.businesshorizon2.ui.initialscreen.description.DescriptionViewImpl.java

License:Open Source License

/**
 * Diese Methode wird vom Presenter aufgerufen und ndert die Anzeige Texte.
 * // w  w  w. j  av a  2  s .  c  o m
 * @author Tobias Lindner
 * @param screen
 *       der aktuelle Schritt
 */
public void setTexts(screen e) {

    switch (e) {
    case METHODSELECTION:
        removeAllComponents();

        addComponent(getPrognoseMethodenInfos());
        Label gap = new Label();
        gap.setHeight(10, UNITS_PIXELS);
        addComponent(gap);
        addComponent(getEingabeMethodeInfo());
        Label gap2 = new Label();
        gap2.setHeight(10, UNITS_PIXELS);
        addComponent(getBerechnungsMethodeInfo());

        break;

    case PARAMETER:
        removeAllComponents();
        addComponent(getPrognoseMethodenInfos());
        break;

    case PERIODS:
        removeAllComponents();
        addComponent(getEingabeMethodeInfo());
        break;

    case SCENARIOS:
        removeAllComponents();
        addComponent(scenarioHeadline);
        addComponent(scenarioText);
        break;

    default:
        logger.debug("keine Case-bereinstimmung in setTexts");
        break;

    }
}

From source file:dhbw.ka.mwi.businesshorizon2.ui.initialscreen.projectlist.ProjectListViewImpl.java

License:Open Source License

/**
 * Konkrete Ausprogrammierung der Darstellung eines einzelnen Projekts.
 * Ein Projekt wird durch ein VerticalLayout dargestellt, das ein Label
 * mit dem Projektname enthlt. Auerdem bekommt es einen ClickListener,
 * um ein Projekt als selektiert zu kennzeichnen und die Details zum Projekt
 * anzuzeigen.//w w  w .  ja va  2s.co  m
 * 
 * @author Christian Scherer, Mirko Gpfrich, Marco Glaser
 * @param project
 *            das darzustellende Projekt und der aktuelle Index der Liste
 * @param i
 *            der Index der zu erstellenden Komponente (besonders fuer den
 *            Loeschbutton relevant)
 * @return ein VerticalLayout Objekt, das zur Eingliederung in das UI dient
 */
private VerticalLayout generateSingleProjectUI(Project project, int i) {

    final Project proj = project;
    final int a = i;
    //erzeugt eine Panel fr ein Projekt
    singleProject = new VerticalLayout();
    HorizontalLayout container = new HorizontalLayout();
    container.setSizeFull();
    if (i == 0) {
        singleProject.setStyleName("singleProjectSelected");
        presenter.projectSelected(project);
    } else {
        singleProject.setStyleName("singleProject");
    }
    Embedded icon = new Embedded(null,
            new ThemeResource("./images/icons/newIcons/1418828714_editor_open_folder-128.png"));
    icon.setHeight(40, UNITS_PIXELS);
    icon.setWidth(40, UNITS_PIXELS);
    Label gap1 = new Label();
    Label gap2 = new Label();
    Label gap3 = new Label();
    gap1.setWidth("15px");
    gap2.setWidth("15px");
    gap3.setSizeFull();
    Label projectName = new Label(project.getName());
    projectName.setWidth(Sizeable.SIZE_UNDEFINED, 0);
    projectName.setHeight(Sizeable.SIZE_UNDEFINED, 0);
    projectName.setStyleName("projectName");

    //Legt ein Layout fr das Projekt-Panel fest
    //panelContent.setSizeFull();
    container.addComponent(gap1);
    container.addComponent(icon);
    container.addComponent(gap2);
    container.addComponent(projectName);
    container.addComponent(gap3);
    container.setExpandRatio(gap3, 1.0f);

    singleProject.addComponent(container);
    singleProject.setWidth(100, UNITS_PERCENTAGE);
    singleProject.setHeight(70, UNITS_PIXELS);
    container.setComponentAlignment(icon, Alignment.MIDDLE_CENTER);
    container.setComponentAlignment(projectName, Alignment.MIDDLE_CENTER);

    singleProject.addListener(new LayoutClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void layoutClick(LayoutClickEvent event) {
            presenter.projectSelected(proj);
            switchProjectsStyle(a);

            eventBus.fireEvent(new SelectProjectEvent());
        }

    });

    //      singleProject.addListener(this);
    //      projectListPanel.addComponent(singleProject);
    logger.debug("Einzelnes Projektelement erzeugt");

    return singleProject;
}

From source file:dhbw.ka.mwi.businesshorizon2.ui.scenarioscreen.ScenarioScreenViewImpl.java

License:Open Source License

/**
 * Die Methode fuegt der View ein Szenario hinzu. Sie baut hierzu saemtliche
 * notwendigen GUI-Elemente und entsprechenden Listener hinzu.
 * //from w  w w  .  j  a  v a  2s . com
 * Auf ein GridLayout umgestellt.
 * 
 * @author Julius Hacker, Tobias Lindner
 * @param rateReturnEquity Standardwert fuer die Renditeforderung Eigenkapital
 * @param rateReturnCapitalStock Standardwert fuer die Renditeforderung Fremdkapital
 * @param businessTax Standardwert fuer die Gewerbesteuer
 * @param corporateAndSolitaryTax Standardwert fuer die Koerperschaftssteuer mit Solidaritaetszuschlag.
 */

@Override
public void addScenario(String rateReturnEquity, String rateReturnCapitalStock, String corporateAndSolitaryTax,
        String businessTax, String personalTaxRate, boolean isIncludeInCalculation, final int number) {
    HashMap<String, AbstractComponent> scenarioComponents = new HashMap<String, AbstractComponent>();

    Property.ValueChangeListener changeListener = new Property.ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            presenter.updateScenario(number);
            logger.debug("TextChange ausgeloest");
            logger.debug("ChangeListener " + System.identityHashCode(this));
            presenter.isValid();
        }
    };

    final GridLayout gl = new GridLayout(3, 7);
    gl.addStyleName("gridLayoutScenarios");
    gl.setSizeFull();
    gl.setColumnExpandRatio(0, 2);
    gl.setColumnExpandRatio(1, 1);
    gl.setColumnExpandRatio(2, 1);

    final Label scenarioName = new Label("<strong>Szenario " + number + "</strong>");
    scenarioName.setContentMode(Label.CONTENT_XHTML);
    scenarioComponents.put("label", scenarioName);

    logger.debug("SzenarioName: " + scenarioName);
    gl.addComponent(scenarioName, 0, 0);

    //EK Rendite
    final Label textEigenkapital = new Label("Renditeforderung Eigenkapital: ");
    textEigenkapital.setSizeFull();

    final TextField tfEigenkapital = new TextField();

    if (!"0.0".equals(rateReturnEquity)) {
        tfEigenkapital.setValue(rateReturnEquity);
    }

    tfEigenkapital.setImmediate(true);
    tfEigenkapital.addStyleName("scenario");
    tfEigenkapital.addListener(changeListener);

    gl.addComponent(textEigenkapital, 0, 1);
    gl.addComponent(tfEigenkapital, 1, 1);

    scenarioComponents.put("rateReturnEquity", tfEigenkapital);

    // Fremdkapital      
    final Label textFremdkapitel = new Label("Renditeforderung FK: ");

    final TextField tfFremdkapital = new TextField();

    if (!"0.0".equals(rateReturnCapitalStock)) {
        tfFremdkapital.setValue(rateReturnCapitalStock);
    }

    tfFremdkapital.setImmediate(true);
    tfFremdkapital.addStyleName("scenario");
    tfFremdkapital.addListener(changeListener);

    gl.addComponent(textFremdkapitel, 0, 2);
    gl.addComponent(tfFremdkapital, 1, 2);

    scenarioComponents.put("rateReturnCapitalStock", tfFremdkapital);

    //Gewerbesteuer
    final Label textGewerbesteuer = new Label("Gewerbesteuer:");
    final TextField tfGewerbesteuer = new TextField();

    if (!"0.0".equals(businessTax)) {
        tfGewerbesteuer.setValue(businessTax);
    }

    tfGewerbesteuer.setImmediate(true);
    tfGewerbesteuer.addStyleName("scenario");
    tfGewerbesteuer.addListener(changeListener);

    gl.addComponent(textGewerbesteuer, 0, 3);
    gl.addComponent(tfGewerbesteuer, 1, 3);

    scenarioComponents.put("businessTax", tfGewerbesteuer);

    //Krperschaftssteuer
    final Label textKoerperschaftssteuer = new Label("Krperschaftssteuer mit Solidarittszuschlag: ");

    final TextField tfKoerperschaftssteuer = new TextField();

    if (!"0.0".equals(corporateAndSolitaryTax)) {
        tfKoerperschaftssteuer.setValue(corporateAndSolitaryTax);
    }

    tfKoerperschaftssteuer.setImmediate(true);
    tfKoerperschaftssteuer.addStyleName("scenario");
    tfKoerperschaftssteuer.addListener(changeListener);

    gl.addComponent(textKoerperschaftssteuer, 0, 4);
    gl.addComponent(tfKoerperschaftssteuer, 1, 4);

    scenarioComponents.put("corporateAndSolitaryTax", tfKoerperschaftssteuer);

    // Persnlicher Steuersatz
    final Label textPersonalTaxRate = new Label("pers\u00F6nlicher Steuersatz: ");
    final TextField tfPersonalTaxRate = new TextField();
    if (!"0.0".equals(personalTaxRate)) {
        tfPersonalTaxRate.setValue(personalTaxRate);
    }
    tfPersonalTaxRate.setImmediate(true);
    tfPersonalTaxRate.addStyleName("scenario");
    tfPersonalTaxRate.addListener(changeListener);

    gl.addComponent(textPersonalTaxRate, 0, 5);
    gl.addComponent(tfPersonalTaxRate, 1, 5);

    scenarioComponents.put("personalTaxRate", tfPersonalTaxRate);

    deleteIcon = new Embedded(null,
            new ThemeResource("./images/icons/newIcons/1418766003_editor_trash_delete_recycle_bin_-128.png"));
    deleteIcon.setHeight(60, UNITS_PIXELS);
    deleteIcon.addStyleName("deleteScenario");

    deleteIcon.addListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void click(ClickEvent event) {
            presenter.removeScenario(number);
        }

    });

    gl.addComponent(deleteIcon, 2, 0, 2, 6);
    gl.setComponentAlignment(deleteIcon, Alignment.MIDDLE_CENTER);

    final Label gap = new Label();
    gap.setHeight(20, UNITS_PIXELS);

    gl.addComponent(gap, 0, 6);

    scenarioComponents.put("scenario", gl);

    this.scenarios.add(scenarioComponents);
    this.vlScenarios.addComponent(gl);

    //Button bei 3 Scenarios deaktivieren
    if (number == 3) {
        deactivateAddScenario();
    }
}

From source file:edu.nps.moves.mmowgli.modules.cards.CardSummaryLine.java

License:Open Source License

@Override
public void initGui() {
    Card c = Card.getTL(cardId);/*www  .  j a va 2s.  c om*/
    String tooltip = c.getText();

    User auth = c.getAuthor();

    Label lab = new Label(dateForm.format(c.getCreationDate()));
    lab.setWidth(6.0f, Unit.EM);
    addComponent(lab);
    setComponentAlignment(lab, Alignment.MIDDLE_LEFT);
    lab.addStyleName("m-cursor-pointer");
    lab.setDescription(tooltip);

    addComponent(lab = new Label(c.getCardType().getTitle()));
    lab.setWidth(5.0f, Unit.EM);
    setComponentAlignment(lab, Alignment.MIDDLE_LEFT);
    lab.addStyleName("m-cursor-pointer");
    lab.setDescription(tooltip);

    MediaLocator mLoc = Mmowgli2UI.getGlobals().getMediaLocator();
    Embedded emb = new Embedded(null, mLoc.getCardDot(c.getCardType()));
    emb.setWidth("19px");
    emb.setHeight("15px");
    addComponent(emb);
    setComponentAlignment(emb, Alignment.MIDDLE_LEFT);
    emb.addStyleName("m-cursor-pointer");
    emb.setDescription(tooltip);

    addComponent(lab = new Label(c.getText()));
    lab.setHeight(1.0f, Unit.EM);
    ;
    setComponentAlignment(lab, Alignment.MIDDLE_LEFT);
    setExpandRatio(lab, 1.0f); // all the extra
    lab.addStyleName("m-cursor-pointer");
    lab.setDescription(tooltip);

    if (auth.getAvatar() != null) {
        avatar = new Embedded(null, mLoc.locate(auth.getAvatar().getMedia(), 32));
        avatar.setWidth("24px");
        avatar.setHeight("24px");
        addComponent(avatar);
        setComponentAlignment(avatar, Alignment.MIDDLE_LEFT);
        avatar.addStyleName("m-cursor-pointer");
        avatar.setDescription(tooltip);
    }
    IDButton uButt = new IDButton(c.getAuthorName(), SHOWUSERPROFILECLICK, c.getAuthor().getId());
    uButt.addStyleName(BaseTheme.BUTTON_LINK);
    uButt.setWidth(8.0f, Unit.EM);
    addComponent(uButt);
    setComponentAlignment(uButt, Alignment.MIDDLE_LEFT);
    uButt.setDescription(tooltip);
}

From source file:io.subutai.plugin.accumulo.ui.wizard.WelcomeStep.java

public WelcomeStep(final Wizard wizard) {

    setSizeFull();/*from  www. jav a2s.com*/

    GridLayout grid = new GridLayout(10, 6);
    grid.setSpacing(true);
    grid.setMargin(true);
    grid.setSizeFull();

    Label welcomeMsg = new Label("<center><h2>Welcome to Accumulo Installation Wizard!</h2>");
    welcomeMsg.setContentMode(ContentMode.HTML);
    grid.addComponent(welcomeMsg, 3, 1, 6, 2);

    Label logoImg = new Label();
    // Image as a file resource
    logoImg.setIcon(new FileResource(FileUtil.getFile(AccumuloPortalModule.MODULE_IMAGE, this)));
    logoImg.setContentMode(ContentMode.HTML);
    logoImg.setHeight(56, Unit.PIXELS);
    logoImg.setWidth(220, Unit.PIXELS);
    grid.addComponent(logoImg, 1, 3, 2, 5);

    Button startOverHadoopNZK = new Button("Start over Hadoop & ZK installation");
    startOverHadoopNZK.setId("startOverHadoopNZK");
    startOverHadoopNZK.addStyleName("default");
    grid.addComponent(startOverHadoopNZK, 4, 4, 4, 4);
    grid.setComponentAlignment(startOverHadoopNZK, Alignment.BOTTOM_RIGHT);

    startOverHadoopNZK.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            wizard.init();
            wizard.getConfig().setSetupType(SetupType.OVER_HADOOP_N_ZK);
            wizard.next();
        }
    });

    setContent(grid);
}

From source file:org.jumpmind.vaadin.ui.common.CommonUiUtils.java

License:Open Source License

public static Label createSeparator() {
    Label separator = new Label(" ");
    separator.setStyleName("vrule");
    separator.setHeight(100, Unit.PERCENTAGE);
    separator.setWidthUndefined();//from w w w .j av  a  2 s.c om
    return separator;
}

From source file:org.lucidj.browser.AbstractCell.java

License:Apache License

private Component build_insert_here() {
    Label message = new Label("Drag or double-click any component to add one or more here");
    // TODO: FIX WRONG TEXT-WRAPPING WHEN CELL TOO NARROW
    message.addStyleName("formula-insert-here");
    message.setHeight(64, Sizeable.Unit.PIXELS);
    message.setWidth(100, Sizeable.Unit.PERCENTAGE);
    return (message);
}

From source file:org.opennms.netmgt.bsm.vaadin.adminpage.BusinessServiceMainLayout.java

License:Open Source License

public BusinessServiceMainLayout(BusinessServiceManager businessServiceManager) {
    m_businessServiceManager = Objects.requireNonNull(businessServiceManager);
    m_table = new BusinessServiceTreeTable(businessServiceManager);

    setSizeFull();/*from  ww  w  .j  a v a2s  . com*/

    // Create button
    final Button createButton = UIHelper.createButton("New Business Service", null, FontAwesome.PLUS_SQUARE,
            (Button.ClickListener) event -> {
                final BusinessService businessService = m_businessServiceManager.createBusinessService();
                final BusinessServiceEditWindow window = new BusinessServiceEditWindow(businessService,
                        m_businessServiceManager);
                window.addCloseListener(e -> m_table.refresh());
                getUI().addWindow(window);
            });
    createButton.setId("createButton");

    // Collapse all
    final Button collapseButton = UIHelper.createButton("Collapse All", null, FontAwesome.FOLDER,
            (Button.ClickListener) event -> {
                m_table.getContainerDataSource().getItemIds().forEach(id -> m_table.setCollapsed(id, true));
            });
    collapseButton.setId("collapseButton");

    // Expand all
    final Button expandButton = UIHelper.createButton("Expand All", null, FontAwesome.FOLDER_OPEN,
            (Button.ClickListener) event -> {
                m_table.getContainerDataSource().getItemIds().forEach(id -> m_table.setCollapsed(id, false));
            });
    expandButton.setId("expandButton");

    // Refresh
    final Button refreshButton = UIHelper.createButton("Refresh Table", null, FontAwesome.REFRESH,
            (Button.ClickListener) event -> {
                m_table.refresh();
            });
    refreshButton.setId("refreshButton");

    // Reload daemon
    final Button reloadButton = UIHelper.createButton("Reload Daemon",
            "Reloads the Business Service State Machine", FontAwesome.RETWEET, (Button.ClickListener) event -> {
                m_businessServiceManager.triggerDaemonReload();
            });
    reloadButton.setId("reloadButton");

    // Group the create and collapse buttons on the left
    HorizontalLayout leftButtonGroup = new HorizontalLayout();
    leftButtonGroup.setSpacing(true);
    leftButtonGroup.addComponent(createButton);
    leftButtonGroup.addComponent(collapseButton);
    leftButtonGroup.addComponent(expandButton);
    leftButtonGroup.setDefaultComponentAlignment(Alignment.TOP_LEFT);

    // Group the refresh and reload buttons to the right
    HorizontalLayout rightButtonGroup = new HorizontalLayout();
    rightButtonGroup.setSpacing(true);
    rightButtonGroup.addComponent(refreshButton);
    rightButtonGroup.addComponent(reloadButton);
    rightButtonGroup.setDefaultComponentAlignment(Alignment.TOP_RIGHT);

    // Build the upper layout
    HorizontalLayout upperLayout = new HorizontalLayout();
    upperLayout.setSpacing(true);
    upperLayout.addComponent(leftButtonGroup);
    upperLayout.addComponent(rightButtonGroup);
    upperLayout.setComponentAlignment(leftButtonGroup, Alignment.TOP_LEFT);
    upperLayout.setComponentAlignment(rightButtonGroup, Alignment.TOP_RIGHT);
    upperLayout.setWidth(100, Unit.PERCENTAGE);
    addComponent(upperLayout);

    // Add some space between the upper layout and the table
    Label sz = new Label("");
    sz.setWidth(null);
    sz.setHeight(5, Unit.PIXELS);
    addComponent(sz);

    /**
     * add the table to the layout
     */
    addComponent(m_table);
    setExpandRatio(m_table, 1.0f);

    /**
     * initial refresh of table
     */
    m_table.refresh();
}