Example usage for com.vaadin.ui Panel setWidth

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

Introduction

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

Prototype

@Override
    public void setWidth(String width) 

Source Link

Usage

From source file:ac.uk.icl.dell.vaadin.glycanbuilder.GlycanBuilder.java

License:Open Source License

private void initToolBars() {
    theToolBarPanel = new Panel();
    theToolBarPanel.setContent(new HorizontalLayout());

    NavigableApplication.getCurrentNavigableAppLevelWindow().addActionHandler(new Handler() {
        private static final long serialVersionUID = 1735392108529734256L;

        Action actionDelete = new ShortcutAction("Delete", ShortcutAction.KeyCode.DELETE, null);
        Action actionCopy = new ShortcutAction("Copy", ShortcutAction.KeyCode.C,
                new int[] { ShortcutAction.ModifierKey.CTRL });
        Action actionPaste = new ShortcutAction("Paste", ShortcutAction.KeyCode.V,
                new int[] { ShortcutAction.ModifierKey.CTRL });
        Action actionCut = new ShortcutAction("Cut", ShortcutAction.KeyCode.X,
                new int[] { ShortcutAction.ModifierKey.CTRL });
        Action actionSelectAll = new ShortcutAction("Select all", ShortcutAction.KeyCode.A,
                new int[] { ShortcutAction.ModifierKey.CTRL });
        Action actionUnSelectAll = new ShortcutAction("UnSelect all", ShortcutAction.KeyCode.A,
                new int[] { ShortcutAction.ModifierKey.CTRL, ShortcutAction.ModifierKey.SHIFT });

        @Override/*from  www  .j  a va2  s  .c  om*/
        public Action[] getActions(Object target, Object sender) {
            return new Action[] { actionDelete, actionCopy, actionPaste, actionCut, actionSelectAll,
                    actionUnSelectAll };
        }

        @Override
        public void handleAction(Action action, Object sender, Object target) {

            GlycanCanvas canvas = theCanvas.theCanvas;
            if (theCanvas.theCanvas.hasSelected()) {
                if (action == actionDelete) {
                    canvas.delete();
                } else if (action == actionCopy) {
                    canvas.copy();
                } else if (action == actionCut) {
                    canvas.cut();
                }
            }

            if (action == actionSelectAll) {
                canvas.selectAll();
                canvas.documentUpdated();
            } else if (action == actionUnSelectAll) {
                canvas.resetSelection();
                canvas.documentUpdated();
            } else if (action == actionPaste) {
                System.err.println("Paste picked up!");
                canvas.paste();
            }
        }
    });

    theCanvas.appendGeneralToolBar(theToolBarPanel);

    //theToolBarPanel.setScrollable(true);

    mainLayout.addComponent(theToolBarPanel);

    Panel theLinkageToolBarPanel = new Panel();
    theLinkageToolBarPanel.setContent(new HorizontalLayout());
    theLinkageToolBarPanel.setWidth("100%");
    //theLinkageToolBarPanel.setScrollable(true);

    theCanvas.appendLinkageToolBar(theLinkageToolBarPanel);

    //theLinkageToolBarPanel.setScrollable(false);

    mainLayout.addComponent(theLinkageToolBarPanel);

    theResidueCanvas = new VaadinGlycanCanvas();
    theResidueCanvas.setBackgroundColor("#CCF");
    theResidueCanvas.setName("residueCanvas");

    theResidueCanvas.setHeight("25px");
    theResidueCanvas.setWidth("100%");

    theResidueCanvas.enableMouseSelectionRectangle(false);
    theResidueCanvas.theCanvas.theGlycanRenderer.getGraphicOptions().MARGIN_TOP = 2;

    mainLayout.addComponent(theResidueCanvas);
    //mainLayout.setExpandRatio(theResidueCanvas, 1);

    final VaadinGlycanCanvas finalCanvas = theResidueCanvas;
    finalCanvas.enableResidueToolBarMode();

    theResidueCanvas.theCanvas.addGlycanCanvasUpdateListener(new GlycanCanvasUpdateListener() {
        @Override
        public void glycanCanvasUpdated() {
            Residue selectedResidues[] = theResidueCanvas.theCanvas.selectedResidues.toArray(new Residue[0]);

            theResidueCanvas.theCanvas.selectedResidues.clear();

            theCanvas.theCanvas.setDocumentChangedEventFiring(false);

            for (Residue toinsert : selectedResidues) {
                System.err.println("Selected residue: " + toinsert.getTypeName());
                theCanvas.theCanvas.addResidueByNameToSelected(toinsert.getTypeName());
            }

            theCanvas.theCanvas.setDocumentChangedEventFiring(true);
            theCanvas.theCanvas.documentUpdated();
        }
    });
}

From source file:at.peppol.webgui.app.components.PartyDetailForm.java

License:Mozilla Public License

private void initElements() {

    setCaption(party + " Party");
    //setStyleName("light");

    final VerticalLayout outerLayout = new VerticalLayout();
    outerLayout.setSpacing(true);// w  w  w.  j  av  a 2  s  .c  o  m
    outerLayout.setMargin(true);

    hiddenContent = new VerticalLayout();
    hiddenContent.setSpacing(true);
    hiddenContent.setMargin(true);

    PropertysetItem partyItemSet = new PropertysetItem();

    PartyIdentificationType supplierPartyID;
    if (partyBean.getPartyIdentification().size() == 0) {
        supplierPartyID = new PartyIdentificationType();
        supplierPartyID.setID(new IDType());
        partyBean.getPartyIdentification().add(supplierPartyID);
    } else {
        supplierPartyID = partyBean.getPartyIdentification().get(0);
    }

    partyItemSet.addItemProperty("Party ID", new NestedMethodProperty(supplierPartyID, "ID.value"));

    EndpointIDType endPointID;
    if (partyBean.getEndpointID() == null) {
        endPointID = new EndpointIDType();
        partyBean.setEndpointID(endPointID);
    } else {
        endPointID = partyBean.getEndpointID();
    }
    partyItemSet.addItemProperty("Endpoint ID", new NestedMethodProperty(endPointID, "SchemeAgencyID"));

    PartyNameType partyName;
    if (partyBean.getPartyName().size() == 0) {
        partyName = new PartyNameType();
        partyName.setName(new NameType());
        partyBean.getPartyName().add(partyName);
    } else {
        partyName = partyBean.getPartyName().get(0);
    }
    partyItemSet.addItemProperty("Party Name", new NestedMethodProperty(partyName, "name.value"));

    /*        partyItemSet.addItemProperty("Agency Name", 
        new NestedMethodProperty(supplierPartyID, "ID.SchemeAgencyID") );
    */
    /*
    final AddressType partyrAddress = new AddressType();
            
    partyBean.setPostalAddress(partyrAddress);
    partyrAddress.setStreetName(new StreetNameType());
    partyrAddress.setCityName(new CityNameType());
    partyrAddress.setPostalZone(new PostalZoneType());
    partyrAddress.setCountry(new CountryType());
            
    partyrAddress.getCountry().setIdentificationCode(new IdentificationCodeType());
            
    partyItemSet.addItemProperty("Street Name",
                    new NestedMethodProperty(partyrAddress, "streetName.value"));
    partyItemSet.addItemProperty("City",
                    new NestedMethodProperty(partyrAddress, "cityName.value"));
    partyItemSet.addItemProperty("Postal Zone",
                    new NestedMethodProperty(partyrAddress, "postalZone.value"));
    partyItemSet.addItemProperty("Country",
                    new NestedMethodProperty(partyrAddress, "country.identificationCode.value"));
    */
    AddressDetailForm partyAddressForm;
    AddressType address;
    if (partyBean.getPostalAddress() == null) {
        address = new AddressType();
    } else {
        address = partyBean.getPostalAddress();
    }
    partyAddressForm = new AddressDetailForm(party, address);
    partyBean.setPostalAddress(address);

    PartyTaxSchemeType taxScheme;
    if (partyBean.getPartyTaxScheme().size() == 0) {
        taxScheme = new PartyTaxSchemeType();
        taxScheme.setCompanyID(new CompanyIDType());

        //partyItemSet.addItemProperty(taxSchemeCompanyID,
        //        new NestedMethodProperty(taxScheme.getCompanyID(),"value"));

        // TODO: Hardcoded ShemeID etc for TaxScheme. Should be from a codelist?
        taxScheme.setTaxScheme(new TaxSchemeType());
        taxScheme.getTaxScheme().setID(new IDType());
        taxScheme.getTaxScheme().getID().setValue("VAT");
        taxScheme.getTaxScheme().getID().setSchemeID("UN/ECE 5153");
        taxScheme.getTaxScheme().getID().setSchemeAgencyID("6");

        partyBean.getPartyTaxScheme().add(taxScheme);
    } else {
        taxScheme = partyBean.getPartyTaxScheme().get(0);
    }

    partyItemSet.addItemProperty(taxSchemeCompanyID,
            new NestedMethodProperty(taxScheme.getCompanyID(), "value"));

    partyItemSet.addItemProperty(taxSchemeID,
            new NestedMethodProperty(taxScheme.getTaxScheme().getID(), "value"));

    final Form partyForm = new Form();
    partyForm.setFormFieldFactory(new PartyFieldFactory());
    partyForm.setItemDataSource(partyItemSet);
    partyForm.setImmediate(true);

    final Button addLegalEntityBtn = new Button("Add Legal Entity");
    final Button removeLegalEntityBtn = new Button("Remove Legal Entity");
    //removeLegalEntityBtn.setVisible(false);

    addLegalEntityBtn.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            //add the legal entity component
            Panel panel = createLegalEntityPanel(removeLegalEntityBtn);
            outerLayout.addComponent(panel);
            panel.setWidth("90%");
            addLegalEntityBtn.setVisible(false);
            //removeLegalEntityBtn.setVisible(true);
            //outerLayout.replaceComponent(removeLegalEntityBtn, panel);
        }
    });

    removeLegalEntityBtn.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            //remove the legal entity component
            for (int i = 0; i < outerLayout.getComponentCount(); i++) {
                Component c = outerLayout.getComponent(i);
                if (c instanceof Panel) {
                    if (c.getCaption().equals("Legal Entity")) {
                        outerLayout.removeComponent(c);
                        if (partyBean.getPartyLegalEntity().size() > 0) {
                            partyBean.getPartyLegalEntity().clear();
                            ValidatorsList.removeListeners(Utils.getFieldListeners(legalEntityForm));
                        }
                    }
                }
            }
            //removeLegalEntityBtn.setVisible(false);
            addLegalEntityBtn.setVisible(true);
        }
    });

    outerLayout.addComponent(partyForm);
    partyForm.setWidth("90%");
    outerLayout.addComponent(partyAddressForm);
    partyAddressForm.setWidth("90%");
    outerLayout.addComponent(addLegalEntityBtn);
    if (partyBean.getPartyLegalEntity().size() > 0)
        addLegalEntityBtn.click();
    //outerLayout.addComponent(removeLegalEntityBtn);
    //outerLayout.addComponent(createLegalEntityPanel());

    setContent(outerLayout);
}

From source file:at.peppol.webgui.app.components.TabInvoiceHeader.java

License:Mozilla Public License

private void initElements() {
    additionalDocRefList = parent.getInvoice().getAdditionalDocumentReference();
    setWidth("100%");
    setHeight("100%");
    //final GridLayout grid = new GridLayout(4, 4);
    final VerticalLayout outerLayout = new VerticalLayout();
    //outerLayout.setMargin(true);
    //outerLayout.setSpacing(true);

    //grid that contains "Details", "Contract", "Order"
    final GridLayout topGridLayout = new GridLayout(2, 2);
    //topGridLayout.setSizeFull();
    topGridLayout.setMargin(true);/* www  . ja  va2s. c  o m*/
    topGridLayout.setSpacing(true);

    hiddenContent = new VerticalLayout();
    hiddenContent.setSpacing(true);
    hiddenContent.setMargin(true);

    final Panel outerPanel = new Panel("Invoice Header");
    //outerPanel.addComponent(grid);
    outerPanel.setScrollable(true);
    outerPanel.setContent(outerLayout);
    //outerLayout.addComponent(outerPanel);

    VerticalLayout tabLayout = new VerticalLayout();
    tabLayout.addComponent(outerPanel);

    outerLayout.addComponent(topGridLayout);

    final Panel invoiceDetailsPanel = new Panel("Invoice Header Details");
    invoiceDetailsPanel.setStyleName("light");
    invoiceDetailsPanel.setWidth("50%");
    //invoiceDetailsPanel.setSizeFull();
    invoiceDetailsPanel.addComponent(createInvoiceTopForm());
    topGridLayout.addComponent(invoiceDetailsPanel, 0, 0);

    final Panel orderReferencePanel = new Panel("Referencing Order");
    orderReferencePanel.setStyleName("light");
    orderReferencePanel.setWidth("50%");
    //orderReferencePanel.setSizeFull();
    orderReferencePanel.addComponent(createInvoiceOrderReferenceForm());
    topGridLayout.addComponent(orderReferencePanel, 0, 1);

    final VerticalLayout tableVerticalLayout = new VerticalLayout();
    //tableVerticalLayout.setSpacing (true);
    tableVerticalLayout.setMargin(true);
    outerLayout.addComponent(tableVerticalLayout);

    table = new InvoiceAdditionalDocRefTable(parent.getInvoice().getAdditionalDocumentReference());
    table.setSelectable(true);
    table.setImmediate(true);
    table.setNullSelectionAllowed(false);
    table.setHeight(150, UNITS_PIXELS);
    table.setSizeFull();
    //table.setWidth("300px");
    table.setFooterVisible(false);
    table.addStyleName("striped strong");

    Panel tablePanel = new Panel("Relevant Documents");
    tablePanel.setStyleName("light");
    tablePanel.setWidth("60%");
    tableVerticalLayout.addComponent(tablePanel);

    GridLayout h = new GridLayout(2, 2);
    h.setMargin(true);
    h.setSpacing(true);
    tablePanel.setContent(h);
    h.addComponent(table, 0, 0);
    h.setColumnExpandRatio(0, 3);
    h.setColumnExpandRatio(1, 1);
    h.setSizeFull();

    Button addButton = new Button("Add new");
    Button editButton = new Button("Edit selected");
    Button deleteButton = new Button("Delete selected");

    VerticalLayout buttonsContainer = new VerticalLayout();
    buttonsContainer.setSpacing(true);
    buttonsContainer.addComponent(addButton);
    buttonsContainer.addComponent(editButton);
    buttonsContainer.addComponent(deleteButton);

    InvoiceAdditionalDocRefTableEditor editor = new InvoiceAdditionalDocRefTableEditor(editMode);
    Label label = new Label("<h3>Adding new relevant document</h3>", Label.CONTENT_XHTML);
    addButton.addListener(editor.addButtonListener(editButton, deleteButton, hiddenContent, table,
            additionalDocRefList, label));
    label = new Label("<h3>Edit relevant document</h3>", Label.CONTENT_XHTML);
    editButton.addListener(editor.editButtonListener(addButton, deleteButton, hiddenContent, table,
            additionalDocRefList, label));
    deleteButton.addListener(editor.deleteButtonListener(table));

    final Button addContractReferenceBtn = new Button("Add Contract Reference");
    final Button removeContractReferenceBtn = new Button("Remove Contract Reference");
    removeContractReferenceBtn.setVisible(false);
    addContractReferenceBtn.setStyleName("marginLeft");
    removeContractReferenceBtn.setStyleName("marginLeft");

    addContractReferenceBtn.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            Panel panel = createInvoiceContractReference(removeContractReferenceBtn);
            topGridLayout.removeComponent(1, 0);
            topGridLayout.addComponent(panel, 1, 0);
            removeContractReferenceBtn.setVisible(true);
        }
    });

    removeContractReferenceBtn.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            //remove the legal entity component panel
            Component c = removeContractReferenceBtn.getParent().getParent();
            topGridLayout.removeComponent(c);
            if (parent.getInvoice().getContractDocumentReference().size() > 0) {
                //parent.getInvoice().getContractDocumentReference().remove(0);
                parent.getInvoice().getContractDocumentReference().clear();
                ValidatorsList.removeListeners(Utils.getFieldListeners(contractReferenceForm));
            }

            topGridLayout.addComponent(addContractReferenceBtn, 1, 0);
        }
    });

    h.addComponent(buttonsContainer, 1, 0);
    topGridLayout.addComponent(addContractReferenceBtn, 1, 0);
    if (parent.getInvoice().getContractDocumentReference().size() > 0)
        addContractReferenceBtn.click();

    // ---- HIDDEN FORM BEGINS -----
    VerticalLayout formLayout = new VerticalLayout();
    formLayout.addComponent(hiddenContent);
    hiddenContent.setVisible(false);

    h.addComponent(formLayout, 0, 1);
    // ---- HIDDEN FORM ENDS -----

    setLayout(tabLayout);
}

From source file:com.assemblade.ui.views.LoginScreen.java

License:Apache License

public LoginScreen() {
    app = CatApplication.getInstance();/*  www  .j av a 2  s.c om*/
    setSizeFull();
    Panel loginPanel = new Panel("Login");
    loginPanel.setWidth("400px");
    LoginForm loginForm = new LoginForm();
    loginForm.setUsernameCaption("Username: ");
    loginForm.setPasswordCaption("Password: ");
    loginForm.addListener(this);
    loginForm.setHeight("150px");
    loginPanel.addComponent(loginForm);
    addComponent(loginPanel);
    setComponentAlignment(loginPanel, Alignment.MIDDLE_CENTER);
    HorizontalLayout footer = new HorizontalLayout();
    footer.setHeight("50px");
    addComponent(footer);
}

From source file:com.cavisson.gui.dashboard.components.controls.Panels.java

License:Apache License

public Panels() {
    setMargin(true);/* www .  j  av  a2s . c  o m*/

    Label h1 = new Label("Panels & Layout panels");
    h1.addStyleName("h1");
    addComponent(h1);

    HorizontalLayout row = new HorizontalLayout();
    row.addStyleName("wrapping");
    row.setSpacing(true);
    addComponent(row);
    TestIcon testIcon = new TestIcon(60);

    Panel panel = new Panel("Normal");
    panel.setIcon(testIcon.get());
    panel.setContent(panelContent());
    row.addComponent(panel);

    panel = new Panel("Sized");
    panel.setIcon(testIcon.get());
    panel.setWidth("10em");
    panel.setHeight("250px");
    panel.setContent(panelContent());
    row.addComponent(panel);

    panel = new Panel("Custom Caption");
    panel.setIcon(testIcon.get());
    panel.addStyleName("color1");
    panel.setContent(panelContent());
    row.addComponent(panel);

    panel = new Panel("Custom Caption");
    panel.setIcon(testIcon.get());
    panel.addStyleName("color2");
    panel.setContent(panelContent());
    row.addComponent(panel);

    panel = new Panel("Custom Caption");
    panel.setIcon(testIcon.get());
    panel.addStyleName("color3");
    panel.setContent(panelContent());
    row.addComponent(panel);

    panel = new Panel("Borderless style");
    panel.setIcon(testIcon.get());
    panel.addStyleName("borderless");
    panel.setContent(panelContent());
    row.addComponent(panel);

    panel = new Panel("Borderless + scroll divider");
    panel.setIcon(testIcon.get());
    panel.addStyleName("borderless");
    panel.addStyleName("scroll-divider");
    panel.setContent(panelContentScroll());
    panel.setHeight("17em");
    row.addComponent(panel);

    panel = new Panel("Well style");
    panel.setIcon(testIcon.get());
    panel.addStyleName("well");
    panel.setContent(panelContent());
    row.addComponent(panel);

    CssLayout layout = new CssLayout();
    layout.setIcon(testIcon.get());
    layout.setCaption("Panel style layout");
    layout.addStyleName("card");
    layout.addComponent(panelContent());
    row.addComponent(layout);

    layout = new CssLayout();
    layout.addStyleName("card");
    row.addComponent(layout);
    HorizontalLayout panelCaption = new HorizontalLayout();
    panelCaption.addStyleName("v-panel-caption");
    panelCaption.setWidth("100%");
    // panelCaption.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    Label label = new Label("Panel style layout");
    panelCaption.addComponent(label);
    panelCaption.setExpandRatio(label, 1);

    Button action = new Button();
    action.setIcon(FontAwesome.PENCIL);
    action.addStyleName("borderless-colored");
    action.addStyleName("small");
    action.addStyleName("icon-only");
    panelCaption.addComponent(action);
    MenuBar dropdown = new MenuBar();
    dropdown.addStyleName("borderless");
    dropdown.addStyleName("small");
    MenuItem addItem = dropdown.addItem("", FontAwesome.CHEVRON_DOWN, null);
    addItem.setStyleName("icon-only");
    addItem.addItem("Settings", null);
    addItem.addItem("Preferences", null);
    addItem.addSeparator();
    addItem.addItem("Sign Out", null);
    panelCaption.addComponent(dropdown);

    layout.addComponent(panelCaption);
    layout.addComponent(panelContent());
    layout.setWidth("14em");

    layout = new CssLayout();
    layout.setIcon(testIcon.get());
    layout.setCaption("Well style layout");
    layout.addStyleName("well");
    layout.addComponent(panelContent());
    row.addComponent(layout);
}

From source file:com.cerebro.gorgone.landingpage.SignInWindow.java

private Component setFirstStep() {
    VerticalLayout firstStep = new VerticalLayout();
    firstStep.setMargin(true);//from  w  ww.j a v a 2s.c  o  m
    // Body
    HorizontalLayout body = new HorizontalLayout();
    FormLayout datiIniziali = new FormLayout();
    TextField nomePG = new TextField("Nome del Personaggio");
    nomePG.setRequired(true);
    TextField cognomePG = new TextField("Cognome del Personaggio");
    cognomePG.setRequired(true);
    OptionGroup sessoPG = new OptionGroup("Sesso del Personaggio");
    sessoPG.setRequired(true);
    sessoPG.addItems("Maschio", "Femmina");
    ComboBox razzaPG = new ComboBox("Razza");
    razzaPG.setRequired(true);
    Slider age = new Slider("Et");
    age.setImmediate(true);
    age.setWidth("200px");
    age.setVisible(false);
    HorizontalLayout ageDescription = new HorizontalLayout();
    ageDescription.setHeight("250px");
    Label ageText = new Label("Valore dell'et: ");
    Label ageValue = new Label(age.getValue().toString());
    Label periodoVita = new Label("");
    ageDescription.addComponents(ageText, ageValue, periodoVita);
    age.addValueChangeListener((Property.ValueChangeEvent event) -> {
        System.out.println("Valore: " + age.getValue().toString());
        ageValue.setValue(age.getValue().toString());
        Double value = (100 * (age.getValue()) / (age.getMax()));
        if (value < 14) {
            periodoVita.setValue("Bambino");
        } else if (value > 14 && value < 24) {
            periodoVita.setValue("Adolescenza");
        } else if (value > 24 && value < 73) {
            periodoVita.setValue("Et adulta");
        } else if (value > 73) {
            periodoVita.setValue("Et anziana");
        }
    });
    ageDescription.addComponents(ageText, ageValue, periodoVita);
    ageDescription.setVisible(false);
    datiIniziali.addComponents(nomePG, cognomePG, sessoPG, razzaPG, age, ageDescription);
    Panel descrizioneRazza = new Panel();
    CssLayout descrizioneRazzaContent = new CssLayout();
    descrizioneRazza.setWidth("400px");
    descrizioneRazza.setHeight("500px");
    descrizioneRazza.setContent(descrizioneRazzaContent);
    //  Dettagli di popolazione e comportamento ComboBox
    TableQuery tq_races = new TableQuery(DatabaseTables.RACES_TABLE, connPool);
    tq_races.setVersionColumn(DatabaseTables.RACES_VERSION);
    SQLContainer container_races = null;
    try {
        container_races = new SQLContainer(tq_races);
    } catch (Exception ex) {
        logger.error(ex.getMessage());
    }
    razzaPG.setContainerDataSource(container_races);
    razzaPG.setItemCaptionMode(AbstractSelect.ItemCaptionMode.PROPERTY);
    razzaPG.setItemCaptionPropertyId(DatabaseTables.RACES_NAME);
    razzaPG.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            if (razzaPG.getValue() != null) {
                logger.info("Razza selezionata: " + razzaPG.getValue());
                age.setVisible(true);
                ageDescription.setVisible(true);
                descrizioneRazzaContent.removeAllComponents();
                Item item = razzaPG.getContainerDataSource().getItem(razzaPG.getValue());
                race = (String) item.getItemProperty(DatabaseTables.RACES_NAME).getValue();
                Label nameRace = new Label(race);
                FileResource imageSrc = new FileResource(
                        new File(MyUI.basePath + item.getItemProperty(DatabaseTables.RACES_IMAGE).getValue()));
                Image imageRace = new Image(null, imageSrc);
                imageRace.setWidth("200px");
                Label descriptionRace = new Label(
                        (String) item.getItemProperty(DatabaseTables.RACES_DESCRIPTION).getValue(),
                        ContentMode.HTML);
                min_age = (int) item.getItemProperty(DatabaseTables.RACES_MIN_AGE).getValue();
                max_age = (int) item.getItemProperty(DatabaseTables.RACES_MAX_AGE).getValue();
                age.setMin(min_age);
                age.setMax(max_age);
                strenght = (int) item.getItemProperty(DatabaseTables.RACES_STRENGHT).getValue();
                resistance = (int) item.getItemProperty(DatabaseTables.RACES_RESISTANCE).getValue();
                agility = (int) item.getItemProperty(DatabaseTables.RACES_AGILITY).getValue();
                intelligence = (int) item.getItemProperty(DatabaseTables.RACES_INTELLIGENCE).getValue();
                wisdom = (int) item.getItemProperty(DatabaseTables.RACES_WISDOM).getValue();
                charm = (int) item.getItemProperty(DatabaseTables.RACES_CHARM).getValue();
                Label min_ageL = new Label("Et minima: " + min_age);
                Label max_ageL = new Label("Et masima " + max_age);
                //                Panel levels = new Panel();
                //                VerticalLayout levelsContent = new VerticalLayout();
                //                levels.setContent(levelsContent);
                //                Label strenghtL = new Label("Forza: " + strenght);
                //                levelsContent.addComponents(strenghtL);

                String levelTable = "<table><tr><td>Forza</td><td>Resistenza</td><td>Agilit</td><td>Intelligenza</td>"
                        + "<td>Saggezza</td><td>Carisma</td></tr><tr>" + "<td>" + strenght + "</td>" + "<td>"
                        + resistance + "</td>" + "<td>" + agility + "</td>" + "<td>" + intelligence + "</td>"
                        + "<td>" + wisdom + "</td>" + "<td>" + charm + "</td>" + "</tr></table>";
                Label levels = new Label(levelTable, ContentMode.HTML);

                descrizioneRazzaContent.addComponents(nameRace, imageRace, descriptionRace, min_ageL, max_ageL,
                        levels);
            }
        }
    });

    body.addComponents(datiIniziali, descrizioneRazza);
    CssLayout footer = new CssLayout();
    Button next = new Button("Avanti ->");
    next.addClickListener((Button.ClickEvent event) -> {
        user.setNomePG(nomePG.getValue());
        user.setCognomePG(cognomePG.getValue());
        user.setSessoPG(sessoPG.getValue().toString());
        user.setRazzaPG(race);
        user.setEtaPG(age.getValue().toString());
        user.setForzaPG(strenght);
        user.setResistenzaPG(resistance);
        user.setAgilitaPG(agility);
        user.setIntelligenzaPG(intelligence);
        user.setSaggezzaPG(wisdom);
        user.setCarismaPG(charm);
        this.setContent(setSecondStep());
    });
    footer.addComponents(next, createCancelButton());
    firstStep.addComponents(setHeader("2/4"), body, footer);
    return firstStep;
}

From source file:com.cms.utils.CommonUtils.java

public static Panel addOg2Panel(OptionGroup og, String caption, String height) {
    og.setWidth("100%");
    og.setHeight("-1px");
    og.setImmediate(true);/*from  w  ww .j  a  va 2 s  . c o  m*/
    og.setMultiSelect(true);
    VerticalLayout layout = new VerticalLayout();
    layout.setWidth("100%");
    layout.setHeightUndefined();
    layout.setImmediate(true);
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.addComponent(og);
    layout.setComponentAlignment(og, Alignment.MIDDLE_LEFT);
    Panel panel = new Panel();
    if (!DataUtil.isStringNullOrEmpty(caption)) {
        panel.setCaption(caption);
    }
    panel.setWidth("100%");
    panel.setImmediate(true);
    if (!DataUtil.isStringNullOrEmpty(height)) {
        panel.setHeight(height);
    } else {
        panel.setHeight("200px");
    }
    panel.addStyleName(Runo.PANEL_LIGHT);
    panel.setContent(layout);
    return panel;
}

From source file:com.etest.view.systemadministration.CurriculumMainUI.java

Panel dataGridPanel() {
    Panel panel = new Panel("List of All Curriculum");
    panel.setWidth("1000px");

    populateDataTable();/*from   ww  w .  j  a  v a 2 s .  co  m*/
    panel.setContent(table);

    return panel;
}

From source file:com.etest.view.systemadministration.FacultyMainUI.java

Panel getDataTablePanel() {
    Panel panel = new Panel("Faculty");
    panel.setWidth("900px");

    populateDataTable();// w  ww .  jav  a2s .com
    panel.setContent(table);

    return panel;
}

From source file:com.etest.view.systemadministration.SemestralTeamUI.java

Panel dataTablePanel() {
    Panel panel = new Panel();
    panel.setWidth("100%");

    panel.setContent(table);//from  ww  w . j  av  a2  s.  c  o m
    return panel;
}