Example usage for com.vaadin.ui Label setWidth

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

Introduction

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

Prototype

@Override
    public void setWidth(float width, Unit unit) 

Source Link

Usage

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

License:Open Source License

public void setPageDescription(String source, String page, String[] description) {
    int labelCount = descriptionLayout.getComponentCount();
    Label oldLabel;//from w w  w . j  av a2s. co  m
    int i;
    homeIcon.setSource(new ThemeResource(source));
    seitenLabel.setValue(page);
    for (i = 0; i < labelCount && i < description.length; i++) {
        oldLabel = (Label) descriptionLayout.getComponent(i);
        oldLabel.setValue(description[i]);
        if (i == 0) {
            descriptionLayout.setComponentAlignment(oldLabel, Alignment.BOTTOM_CENTER);
        } else {
            descriptionLayout.setComponentAlignment(oldLabel, Alignment.TOP_CENTER);
        }
    }
    //      descriptionLabel.setValue(description[0]);
    for (int a = i; a < description.length; a++) {
        Label newLabel = new Label(description[a]);
        newLabel.setStyleName("descriptionLabel");
        newLabel.setWidth(Sizeable.SIZE_UNDEFINED, 0);
        descriptionLayout.addComponent(newLabel);
        descriptionLayout.setComponentAlignment(newLabel, Alignment.TOP_CENTER);
    }
    for (int b = i; b < labelCount; b++) {
        descriptionLayout.removeComponent(descriptionLayout.getComponent(b));
    }
}

From source file:dhbw.ka.mwi.businesshorizon2.ui.process.scenario.ScenarioViewImpl.java

License:Open Source License

/**
 * Die Methode fuegt der View ein Szenario hinzu. Sie baut hierzu saemtliche
 * notwendigen GUI-Elemente und entsprecheenden Listener hinzu.
 * //from  w w  w  .ja v a 2s.  c  o  m
 * @author Julius Hacker
 * @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, 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));
        }
    };

    HorizontalLayout hlScenario = new HorizontalLayout();
    hlScenario.setSizeFull();

    FormLayout formLeft = new FormLayout();
    FormLayout formRight = new FormLayout();
    hlScenario.addComponent(formLeft);
    //hlScenario.addComponent(formRight);

    final Label scenarioName = new Label("<strong>Szenario " + number + "</strong>");
    scenarioName.setContentMode(Label.CONTENT_XHTML);
    scenarioComponents.put("label", scenarioName);
    formLeft.addComponent(scenarioName);
    scenarioName.setWidth(Sizeable.SIZE_UNDEFINED, 0);

    final CheckBox cbBerechnungEinbezug = new CheckBox("In Berechnung einbeziehen");
    cbBerechnungEinbezug.setValue(isIncludeInCalculation);
    cbBerechnungEinbezug.setImmediate(true);
    cbBerechnungEinbezug.addListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            presenter.updateScenario(number);
            logger.debug("ChangeListener " + System.identityHashCode(this));
        }

    });
    scenarioComponents.put("isIncludeInCalculation", cbBerechnungEinbezug);
    formLeft.addComponent(cbBerechnungEinbezug);

    final TextField tfEigenkapital = new TextField("Renditeforderung Eigenkapital: ");
    if (!"0.0".equals(rateReturnEquity)) {
        tfEigenkapital.setValue(rateReturnEquity);
    }
    tfEigenkapital.setImmediate(true);
    tfEigenkapital.addListener(changeListener);
    scenarioComponents.put("rateReturnEquity", tfEigenkapital);
    formLeft.addComponent(tfEigenkapital);

    final TextField tfFremdkapital = new TextField("Renditeforderung Fremdkapital: ");
    if (!"0.0".equals(rateReturnCapitalStock)) {
        tfFremdkapital.setValue(rateReturnCapitalStock);
    }
    tfFremdkapital.setImmediate(true);
    tfFremdkapital.addListener(changeListener);
    scenarioComponents.put("rateReturnCapitalStock", tfFremdkapital);
    formLeft.addComponent(tfFremdkapital);

    final TextField tfGewerbesteuer = new TextField("Gewerbesteuer: ");
    if (!"0.0".equals(businessTax)) {
        tfGewerbesteuer.setValue(businessTax);
    }
    tfGewerbesteuer.setImmediate(true);
    tfGewerbesteuer.addListener(changeListener);
    scenarioComponents.put("businessTax", tfGewerbesteuer);
    formLeft.addComponent(tfGewerbesteuer);

    final TextField tfKoerperschaftssteuer = new TextField(
            "K\u00F6rperschaftssteuer mit Solidarit\u00E4tszuschlag: ");
    if (!"0.0".equals(corporateAndSolitaryTax)) {
        tfKoerperschaftssteuer.setValue(corporateAndSolitaryTax);
    }
    tfKoerperschaftssteuer.setImmediate(true);
    tfKoerperschaftssteuer.addListener(changeListener);
    scenarioComponents.put("corporateAndSolitaryTax", tfKoerperschaftssteuer);
    formLeft.addComponent(tfKoerperschaftssteuer);

    final Button removeScenario = new Button("Szenario entfernen");
    removeScenario.addListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

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

    });
    formLeft.addComponent(removeScenario);

    formLeft.setWidth(Sizeable.SIZE_UNDEFINED, 0);
    formLeft.setWidth(Sizeable.SIZE_UNDEFINED, 0);

    scenarioComponents.put("scenario", hlScenario);

    this.scenarios.add(scenarioComponents);
    this.vlScenarios.addComponent(hlScenario);
}

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

License:Open Source License

@Override
public void initGui() {
    Card c = Card.getTL(cardId);/*from  w w w  .j av a2s .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:edu.nps.moves.mmowgli.modules.cards.IdeaDashboardTabPanel.java

License:Open Source License

protected HorizontalLayout makeTableHeaders() {
    HorizontalLayout titleHL = new HorizontalLayout();
    titleHL.setSpacing(true);//www.  j a va  2 s .  c o  m
    titleHL.setWidth("100%");
    Label lab;
    lab = buildTitleLabel(titleHL, "<center>Creation<br/>Date</center>");
    lab.setWidth(4.0f, Unit.EM);
    lab = buildTitleLabel(titleHL, "<center>Card<br/>Type</center>");
    lab.setWidth(6.0f, Unit.EM);
    lab = buildTitleLabel(titleHL, "Text");
    titleHL.setExpandRatio(lab, 1.0f);
    lab = buildTitleLabel(titleHL, "Author");
    lab.setWidth(8.0f, Unit.EM);
    return titleHL;
}

From source file:edu.nps.moves.mmowgli.modules.userprofile.UserProfileTabPanel.java

License:Open Source License

protected HorizontalLayout makeTableHeaders() {
    HorizontalLayout titleHL = new HorizontalLayout();
    titleHL.setSpacing(true);//from  ww w  .j  av a 2 s.c o  m
    titleHL.setWidth("100%");
    Label lab;
    lab = buildTitleLabel(titleHL, "<center>Creation<br/>Date</center>");
    lab.setWidth(4.0f, Sizeable.Unit.EM);
    lab = buildTitleLabel(titleHL, "<center>Card<br/>Type</center>");
    lab.setWidth(6.0f, Sizeable.Unit.EM);
    lab = buildTitleLabel(titleHL, "Text");
    titleHL.setExpandRatio(lab, 1.0f);
    lab = buildTitleLabel(titleHL, "Author");
    lab.setWidth(8.0f, Sizeable.Unit.EM);
    return titleHL;
}

From source file:gms.demo.service.presentation.ui.CreateMemberInfoPanel.java

License:Open Source License

CreateMemberInfoPanel(MainUI app) {
    this.app = app;

    // createButton form and data source
    Form form = new Form();
    form.setCaption("Create New MemberInfo");
    form.setWriteThrough(false);/*from  w w  w  .java  2s.  c  om*/
    form.setItemDataSource(propertysetItem);

    // validation
    // todo: more of these
    form.getField(PORT).addValidator(new IntegerValidator(PORT + " field must be an integer."));

    // buttons
    createButton = new Button("Create", form, "commit");
    Button resetButton = new Button("Reset", form, "discard");
    cancelButton = new Button("Cancel");
    form.getFooter().addComponent(createButton);
    form.getFooter().addComponent(resetButton);
    form.getFooter().addComponent(cancelButton);
    form.setWidth(24f, Sizeable.UNITS_EM);

    // explanatory text
    Label instructions = new Label(INSTRUCTIONS_TEXT, Label.CONTENT_XHTML);
    instructions.setWidth(24f, Sizeable.UNITS_EM);

    // now add to panel
    HorizontalLayout hLayout = new HorizontalLayout();
    hLayout.setSpacing(true);
    hLayout.addComponent(form);
    hLayout.addComponent(instructions);
    hLayout.setComponentAlignment(instructions, Alignment.MIDDLE_LEFT);
    addComponent(hLayout);
}

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

public WelcomeStep(final Wizard wizard) {

    setSizeFull();//from   w  w  w  .j  av  a 2 s  .  c om

    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:it.vige.greenarea.bpm.custom.ui.LoginPanel.java

License:Apache License

private void initGuidonia() {
    HorizontalLayout panel = new HorizontalLayout();
    panel.setHeight(90, UNITS_PIXELS);/*from www.  ja  v a  2s.c o  m*/
    Label title = new Label();
    title.addStyleName(LABEL_H1);
    title.setWidth(80, UNITS_PIXELS);

    if (get().getEnvironment().equals(ALFRESCO)) {
        title.addStyleName(STYLE_WORKFLOW_CONSOLE_LOGO);
    } else {
        title.addStyleName(STYLE_APPLICATION_MINI_GUIDONIA);
    }
    Label city = new Label();
    city.addStyleName(LABEL_H1);
    city.setValue(i18nManager.getMessage(GUIDONIA_TITLE));
    city.addStyleName(STYLE_APPLICATION_TITLE_GUIDONIA);
    city.setWidth(310, UNITS_PIXELS);

    panel.addComponent(title);
    panel.addComponent(city);

    sperimentazioni.addComponent(panel);
}

From source file:it.vige.greenarea.bpm.custom.ui.LoginPanel.java

License:Apache License

private void initLivorno() {
    HorizontalLayout panel = new HorizontalLayout();
    panel.setHeight(90, UNITS_PIXELS);/*from   w w  w  . jav a2 s .c  o m*/
    Label title = new Label();
    title.addStyleName(LABEL_H1);
    title.setWidth(80, UNITS_PIXELS);

    if (get().getEnvironment().equals(ALFRESCO)) {
        title.addStyleName(STYLE_WORKFLOW_CONSOLE_LOGO);
    } else {
        title.addStyleName(STYLE_APPLICATION_MINI_LIVORNO);
    }
    Label city = new Label();
    city.addStyleName(LABEL_H1);
    city.setValue(i18nManager.getMessage(LIVORNO_TITLE));
    city.addStyleName(STYLE_APPLICATION_TITLE_LIVORNO);
    city.setWidth(310, UNITS_PIXELS);

    panel.addComponent(title);
    panel.addComponent(city);

    sperimentazioni.addComponent(panel);
}

From source file:it.vige.greenarea.bpm.custom.ui.LoginPanel.java

License:Apache License

private void initPomezia() {
    HorizontalLayout panel = new HorizontalLayout();
    panel.setHeight(90, UNITS_PIXELS);/*from  w  ww. ja  v a 2  s.c  om*/
    Label title = new Label();
    title.addStyleName(LABEL_H1);
    title.setWidth(80, UNITS_PIXELS);

    if (get().getEnvironment().equals(ALFRESCO)) {
        title.addStyleName(STYLE_WORKFLOW_CONSOLE_LOGO);
    } else {
        title.addStyleName(STYLE_APPLICATION_MINI_POMEZIA);
    }
    Label city = new Label();
    city.addStyleName(LABEL_H1);
    city.setValue(i18nManager.getMessage(POMEZIA_TITLE));
    city.addStyleName(STYLE_APPLICATION_TITLE_POMEZIA);
    city.setWidth(310, UNITS_PIXELS);

    panel.addComponent(title);
    panel.addComponent(city);

    sperimentazioni.addComponent(panel);
}