Example usage for com.vaadin.ui HorizontalLayout setMargin

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

Introduction

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

Prototype

@Override
    public void setMargin(boolean enabled) 

Source Link

Usage

From source file:com.esofthead.mycollab.vaadin.ui.DynamicQueryParamLayout.java

License:Open Source License

public ComponentContainer constructFooter() {
    HorizontalLayout buttonControls = createButtonControls();
    buttonControls.setMargin(new MarginInfo(false, true, false, true));
    return buttonControls;
}

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();/*w  w w .j  ava 2s.  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 onChangeFormat(ValueChangeEvent event, Select select) {
    log.debug("DataGenEventHandler - onChangeFormat() method start");
    int rowId = (Integer) select.getData();
    DataGenApplication tdg = (DataGenApplication) select.getApplication();
    Item item = tdg.listing.getItem(rowId);
    Label exampleSel = (Label) item.getItemProperty("Examples").getValue();
    Select dataSel = (Select) item.getItemProperty("Data Type").getValue();
    HorizontalLayout addBar = (HorizontalLayout) item.getItemProperty("Additional Data").getValue();
    addBar.setMargin(false);

    if (event.getProperty().getValue() == null) {
        exampleSel.setValue("NA");
        return;/*from w w  w.  ja  va2  s  .  c  o m*/
    }
    //Name examples
    if (event.getProperty().getValue().equals("First_Name Last_Name")) {
        exampleSel.setValue(df.getName("First_Name Last_Name"));
    } else if (event.getProperty().getValue().equals("First_Name")) {
        exampleSel.setValue(df.getName("First_Name"));
    } else if (event.getProperty().getValue().equals("Last_Name")) {
        exampleSel.setValue(df.getName("Last_Name"));
    } else if (event.getProperty().getValue().equals("Sur_Name Last_Name")) {
        exampleSel.setValue(df.getName("Sur_Name Last_Name"));
    } else if (event.getProperty().getValue().equals("Sur_Name First_Name")) {
        exampleSel.setValue(df.getName("Sur_Name First_Name"));
    } else if (event.getProperty().getValue().equals("Sur_Name First_Name Last_Name")) {
        exampleSel.setValue(df.getName("Sur_Name First_Name Last_Name"));
    } else if (event.getProperty().getValue().equals("MM/dd/yyyy")) {//Date Examples start
        exampleSel.setValue(df.getDate("MM/dd/yyyy", "", ""));
        addDateFields(select, addBar);
    } else if (event.getProperty().getValue().equals("dd/MM/yyyy")) {
        exampleSel.setValue(df.getDate("dd/MM/yyyy", "", ""));
        addDateFields(select, addBar);
    } else if (event.getProperty().getValue().equals("yyyy-MM-dd")) {
        exampleSel.setValue(df.getDate("yyyy-MM-dd", "", ""));
        addDateFields(select, addBar);
    } else if (event.getProperty().getValue().equals("MMM dd, yyyy")) {
        exampleSel.setValue(df.getDate("MMM dd, yyyy", "", ""));
        addDateFields(select, addBar);
    } else if (event.getProperty().getValue().equals("dd MMM, yy")) {
        exampleSel.setValue(df.getDate("dd MMM, yy", "", ""));
        addDateFields(select, addBar);
    } else if (event.getProperty().getValue().equals("yyyy-MM-dd HH:mm:ss")) {
        exampleSel.setValue(df.getDate("yyyy-MM-dd HH:mm:ss", "", ""));
        addDateFields(select, addBar);
    } else if (event.getProperty().getValue().equals("MM/dd/yyyy HH:mm:ss")) {
        exampleSel.setValue(df.getDate("MM/dd/yyyy HH:mm:ss", "", ""));
        addDateFields(select, addBar);
    } else if (event.getProperty().getValue().equals("MM.dd.yyyy")) {
        exampleSel.setValue(df.getDate("MM.dd.yyyy", "", ""));
        addDateFields(select, addBar);
    } else if (event.getProperty().getValue().equals("dd.MM.yyyy")) {
        exampleSel.setValue(df.getDate("dd.MM.yyyy", "", ""));
        addDateFields(select, addBar);
    } else if (event.getProperty().getValue().equals("India") && dataSel.getValue().equals("Phone/Fax")) {//Phone Examples start
        exampleSel.setValue(df.getPhoneNumber("India"));
    } else if (event.getProperty().getValue().equals("USA/Canada") && dataSel.getValue().equals("Phone/Fax")) {
        exampleSel.setValue(df.getPhoneNumber("USA/Canada"));
    } else if (event.getProperty().getValue().equals("UK") && dataSel.getValue().equals("Phone/Fax")) {
        exampleSel.setValue(df.getPhoneNumber("UK"));
    } else if (event.getProperty().getValue().equals("India") && dataSel.getValue().equals("Postal/Zip")) {//Zip Examples start
        exampleSel.setValue(df.getZipCode("India"));
    } else if (event.getProperty().getValue().equals("Canada") && dataSel.getValue().equals("Postal/Zip")) {
        exampleSel.setValue(df.getZipCode("Canada"));
    } else if (event.getProperty().getValue().equals("USA") && dataSel.getValue().equals("Postal/Zip")) {
        exampleSel.setValue(df.getZipCode("USA"));
    } else if (event.getProperty().getValue().equals("Full")) {//State Examples start
        exampleSel.setValue(df.getState("Full"));
    } else if (event.getProperty().getValue().equals("Sort")) {
        exampleSel.setValue(df.getState("Sort"));
    }
    log.debug("DataGenEventHandler - onChangeFormat() method end");
}

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

License:Apache License

public Forms() {
    setSpacing(true);// ww w  .  j a  va2s .co 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.view.tq.reports.OnlineQueriesUI.java

public OnlineQueriesUI() {
    setWidth("100%");
    setMargin(true);/*  www  .  j  a v a 2  s  .c o m*/
    setSpacing(true);

    Label lineSeparator1 = new Label();
    lineSeparator1.setContentMode(ContentMode.HTML);
    lineSeparator1.setStyleName("line-separator");

    Label lineSeparator2 = new Label();
    lineSeparator2.setContentMode(ContentMode.HTML);
    lineSeparator2.setStyleName("line-separator");

    disableAllComponents(false);

    GridLayout topGrid = new GridLayout(3, 2);
    topGrid.setWidth("800px");
    topGrid.setSpacing(true);

    VerticalLayout top = new VerticalLayout();
    top.setWidth("166px");

    graphicalInventory.addItem("Graphical Inventory");
    graphicalInventory.setWidth("300px");
    top.addComponent(graphicalInventory);
    graphicalInventory.addValueChangeListener(firstLevelOptionListener);
    graphicalInventory.setImmediate(true);

    graphicalInventoryGroup.addItem("All Subjects");

    Label subjectProportionedCaption = new Label();
    subjectProportionedCaption.setWidth("500px");
    subjectProportionedCaption
            .setCaption("A Subject's No. of Items Proportioned " + "According to the Revised Bloom's Taxonomy");
    subjectProportionedCaption.setContentMode(ContentMode.HTML);
    subjectProportionedCaption.setHeightUndefined();

    graphicalInventoryGroup.addItem(subjectProportionedCaption.getCaption());
    graphicalInventoryGroup.setWidth("400px");
    graphicalInventoryGroup.addValueChangeListener(secondLevelTopOptionListener);
    graphicalInventoryGroup.setImmediate(true);

    topGrid.addComponent(top, 0, 0);
    topGrid.addComponent(graphicalInventoryGroup, 1, 0, 2, 0);
    addComponent(topGrid);

    searchSubject1.setInputPrompt("Search Subject");
    searchSubject1.setWidth("225px");
    searchSubject1.addValueChangeListener(dropDownChangeListener);
    searchSubject1.setEnabled(false);
    topGrid.addComponent(searchSubject1, 1, 1);

    addComponent(lineSeparator1);

    GridLayout bottomGrid = new GridLayout(3, 3);
    bottomGrid.setWidth("800px");
    bottomGrid.setSpacing(true);

    VerticalLayout bottom = new VerticalLayout();
    bottom.setWidth("235px");

    itemAnalysis.addItem("Item Analysis");
    itemAnalysis.setWidth("310px");
    bottom.addComponent(itemAnalysis);
    itemAnalysis.addValueChangeListener(firstLevelOptionListener);
    itemAnalysis.setImmediate(true);

    graphicalView.addItem("Graphical View");
    graphicalView.setWidth("210px");
    graphicalView.addValueChangeListener(secondLevelBottomOptionListener);
    graphicalView.setImmediate(true);

    tabularView.addItem("Tabular View");
    tabularView.addValueChangeListener(secondLevelBottomOptionListener);
    tabularView.setImmediate(true);

    graphicalViewGroup.addItem("Summary: All Tests of a Subject");
    graphicalViewGroup.addItem("Difficulty Index of a Subject's Test");
    graphicalViewGroup.addItem("Discrimination Index of a Subject's Test");
    graphicalViewGroup.setWidth("300px");
    graphicalViewGroup.addValueChangeListener(thirdLevelBottomOptionListener);
    graphicalViewGroup.setImmediate(true);

    tabularViewGroup.addItem("Summary: All Tests of a Subject");
    tabularViewGroup.addItem("Critical values of a test");
    tabularViewGroup.addValueChangeListener(thirdLevelBottomOptionListener);
    tabularViewGroup.setImmediate(true);

    searchSubject2.setInputPrompt("Search Subject");
    searchSubject2.setWidth("225px");
    searchSubject2.addValueChangeListener(dropDownChangeListener);
    searchSubject2.setEnabled(false);
    searchTest.setWidth("225px");
    searchTest.setInputPrompt("Search Test");
    searchTest.setEnabled(false);
    searchTest.addStyleName(ValoTheme.COMBOBOX_SMALL);

    bottomGrid.addComponent(bottom, 0, 0);
    bottomGrid.addComponent(graphicalView, 1, 0);
    bottomGrid.addComponent(tabularView, 1, 1);
    bottomGrid.addComponent(graphicalViewGroup, 2, 0);
    bottomGrid.addComponent(tabularViewGroup, 2, 1);
    bottomGrid.addComponent(searchSubject2, 1, 2);
    bottomGrid.addComponent(searchTest, 2, 2);
    addComponent(bottomGrid);

    addComponent(lineSeparator2);

    HorizontalLayout h = new HorizontalLayout();
    h.setWidth("100%");
    h.setMargin(true);

    Button calculateAndViewBtn = new Button("Calculate & View");
    calculateAndViewBtn.setWidth("300px");
    calculateAndViewBtn.addClickListener(buttonClickListener);
    h.addComponent(calculateAndViewBtn);
    h.setComponentAlignment(calculateAndViewBtn, Alignment.MIDDLE_LEFT);
    addComponent(calculateAndViewBtn);

}

From source file:com.expressui.core.view.entityselect.EntitySelectResults.java

License:Open Source License

@PostConstruct
@Override/*  w  ww  .  j  a va2  s. c  o  m*/
public void postConstruct() {
    super.postConstruct();
    addSelectionChangedListener(this, "selectionChanged");

    HorizontalLayout crudButtons = new HorizontalLayout();
    setDebugId(crudButtons, "crudButtons");
    crudButtons.setMargin(false);
    crudButtons.setSpacing(true);

    selectButton = new Button(uiMessageSource.getMessage("results.select"));
    selectButton.setDescription(uiMessageSource.getToolTip("results.select.toolTip"));
    selectButton.setEnabled(false);
    selectButton.addStyleName("small default");
    crudButtons.addComponent(selectButton);

    getCrudButtons().addComponent(crudButtons, 0);
    getCrudButtons().setComponentAlignment(crudButtons, Alignment.MIDDLE_LEFT);

    getEntityQuery().setPageSize(applicationProperties.getDefaultSelectPageSize());

    addCodePopupButtonIfEnabled(EntitySelectResults.class);
}

From source file:com.expressui.core.view.export.ExportForm.java

License:Open Source License

@Override
protected void createFooterButtons(HorizontalLayout footerLayout) {
    footerLayout.setSpacing(true);/*from   w w  w .ja  va 2  s .  c  o m*/
    footerLayout.setMargin(true);

    Button closeButton = new Button(uiMessageSource.getMessage("exportForm.close"), this, "close");
    closeButton.setDescription(uiMessageSource.getToolTip("exportForm.close.toolTip"));
    closeButton.setIcon(new ThemeResource("../expressui/icons/16/delete.png"));
    closeButton.addStyleName("small default");
    footerLayout.addComponent(closeButton);

    exportButton = new Button(uiMessageSource.getMessage("exportForm.export"));
    exportButton.setDescription(uiMessageSource.getToolTip("exportForm.export.toolTip"));
    exportButton.setIcon(new ThemeResource("../expressui/icons/16/excel.bmp"));
    exportButton.addStyleName("small default");
    footerLayout.addComponent(exportButton);
}

From source file:com.expressui.core.view.form.EntityForm.java

License:Open Source License

/**
 * Creates the footer buttons: cancel, refresh, save.
 *
 * @param footerLayout horizontal layout containing buttons
 *//*from ww  w .j  ava 2s  .  c  o m*/
@Override
protected void createFooterButtons(HorizontalLayout footerLayout) {
    footerLayout.setSpacing(true);
    footerLayout.setMargin(true);

    cancelButton = new Button(uiMessageSource.getMessage("entityForm.cancel"), this, "cancel");
    cancelButton.setDescription(uiMessageSource.getToolTip("entityForm.cancel.toolTip"));
    cancelButton.setIcon(new ThemeResource("../expressui/icons/16/cancel.png"));
    cancelButton.addStyleName("small default");
    footerLayout.addComponent(cancelButton);

    refreshButton = new Button(uiMessageSource.getMessage("entityForm.refresh"), this, "refresh");
    refreshButton.setDescription(uiMessageSource.getToolTip("entityForm.refresh.toolTip"));
    refreshButton.setIcon(new ThemeResource("../expressui/icons/16/refresh.png"));
    refreshButton.addStyleName("small default");
    footerLayout.addComponent(refreshButton);

    saveAndStayOpenButton = new Button(uiMessageSource.getMessage("entityForm.saveAndStayOpen"), this,
            "saveAndStayOpen");
    saveAndStayOpenButton.setDescription(uiMessageSource.getToolTip("entityForm.saveAndStayOpen.toolTip"));
    saveAndStayOpenButton.setIcon(new ThemeResource("../expressui/icons/16/save.png"));
    saveAndStayOpenButton.addStyleName("small default");
    footerLayout.addComponent(saveAndStayOpenButton);

    saveAndCloseButton = new Button(uiMessageSource.getMessage("entityForm.saveAndClose"), this,
            "saveAndClose");
    saveAndCloseButton.setDescription(uiMessageSource.getToolTip("entityForm.saveAndClose.toolTip"));
    saveAndCloseButton.setIcon(new ThemeResource("../expressui/icons/16/save.png"));
    saveAndCloseButton.addStyleName("small default");
    footerLayout.addComponent(saveAndCloseButton);

    backupSaveButtonIcons();
}

From source file:com.expressui.core.view.form.ResultsConnectedEntityForm.java

License:Open Source License

private HorizontalLayout createNavigationFormLayout() {
    HorizontalLayout navigationFormLayout = new HorizontalLayout();
    String id = StringUtil.generateDebugId("e", this, navigationFormLayout, "navigationFormLayout");
    navigationFormLayout.setDebugId(id);
    navigationFormLayout.setSizeUndefined();

    VerticalLayout previousButtonLayout = new VerticalLayout();
    id = StringUtil.generateDebugId("e", this, previousButtonLayout, "previousButtonLayout");
    previousButtonLayout.setDebugId(id);

    previousButtonLayout.setSizeUndefined();
    previousButtonLayout.setMargin(false);
    previousButtonLayout.setSpacing(false);
    Label spaceLabel = new Label("</br></br></br>", Label.CONTENT_XHTML);
    spaceLabel.setSizeUndefined();//from   www. j av a 2  s.  c  o m
    previousButtonLayout.addComponent(spaceLabel);

    Button previousButton = new Button(null, this, "previousItem");
    previousButton.setDescription(entityForm.uiMessageSource.getToolTip("entityForm.previous.toolTip"));
    previousButton.setSizeUndefined();
    previousButton.addStyleName("borderless");
    previousButton.setIcon(new ThemeResource("../expressui/icons/16/previous.png"));

    if (entityForm.getViewableToManyRelationships().size() == 0) {
        HorizontalLayout previousButtonHorizontalLayout = new HorizontalLayout();
        id = StringUtil.generateDebugId("e", this, previousButtonHorizontalLayout,
                "previousButtonHorizontalLayout");
        previousButtonHorizontalLayout.setDebugId(id);
        previousButtonHorizontalLayout.setSizeUndefined();
        Label horizontalSpaceLabel = new Label("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", Label.CONTENT_XHTML);
        horizontalSpaceLabel.setSizeUndefined();
        previousButtonHorizontalLayout.addComponent(previousButton);
        previousButtonHorizontalLayout.addComponent(horizontalSpaceLabel);
        previousButtonLayout.addComponent(previousButtonHorizontalLayout);
    } else {
        previousButtonLayout.addComponent(previousButton);
    }

    navigationFormLayout.addComponent(previousButtonLayout);
    navigationFormLayout.setComponentAlignment(previousButtonLayout, Alignment.TOP_LEFT);

    navigationFormLayout.addComponent(entityForm);

    VerticalLayout nextButtonLayout = new VerticalLayout();
    id = StringUtil.generateDebugId("e", this, nextButtonLayout, "nextButtonLayout");
    nextButtonLayout.setDebugId(id);
    nextButtonLayout.setSizeUndefined();
    nextButtonLayout.setMargin(false);
    nextButtonLayout.setSpacing(false);
    spaceLabel = new Label("</br></br></br>", Label.CONTENT_XHTML);
    spaceLabel.setSizeUndefined();
    previousButtonLayout.addComponent(spaceLabel);
    nextButtonLayout.addComponent(spaceLabel);

    Button nextButton = new Button(null, this, "nextItem");
    nextButton.setDescription(entityForm.uiMessageSource.getToolTip("entityForm.next.toolTip"));
    nextButton.setSizeUndefined();
    nextButton.addStyleName("borderless");
    nextButton.setIcon(new ThemeResource("../expressui/icons/16/next.png"));

    HorizontalLayout nextButtonHorizontalLayout = new HorizontalLayout();
    id = StringUtil.generateDebugId("e", this, nextButtonHorizontalLayout, "nextButtonHorizontalLayout");
    nextButtonHorizontalLayout.setDebugId(id);
    nextButtonHorizontalLayout.setSizeUndefined();
    Label horizontalSpaceLabel = new Label("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", Label.CONTENT_XHTML);
    horizontalSpaceLabel.setSizeUndefined();
    nextButtonHorizontalLayout.addComponent(horizontalSpaceLabel);
    nextButtonHorizontalLayout.addComponent(nextButton);

    nextButtonLayout.addComponent(nextButtonHorizontalLayout);
    navigationFormLayout.addComponent(nextButtonLayout);
    navigationFormLayout.setComponentAlignment(nextButtonLayout, Alignment.TOP_RIGHT);

    navigationFormLayout.setSpacing(false);
    navigationFormLayout.setMargin(false);

    return navigationFormLayout;
}

From source file:com.expressui.core.view.form.SearchForm.java

License:Open Source License

@Override
protected void createFooterButtons(HorizontalLayout footerLayout) {
    footerLayout.setSpacing(true);//from  ww w . j  av a2  s.c om
    footerLayout.setMargin(true);

    Button clearButton = new Button(uiMessageSource.getMessage("searchForm.clear"), this, "clear");
    clearButton.setDescription(uiMessageSource.getToolTip("searchForm.clear.toolTip"));
    clearButton.setIcon(new ThemeResource("../expressui/icons/16/clear.png"));
    clearButton.addStyleName("small default");
    footerLayout.addComponent(clearButton);

    Button searchButton = new Button(uiMessageSource.getMessage("searchForm.search"), this, "search");
    searchButton.setDescription(uiMessageSource.getToolTip("searchForm.search.toolTip"));
    searchButton.setIcon(new ThemeResource("../expressui/icons/16/search.png"));
    searchButton.addStyleName("small default");
    footerLayout.addComponent(searchButton);
}