Example usage for com.vaadin.ui HorizontalLayout addComponent

List of usage examples for com.vaadin.ui HorizontalLayout addComponent

Introduction

In this page you can find the example usage for com.vaadin.ui HorizontalLayout addComponent.

Prototype

@Override
public void addComponent(Component c) 

Source Link

Document

Add a component into this container.

Usage

From source file:com.esspl.datagen.ui.TableDataView.java

License:Open Source License

public TableDataView(final JdbcTable table, final Connection connection, final DataGenApplication dataApp) {
    log.debug("TableDataView - constructor start");
    setCaption("Data");
    dataGenApplication = dataApp;//from   ww w. jav a2  s.co  m
    VerticalLayout vl = new VerticalLayout();
    vl.setSizeFull();
    setCompositionRoot(vl);

    HorizontalLayout hBar = new HorizontalLayout();
    hBar.setWidth("98%");
    hBar.setHeight("40px");

    rows = new TextField();
    rows.setWidth("50px");
    rows.setImmediate(true);
    rows.addValidator(new IntegerValidator("Rows must be an Integer"));
    Label lbl = new Label("Generate ");

    content = new HorizontalLayout();
    content.setHeight("40px");
    content.setMargin(false, false, false, true);
    content.setSpacing(true);
    content.addComponent(lbl);
    content.setComponentAlignment(lbl, Alignment.MIDDLE_CENTER);
    content.addComponent(rows);
    content.setComponentAlignment(rows, Alignment.MIDDLE_CENTER);

    Button addDataButton = new Button("Row(S) Data", new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            log.debug("TableDataView - Generate Data Button clicked");
            populateGenerator(table);
        }
    });
    addDataButton.addStyleName("small");
    addDataButton.setIcon(DataGenConstant.ADD_SMALL);
    content.addComponent(addDataButton);
    content.setComponentAlignment(addDataButton, Alignment.MIDDLE_CENTER);

    Button refreshButton = new Button("Refresh", new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            log.debug("TableDataView - Refresh Button clicked");
            refreshDataView(table, connection);
        }
    });
    refreshButton.addStyleName("small");
    refreshButton.setIcon(DataGenConstant.RESET);
    content.addComponent(refreshButton);
    content.setComponentAlignment(refreshButton, Alignment.MIDDLE_CENTER);

    //Tapas:10/08/2012 - Export feature implementation started
    HorizontalLayout expContainer = new HorizontalLayout();
    expContainer.setSpacing(true);

    PopupButton exportButton = new PopupButton("Export");
    exportButton.setComponent(new DataExportView());
    exportButton.addListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            //dataApp.getMainWindow().showNotification("Export Button clicked!");
        }
    });
    exportButton.setIcon(DataGenConstant.DATAEXPORT_ICON);
    expContainer.addComponent(exportButton);
    expContainer.setComponentAlignment(exportButton, Alignment.MIDDLE_LEFT);

    //Tapas:10/08/2012 - Import feature implementation started
    PopupButton importButton = new PopupButton("Import");
    importButton.setComponent(new DataImportView());
    importButton.addListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            //dataApp.getMainWindow().showNotification("Import Button clicked!");
        }
    });
    importButton.setIcon(DataGenConstant.DATAIMPORT_ICON);
    expContainer.addComponent(importButton);
    expContainer.setComponentAlignment(importButton, Alignment.MIDDLE_RIGHT);

    tableContainer = new VerticalLayout();
    tableContainer.setSizeFull();
    hBar.addComponent(content);
    hBar.setComponentAlignment(content, Alignment.MIDDLE_LEFT);
    hBar.addComponent(expContainer);
    hBar.setComponentAlignment(expContainer, Alignment.MIDDLE_RIGHT);
    vl.addComponent(hBar);
    vl.addComponent(tableContainer);
    vl.setExpandRatio(tableContainer, 1f);

    refreshDataView(table, connection);
    log.debug("TableDataView - constructor end");
}

From source file:com.esspl.datagen.util.DataGenEventHandler.java

License:Open Source License

public void onChangeDataType(ValueChangeEvent event, Select select) {
    log.debug("DataGenEventHandler - onChangeDataType() method start");
    int rowId = (Integer) select.getData();
    DataGenApplication tdg = (DataGenApplication) select.getApplication();
    Item item = tdg.listing.getItem(rowId);
    Select formatSel = (Select) item.getItemProperty("Format").getValue();
    formatSel.removeAllItems();// www .  j  av a 2  s  .c o m
    formatSel.setEnabled(true);

    Label exampleSel = (Label) item.getItemProperty("Examples").getValue();
    exampleSel.setValue("NA");

    HorizontalLayout addBar = (HorizontalLayout) item.getItemProperty("Additional Data").getValue();
    addBar.removeAllComponents();
    addBar.setMargin(false);
    addBar.addComponent(new Label("NA"));

    if (event.getProperty().getValue() == null) {
        formatSel.setValue(null);
        formatSel.setEnabled(false);
        return;
    }
    if (event.getProperty().getValue().equals("Name")) {
        for (String f : DataGenConstant.NAME_FORMATS) {
            formatSel.addItem(f);
        }
        formatSel.setNullSelectionAllowed(false);
        formatSel.setValue("First_Name Last_Name");
    } else if (event.getProperty().getValue().equals("Date")) {
        for (String f : DataGenConstant.DATE_FORMATS) {
            formatSel.addItem(f);
        }
        formatSel.setNullSelectionAllowed(false);
        formatSel.setValue("dd/MM/yyyy");
    } else if (event.getProperty().getValue().equals("Phone/Fax")) {
        for (String f : DataGenConstant.PHONE_FORMATS) {
            formatSel.addItem(f);
        }
        formatSel.setNullSelectionAllowed(false);
        formatSel.setValue("India");
    } else if (event.getProperty().getValue().equals("Postal/Zip")) {
        for (String f : DataGenConstant.ZIP_FORMATS) {
            formatSel.addItem(f);
        }
        formatSel.setNullSelectionAllowed(false);
        formatSel.setValue("India");
    } else if (event.getProperty().getValue().equals("State/Provience/County")) {
        for (String f : DataGenConstant.STATE_FORMATS) {
            formatSel.addItem(f);
        }
        formatSel.setNullSelectionAllowed(false);
        formatSel.setValue("Full");
    } else if (event.getProperty().getValue().equals("Random Text")) {
        exampleSel.setValue(df.getRandomText(6));
        addTextFields(addBar, "Min Length", "Max Length");
    } else if (event.getProperty().getValue().equals("Fixed Text")) {
        exampleSel.setValue(df.getRandomWord());
        addChkTextField(addBar, "Text", "Is Number");
    } else if (event.getProperty().getValue().equals("Number Range")) {
        exampleSel.setValue(df.getNumberBetween(10, 1000));
        addTextFields(addBar, "Start Number", "End Number");
    } else if (event.getProperty().getValue().equals("Alphanumeric")) {
        exampleSel.setValue("SD0358");
        addTextFields(addBar, "Starting Text", "Total Length");
    } else if (event.getProperty().getValue().equals("Title")) {//Examples start
        exampleSel.setValue(df.getPrefix());
    } else if (event.getProperty().getValue().equals("Email")) {
        exampleSel.setValue(df.getEmailAddress());
    } else if (event.getProperty().getValue().equals("Street Address")) {
        exampleSel.setValue(df.getStreetName());
    } else if (event.getProperty().getValue().equals("City")) {
        exampleSel.setValue(df.getCity());
    } else if (event.getProperty().getValue().equals("Country")) {
        exampleSel.setValue(df.getCountry());
    } else if (event.getProperty().getValue().equals("Incremental Number")) {
        exampleSel.setValue("1, 2, 3, 4, 5..");
        addSingleTextField(addBar, "Starting From");
    } else if (event.getProperty().getValue().equals("Marital Status")) {
        exampleSel.setValue(df.getStatus());
    } else if (event.getProperty().getValue().equals("Department Name")) {
        exampleSel.setValue(df.getBusinessType());
    } else if (event.getProperty().getValue().equals("Company Name")) {
        exampleSel.setValue(df.getCompanyName());
    } else if (event.getProperty().getValue().equals("Boolean Flag")) {
        exampleSel.setValue(df.getBooleanFlag());
    } else if (event.getProperty().getValue().equals("Passport Number")) {
        exampleSel.setValue(df.getPassportNumber());
    }

    //If there are no formats to show, then disable it
    if (formatSel.getItemIds().size() == 0) {
        formatSel.setEnabled(false);
    }
    log.debug("DataGenEventHandler - onChangeDataType() method end");
}

From source file:com.esspl.datagen.util.DataGenEventHandler.java

License:Open Source License

public void addDateFields(Select select, HorizontalLayout addBar) {
    log.debug("DataGenEventHandler - addDateFields() method start");
    PopupDateField startDate = new PopupDateField();
    startDate.setInputPrompt("Start date");
    startDate.setDateFormat(select.getValue().toString());
    startDate.setResolution(PopupDateField.RESOLUTION_DAY);
    startDate.setWidth("120px");
    startDate.setLenient(true);//from  www  . ja  v a 2s.  c  om

    PopupDateField endDate = new PopupDateField();
    endDate.setInputPrompt("End date");
    endDate.setDateFormat(select.getValue().toString());
    endDate.setResolution(PopupDateField.RESOLUTION_DAY);
    endDate.setWidth("120px");
    endDate.setLenient(true);

    addBar.removeAllComponents();
    addBar.setSpacing(true);
    addBar.addComponent(startDate);
    addBar.setComponentAlignment(startDate, Alignment.MIDDLE_LEFT);
    addBar.addComponent(endDate);
    addBar.setComponentAlignment(endDate, Alignment.MIDDLE_LEFT);
    log.debug("DataGenEventHandler - addDateFields() method end");
}

From source file:com.esspl.datagen.util.DataGenEventHandler.java

License:Open Source License

public void addTextFields(HorizontalLayout addBar, String promptText1, String promptText2) {
    log.debug("DataGenEventHandler - addTextFields() method start");
    TextField first = new TextField();
    first.setInputPrompt(promptText1);//from   w  w w  .  j a v a 2s.co  m
    first.setWidth("95px");
    first.setImmediate(true);
    if (promptText1.endsWith("Length") || promptText1.endsWith("Number")
            || promptText1.equals("Starting From")) {
        first.addValidator(new IntegerValidator(promptText1 + " must be an Integer"));
    }

    TextField second = new TextField();
    second.setInputPrompt(promptText2);
    second.setWidth("95px");
    second.setImmediate(true);
    if (promptText2.endsWith("Length") || promptText2.endsWith("Number")
            || promptText2.equals("Starting From")) {
        second.addValidator(new IntegerValidator(promptText2 + " must be an Integer"));
    }

    addBar.removeAllComponents();
    addBar.setSpacing(true);
    addBar.addComponent(first);
    addBar.setComponentAlignment(first, Alignment.MIDDLE_LEFT);
    addBar.addComponent(second);
    addBar.setComponentAlignment(second, Alignment.MIDDLE_LEFT);
    log.debug("DataGenEventHandler - addTextFields() method end");
}

From source file:com.esspl.datagen.util.DataGenEventHandler.java

License:Open Source License

public void addSingleTextField(HorizontalLayout addBar, String promptText1) {
    log.debug("DataGenEventHandler - addSingleTextField() method start");
    TextField first = new TextField();
    first.setInputPrompt(promptText1);//from   w  w  w  .  j av  a  2  s  .  c  o  m
    first.setWidth("95px");
    first.setImmediate(true);
    if (promptText1.endsWith("Length") || promptText1.endsWith("Number")
            || promptText1.equals("Starting From")) {
        first.addValidator(new IntegerValidator(promptText1 + " must be an Integer"));
    }

    addBar.removeAllComponents();
    addBar.setSpacing(true);
    addBar.addComponent(first);
    addBar.setComponentAlignment(first, Alignment.MIDDLE_CENTER);
    log.debug("DataGenEventHandler - addSingleTextField() method end");
}

From source file:com.esspl.datagen.util.DataGenEventHandler.java

License:Open Source License

public void addChkTextField(HorizontalLayout addBar, String promptText1, String promptText2) {
    log.debug("DataGenEventHandler - addSingleTextField() method start");
    TextField first = new TextField();
    first.setInputPrompt(promptText1);// w w w.  ja v a2s  .  c o m
    first.setWidth("95px");
    first.setImmediate(true);
    if (promptText1.endsWith("Length") || promptText1.endsWith("Number")
            || promptText1.equals("Starting From")) {
        first.addValidator(new IntegerValidator(promptText1 + " must be an Integer"));
    }

    CheckBox cb = new CheckBox(promptText2);

    addBar.removeAllComponents();
    addBar.setSpacing(true);
    addBar.addComponent(first);
    addBar.setComponentAlignment(first, Alignment.MIDDLE_LEFT);
    addBar.addComponent(cb);
    addBar.setComponentAlignment(cb, Alignment.MIDDLE_LEFT);
    log.debug("DataGenEventHandler - addSingleTextField() method end");
}

From source file:com.etest.valo.ComboBoxes.java

License:Apache License

public ComboBoxes() {
    setMargin(true);// w  w w  . j  ava  2 s .  c om

    Label h1 = new Label("Combo Boxes");
    h1.addStyleName("h1");
    addComponent(h1);

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

    ComboBox combo = new ComboBox("Normal");
    combo.setInputPrompt("You can type here");
    combo.setContainerDataSource(MainUI.generateContainer(200, false));
    combo.setNullSelectionAllowed(false);
    combo.select(combo.getItemIds().iterator().next());
    combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(MainUI.ICON_PROPERTY);
    combo.setItemIcon(combo.getItemIds().iterator().next(), new ThemeResource("../runo/icons/16/document.png"));
    row.addComponent(combo);

    CssLayout group = new CssLayout();
    group.setCaption("Grouped with a Button");
    group.addStyleName("v-component-group");
    row.addComponent(group);

    combo = new ComboBox();
    combo.setInputPrompt("You can type here");
    combo.setContainerDataSource(MainUI.generateContainer(200, false));
    combo.setNullSelectionAllowed(false);
    combo.select(combo.getItemIds().iterator().next());
    combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(MainUI.ICON_PROPERTY);
    combo.setWidth("240px");
    group.addComponent(combo);
    Button today = new Button("Do It");
    group.addComponent(today);

    combo = new ComboBox("Explicit size");
    combo.setInputPrompt("You can type here");
    combo.addItem("Option One");
    combo.addItem("Option Two");
    combo.addItem("Option Three");
    combo.setWidth("260px");
    combo.setHeight("60px");
    row.addComponent(combo);

    combo = new ComboBox("No text input allowed");
    combo.setInputPrompt("You can click here");
    combo.addItem("Option One");
    combo.addItem("Option Two");
    combo.addItem("Option Three");
    combo.setTextInputAllowed(false);
    combo.setNullSelectionAllowed(false);
    combo.select("Option One");
    row.addComponent(combo);

    combo = new ComboBox("Error");
    combo.setInputPrompt("You can type here");
    combo.addItem("Option One");
    combo.addItem("Option Two");
    combo.addItem("Option Three");
    combo.setNullSelectionAllowed(false);
    combo.select("Option One");
    combo.setComponentError(new UserError("Fix it, now!"));
    row.addComponent(combo);

    combo = new ComboBox("Error, borderless");
    combo.setInputPrompt("You can type here");
    combo.addItem("Option One");
    combo.addItem("Option Two");
    combo.addItem("Option Three");
    combo.setNullSelectionAllowed(false);
    combo.select("Option One");
    combo.setComponentError(new UserError("Fix it, now!"));
    combo.addStyleName("borderless");
    row.addComponent(combo);

    combo = new ComboBox("Disabled");
    combo.setInputPrompt("You can't type here");
    combo.addItem("Option One");
    combo.addItem("Option Two");
    combo.addItem("Option Three");
    combo.setEnabled(false);
    row.addComponent(combo);

    combo = new ComboBox("Custom color");
    combo.setInputPrompt("You can type here");
    combo.setContainerDataSource(MainUI.generateContainer(200, false));
    combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(MainUI.ICON_PROPERTY);
    combo.addStyleName("color1");
    row.addComponent(combo);

    combo = new ComboBox("Custom color");
    combo.setInputPrompt("You can type here");
    combo.setContainerDataSource(MainUI.generateContainer(200, false));
    combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(MainUI.ICON_PROPERTY);
    combo.addStyleName("color2");
    row.addComponent(combo);

    combo = new ComboBox("Custom color");
    combo.setInputPrompt("You can type here");
    combo.setContainerDataSource(MainUI.generateContainer(200, false));
    combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(MainUI.ICON_PROPERTY);
    combo.addStyleName("color3");
    row.addComponent(combo);

    combo = new ComboBox("Small");
    combo.setInputPrompt("You can type here");
    combo.setContainerDataSource(MainUI.generateContainer(200, false));
    combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(MainUI.ICON_PROPERTY);
    combo.addStyleName("small");
    row.addComponent(combo);

    combo = new ComboBox("Large");
    combo.setInputPrompt("You can type here");
    combo.setContainerDataSource(MainUI.generateContainer(200, false));
    combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(MainUI.ICON_PROPERTY);
    combo.addStyleName("large");
    row.addComponent(combo);

    combo = new ComboBox("Borderless");
    combo.setInputPrompt("You can type here");
    combo.addItem("Option One");
    combo.addItem("Option Two");
    combo.addItem("Option Three");
    combo.addStyleName("borderless");
    row.addComponent(combo);

    combo = new ComboBox("Tiny");
    combo.setInputPrompt("You can type here");
    combo.setContainerDataSource(MainUI.generateContainer(200, false));
    combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(MainUI.ICON_PROPERTY);
    combo.addStyleName("tiny");
    row.addComponent(combo);

    combo = new ComboBox("Huge");
    combo.setInputPrompt("You can type here");
    combo.setContainerDataSource(MainUI.generateContainer(200, false));
    combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY);
    combo.setItemIconPropertyId(MainUI.ICON_PROPERTY);
    combo.addStyleName("huge");
    row.addComponent(combo);
}

From source file:com.etest.valo.Forms.java

License:Apache License

public Forms() {
    setSpacing(true);/*w ww  .j  a  v  a2s .  c  o m*/
    setMargin(true);

    Label title = new Label("Forms");
    title.addStyleName("h1");
    addComponent(title);

    final FormLayout form = new FormLayout();
    form.setMargin(false);
    form.setWidth("800px");
    form.addStyleName("light");
    addComponent(form);

    Label section = new Label("Personal Info");
    section.addStyleName("h2");
    section.addStyleName("colored");
    form.addComponent(section);
    StringGenerator sg = new StringGenerator();

    TextField name = new TextField("Name");
    name.setValue(sg.nextString(true) + " " + sg.nextString(true));
    name.setWidth("50%");
    form.addComponent(name);

    DateField birthday = new DateField("Birthday");
    birthday.setValue(new Date(80, 0, 31));
    form.addComponent(birthday);

    TextField username = new TextField("Username");
    username.setValue(sg.nextString(false) + sg.nextString(false));
    username.setRequired(true);
    form.addComponent(username);

    OptionGroup sex = new OptionGroup("Sex");
    sex.addItem("Female");
    sex.addItem("Male");
    sex.select("Male");
    sex.addStyleName("horizontal");
    form.addComponent(sex);

    section = new Label("Contact Info");
    section.addStyleName("h3");
    section.addStyleName("colored");
    form.addComponent(section);

    TextField email = new TextField("Email");
    email.setValue(sg.nextString(false) + "@" + sg.nextString(false) + ".com");
    email.setWidth("50%");
    email.setRequired(true);
    form.addComponent(email);

    TextField location = new TextField("Location");
    location.setValue(sg.nextString(true) + ", " + sg.nextString(true));
    location.setWidth("50%");
    location.setComponentError(new UserError("This address doesn't exist"));
    form.addComponent(location);

    TextField phone = new TextField("Phone");
    phone.setWidth("50%");
    form.addComponent(phone);

    HorizontalLayout wrap = new HorizontalLayout();
    wrap.setSpacing(true);
    wrap.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    wrap.setCaption("Newsletter");
    CheckBox newsletter = new CheckBox("Subscribe to newsletter", true);
    wrap.addComponent(newsletter);

    ComboBox period = new ComboBox();
    period.setTextInputAllowed(false);
    period.addItem("Daily");
    period.addItem("Weekly");
    period.addItem("Monthly");
    period.setNullSelectionAllowed(false);
    period.select("Weekly");
    period.addStyleName("small");
    period.setWidth("10em");
    wrap.addComponent(period);
    form.addComponent(wrap);

    section = new Label("Additional Info");
    section.addStyleName("h4");
    section.addStyleName("colored");
    form.addComponent(section);

    TextField website = new TextField("Website");
    website.setInputPrompt("http://");
    website.setWidth("100%");
    form.addComponent(website);

    TextArea shortbio = new TextArea("Short Bio");
    shortbio.setValue(
            "Quis aute iure reprehenderit in voluptate velit esse. Cras mattis iudicium purus sit amet fermentum.");
    shortbio.setWidth("100%");
    shortbio.setRows(2);
    form.addComponent(shortbio);

    final RichTextArea bio = new RichTextArea("Bio");
    bio.setWidth("100%");
    bio.setValue(
            "<div><p><span>Integer legentibus erat a ante historiarum dapibus.</span> <span>Vivamus sagittis lacus vel augue laoreet rutrum faucibus.</span> <span>A communi observantia non est recedendum.</span> <span>Morbi fringilla convallis sapien, id pulvinar odio volutpat.</span> <span>Ab illo tempore, ab est sed immemorabili.</span> <span>Quam temere in vitiis, legem sancimus haerentia.</span></p><p><span>Morbi odio eros, volutpat ut pharetra vitae, lobortis sed nibh.</span> <span>Quam diu etiam furor iste tuus nos eludet?</span> <span>Cum sociis natoque penatibus et magnis dis parturient.</span> <span>Quam diu etiam furor iste tuus nos eludet?</span> <span>Tityre, tu patulae recubans sub tegmine fagi  dolor.</span></p><p><span>Curabitur blandit tempus ardua ridiculus sed magna.</span> <span>Phasellus laoreet lorem vel dolor tempus vehicula.</span> <span>Etiam habebis sem dicantur magna mollis euismod.</span> <span>Hi omnes lingua, institutis, legibus inter se differunt.</span></p></div>");
    form.addComponent(bio);

    form.setReadOnly(true);
    bio.setReadOnly(true);

    Button edit = new Button("Edit", new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            boolean readOnly = form.isReadOnly();
            if (readOnly) {
                bio.setReadOnly(false);
                form.setReadOnly(false);
                form.removeStyleName("light");
                event.getButton().setCaption("Save");
                event.getButton().addStyleName("primary");
            } else {
                bio.setReadOnly(true);
                form.setReadOnly(true);
                form.addStyleName("light");
                event.getButton().setCaption("Edit");
                event.getButton().removeStyleName("primary");
            }
        }
    });

    HorizontalLayout footer = new HorizontalLayout();
    footer.setMargin(new MarginInfo(true, false, true, false));
    footer.setSpacing(true);
    footer.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    form.addComponent(footer);
    footer.addComponent(edit);

    Label lastModified = new Label("Last modified by you a minute ago");
    lastModified.addStyleName("light");
    footer.addComponent(lastModified);
}

From source file:com.etest.valo.MenuBars.java

License:Apache License

public MenuBars() {
    setMargin(true);/*from www . java2s  . c  om*/
    setSpacing(true);

    Label h1 = new Label("Menu Bars");
    h1.addStyleName("h1");
    addComponent(h1);

    MenuBar menuBar = getMenuBar();
    menuBar.setCaption("Normal style");
    addComponent(menuBar);

    menuBar = getMenuBar();
    menuBar.setCaption("Small style");
    menuBar.addStyleName("small");
    addComponent(menuBar);

    menuBar = getMenuBar();
    menuBar.setCaption("Borderless style");
    menuBar.addStyleName("borderless");
    addComponent(menuBar);

    menuBar = getMenuBar();
    menuBar.setCaption("Small borderless style");
    menuBar.addStyleName("borderless");
    menuBar.addStyleName("small");
    addComponent(menuBar);

    Label h2 = new Label("Drop Down Button");
    h2.addStyleName("h2");
    addComponent(h2);

    HorizontalLayout wrap = new HorizontalLayout();
    wrap.addStyleName("wrapping");
    wrap.setSpacing(true);
    addComponent(wrap);

    wrap.addComponent(getMenuButton("Normal", false));

    MenuBar split = getMenuButton("Small", false);
    split.addStyleName("small");
    wrap.addComponent(split);

    split = getMenuButton("Borderless", false);
    split.addStyleName("borderless");
    wrap.addComponent(split);

    split = getMenuButton("Themed", false);
    split.addStyleName("color1");
    wrap.addComponent(split);

    split = getMenuButton("Small", false);
    split.addStyleName("color1");
    split.addStyleName("small");
    wrap.addComponent(split);

    h2 = new Label("Split Button");
    h2.addStyleName("h2");
    addComponent(h2);

    wrap = new HorizontalLayout();
    wrap.addStyleName("wrapping");
    wrap.setSpacing(true);
    addComponent(wrap);

    wrap.addComponent(getMenuButton("Normal", true));

    split = getMenuButton("Small", true);
    split.addStyleName("small");
    wrap.addComponent(split);

    split = getMenuButton("Borderless", true);
    split.addStyleName("borderless");
    wrap.addComponent(split);

    split = getMenuButton("Themed", true);
    split.addStyleName("color1");
    wrap.addComponent(split);

    split = getMenuButton("Small", true);
    split.addStyleName("color1");
    split.addStyleName("small");
    wrap.addComponent(split);
}

From source file:com.etest.valo.Sliders.java

License:Apache License

public Sliders() {
    setMargin(true);//from  w  w  w  .j a v a 2 s .  co  m

    Label h1 = new Label("Sliders");
    h1.addStyleName("h1");
    addComponent(h1);

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

    Slider slider = new Slider("Horizontal");
    slider.setValue(50.0);
    row.addComponent(slider);

    slider = new Slider("Horizontal, sized");
    slider.setValue(50.0);
    slider.setWidth("200px");
    row.addComponent(slider);

    slider = new Slider("Custom handle");
    slider.setValue(50.0);
    slider.setWidth("200px");
    slider.addStyleName("color1");
    row.addComponent(slider);

    slider = new Slider("Custom track");
    slider.setValue(50.0);
    slider.setWidth("200px");
    slider.addStyleName("color2");
    row.addComponent(slider);

    slider = new Slider("Custom indicator");
    slider.setValue(50.0);
    slider.setWidth("200px");
    slider.addStyleName("color3");
    row.addComponent(slider);

    slider = new Slider("No indicator");
    slider.setValue(50.0);
    slider.setWidth("200px");
    slider.addStyleName("no-indicator");
    row.addComponent(slider);

    slider = new Slider("With ticks (not in IE8 & IE9)");
    slider.setValue(3.0);
    slider.setWidth("200px");
    slider.setMax(4);
    slider.addStyleName("ticks");
    row.addComponent(slider);

    slider = new Slider("Toggle imitation");
    slider.setWidth("50px");
    slider.setResolution(0);
    slider.setMin(0);
    slider.setMax(1);
    row.addComponent(slider);

    slider = new Slider("Vertical");
    slider.setValue(50.0);
    slider.setOrientation(SliderOrientation.VERTICAL);
    row.addComponent(slider);

    slider = new Slider("Vertical, sized");
    slider.setValue(50.0);
    slider.setOrientation(SliderOrientation.VERTICAL);
    slider.setHeight("200px");
    row.addComponent(slider);

    slider = new Slider("Custom handle");
    slider.setValue(50.0);
    slider.setHeight("200px");
    slider.addStyleName("color1");
    slider.setOrientation(SliderOrientation.VERTICAL);
    row.addComponent(slider);

    slider = new Slider("Custom track");
    slider.setValue(50.0);
    slider.setHeight("200px");
    slider.addStyleName("color2");
    slider.setOrientation(SliderOrientation.VERTICAL);
    row.addComponent(slider);

    slider = new Slider("Custom indicator");
    slider.setValue(50.0);
    slider.setHeight("200px");
    slider.addStyleName("color3");
    slider.setOrientation(SliderOrientation.VERTICAL);
    row.addComponent(slider);

    slider = new Slider("No indicator");
    slider.setValue(50.0);
    slider.setHeight("200px");
    slider.addStyleName("no-indicator");
    slider.setOrientation(SliderOrientation.VERTICAL);
    row.addComponent(slider);

    slider = new Slider("With ticks");
    slider.setValue(3.0);
    slider.setHeight("200px");
    slider.setMax(4);
    slider.addStyleName("ticks");
    slider.setOrientation(SliderOrientation.VERTICAL);
    row.addComponent(slider);

    slider = new Slider("Disabled");
    slider.setValue(50.0);
    slider.setEnabled(false);
    row.addComponent(slider);

    h1 = new Label("Progress Bars");
    h1.addStyleName("h1");
    addComponent(h1);

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

    pb = new ProgressBar();
    pb.setCaption("Default");
    pb.setWidth("300px");
    // pb.setValue(0.6f);
    row.addComponent(pb);

    pb2 = new ProgressBar();
    pb2.setCaption("Point style");
    pb2.setWidth("300px");
    pb2.addStyleName("point");
    // pb2.setValue(0.6f);
    row.addComponent(pb2);

    if (!MainUI.isTestMode()) {
        ProgressBar pb3 = new ProgressBar();
        pb3.setIndeterminate(true);
        pb3.setCaption("Indeterminate");
        row.addComponent(pb3);
    }
}