Example usage for com.vaadin.ui Label setSizeFull

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

Introduction

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

Prototype

@Override
    public void setSizeFull() 

Source Link

Usage

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  v  a  2s. c  o  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.
 * //w ww.  j a  v  a 2s  .  c om
 * 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.kit.dama.ui.admin.MainControlPanel.java

License:Apache License

/**
 * Create a new cell for the UI. Each cell contains an image located in the
 * provided resource and a help label for the cell adverse to it.
 * Furthermore, a style is provided which can be 'help-left' or 'help-right'
 * depending on which side the help text should be aligned (help in left col
 * -> align right)./*from   ww  w  .  j  av a  2s . c o  m*/
 *
 * @param pResourceString The image resource string.
 * @param The alignment of the image (TOP_LEFT or TOP_RIGHT, depending on
 * the column)
 * @param cellNumber The cell number (0-3) counting from top left to bottom
 * right
 * @param pHelp The help string which may contain HTML tags.
 * @param pStyle The help label style ('help-left' or 'help-right').
 *
 * @return The cell layout.
 */
private VerticalLayout createCell(String pResourceString, Alignment pAlignment, int cellNumber, String pHelp,
        String pStyle) {
    final String cellHeight = "132px";
    //create the cell image
    Image cellImage = new Image(null, new ThemeResource(pResourceString));
    cellImage.addStyleName("border");

    //create the cell image wrapper, which provides the shadow and this show/hide functionality
    VerticalLayout imageWrapper = new VerticalLayout(cellImage);
    imageWrapper.addComponent(cellImage);
    imageWrapper.setComponentAlignment(cellImage, Alignment.MIDDLE_CENTER);
    imageWrapper.setWidth(cellHeight);
    imageWrapper.setHeight(cellHeight);
    imageWrapper.addStyleName("shadow");
    imageWrapper.addStyleName("visible");

    //help label for the cell adverse to the current cell
    Label oppositeCellHelp = new Label(pHelp, ContentMode.HTML);
    oppositeCellHelp.addStyleName(pStyle);
    oppositeCellHelp.setSizeFull();
    oppositeCellHelp.addStyleName("invisible");
    oppositeCellHelp.setHeight(cellHeight);

    //the cell layout containing image and help label
    VerticalLayout cell = new VerticalLayout();
    cell.addComponent(imageWrapper);
    cell.setComponentAlignment(imageWrapper, pAlignment);
    cell.setMargin(true);
    cell.addComponent(oppositeCellHelp);
    cell.setComponentAlignment(oppositeCellHelp, Alignment.MIDDLE_CENTER);

    //define component ids depending on the provided cell number
    //---------
    //| 0 | 1 |
    //| 2 | 3 |
    //---------
    //Each cell gets the id 'image<cellNumber>'
    //The currently created wrapper and help label are getting the cellId of the adverse cell (0 -> 1, 1 -> 0, 2 -> 3, 3 -> 2).
    //These ids are used then by edu.kit.dama.ui.admin.client.HelpConnector to show/hide elements on mouse over.
    switch (cellNumber) {
    case 0:
        cellImage.setId("image0");
        //this cell contains the help for cell 1
        imageWrapper.setId("image1_wrapper");
        oppositeCellHelp.setId("image1_help");
        break;
    case 1:
        cellImage.setId("image1");
        //this cell contains the help for cell 0
        imageWrapper.setId("image0_wrapper");
        oppositeCellHelp.setId("image0_help");
        break;
    case 2:
        cellImage.setId("image2");
        //this cell contains the help for cell 3
        imageWrapper.setId("image3_wrapper");
        oppositeCellHelp.setId("image3_help");
        break;
    case 3:
        cellImage.setId("image3");
        //this cell contains the help for cell 2
        imageWrapper.setId("image2_wrapper");
        oppositeCellHelp.setId("image2_help");
        break;
    }
    //link the HelpExtension to the image
    new HelpExtension().extend(cellImage);
    return cell;
}

From source file:edu.kit.dama.ui.admin.wizard.IntroductionStep.java

License:Apache License

@Override
public void buildMainLayout() {
    Label introduction = new Label(
            "Welcome to your new repository system installation. This wizard will guide you through the initial setup of your system. "
                    + "If you need more information about the underlying repository framework please visit the <a href='http://datamanager.kit.edu'>KIT Data Manager Homepage</a><br/>"
                    + "This wizard is organized in multiple steps. You may switch between completed steps back and forth. If all information are collected, you can finish the wizard. "
                    + "This is the moment where all collected data is written to the database. You will be redirected to the login page where you can login using the created administrator account or"
                    + "you can create a user account for yourself and login with this account.",
            ContentMode.HTML);/* www. j  a va2s .  co m*/
    introduction.setSizeFull();
    getMainLayout().addComponent(introduction);
    getMainLayout().setComponentAlignment(introduction, Alignment.MIDDLE_CENTER);
}

From source file:fr.amapj.view.engine.grid.booleangrid.PopupBooleanGrid.java

License:Open Source License

private void constructHeaderLine(VerticalLayout mainLayout, GridHeaderLine line) {
    HorizontalLayout header1 = new HorizontalLayout();
    if (line.height != -1) {
        header1.setHeight(line.height + "px");
    }//from   ww  w  . j  a  va 2s  .c  o  m

    int index = 0;
    for (String str : line.cells) {
        Label dateLabel = new Label(str);
        dateLabel.setSizeFull();
        if (line.styleName != null) {
            dateLabel.addStyleName(line.styleName);
        }

        if (index == 0) {
            dateLabel.setWidth((param.largeurCol + 5) + "px");
        } else {
            dateLabel.setWidth((param.largeurCol + 2) + "px");
        }

        header1.addComponent(dateLabel);
        index++;

    }
    mainLayout.addComponent(header1);
}

From source file:fr.amapj.view.engine.grid.currencyvector.PopupCurrencyVector.java

License:Open Source License

private Label fillFooter(HorizontalLayout footer1, String message, int montantCible) {

    Label dateLabel = new Label(message);
    dateLabel.addStyleName("prix");
    dateLabel.setSizeFull();
    footer1.addComponent(dateLabel);// w  w w.  j  a  va2 s . co m
    footer1.setExpandRatio(dateLabel, 1.0f);

    Label prixTotal = new Label(new CurrencyTextFieldConverter().convertToString(montantCible));
    prixTotal.addStyleName("prix");
    prixTotal.setSizeFull();
    footer1.addComponent(prixTotal);
    footer1.setExpandRatio(prixTotal, 1.0f);

    return prixTotal;
}

From source file:fr.amapj.view.engine.grid.currencyvector.PopupCurrencyVector.java

License:Open Source License

private void constructHeaderLine(VerticalLayout mainLayout, GridHeaderLine line) {
    HorizontalLayout header1 = new HorizontalLayout();
    header1.setWidth(getLargeurTotal());
    if (line.height != -1) {
        header1.setHeight(line.height + "px");
    }/*from   w w  w.jav  a 2s  .  c  o m*/

    for (String str : line.cells) {
        Label dateLabel = new Label(str);
        if (line.styleName != null) {
            dateLabel.addStyleName(line.styleName);
        }
        header1.addComponent(dateLabel);
        dateLabel.setSizeFull();
        header1.setExpandRatio(dateLabel, 1.0f);
    }
    mainLayout.addComponent(header1);
}

From source file:fr.amapj.view.engine.grid.integergrid.PopupIntegerGrid.java

License:Open Source License

private void constructHeaderLine(VerticalLayout mainLayout, GridHeaderLine line) {
    HorizontalLayout header1 = new HorizontalLayout();
    if (line.height != -1) {
        header1.setHeight(line.height + "px");
    }// w w w  .j a v  a2 s  .c  o m

    int index = 0;
    for (String str : line.cells) {
        Label dateLabel = new Label(str);
        dateLabel.setSizeFull();
        if (line.styleName != null) {
            dateLabel.addStyleName(line.styleName);
        }
        if (index == 0) {
            dateLabel.setWidth((param.leftPartLineLargeur + 5) + "px");
        } else {
            dateLabel.setWidth((param.largeurCol + 2) + "px");
        }

        header1.addComponent(dateLabel);

        index++;
    }
    mainLayout.addComponent(header1);
}

From source file:fr.amapj.view.views.permanence.grille.BlocGrilleDrawer.java

License:Open Source License

private void draw(VerticalLayout contentLayout, BlocGrille bloc, SizeInfo sizeInfo,
        AbstractPeriodePermanenceGrillePart grillePart) {

    // Le titre/*from   www . j  av a  2 s.c  o  m*/
    HorizontalLayout header1 = new HorizontalLayout();
    Label l = new Label(bloc.titre);
    l.addStyleName(bloc.styleTitre);
    l.setWidth("400px");
    header1.addComponent(l);
    contentLayout.addComponent(header1);

    //
    for (int i = 0; i < bloc.lines.size(); i++) {
        BlocGrilleLine pc = bloc.lines.get(i);
        header1 = new HorizontalLayout();

        header1.setHeight(sizeInfo.heights[i] + "px");

        Label l1 = new Label(pc.col1);
        l1.setSizeFull();
        l1.addStyleName(pc.styleCol1);
        l1.setWidth("200px");
        header1.addComponent(l1);

        Label l2 = new Label(pc.col2);
        l2.setSizeFull();
        l2.addStyleName(pc.styleCol2);
        l2.setWidth("200px");
        header1.addComponent(l2);

        contentLayout.addComponent(header1);
    }

    // On place ensuite un rectangle vide pour permettre l'alignement des boutons
    int h = computeHeightAdditionalSpace(sizeInfo, bloc.lines.size());
    if (h != 0) {
        header1 = new HorizontalLayout();
        header1.setHeight(h + "px");
        contentLayout.addComponent(header1);
    }

    // La partie specifique
    Layout layout = grillePart.addSpecificButton(bloc.date);
    if (layout != null) {
        contentLayout.addComponent(layout);
    }

}

From source file:fr.univlorraine.mondossierweb.views.AdressesView.java

License:Apache License

private void formatLabel(Label label, String caption, String value) {
    if (StringUtils.hasText(caption)) {
        label.setCaption(caption);/*from ww w.  ja  v  a  2 s . c  om*/
    }
    if (StringUtils.hasText(value)) {
        label.setValue("<b>" + value + "</b");
        label.setContentMode(ContentMode.HTML);
    }
    label.setSizeFull();
}