Example usage for com.vaadin.ui NativeButton NativeButton

List of usage examples for com.vaadin.ui NativeButton NativeButton

Introduction

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

Prototype

public NativeButton() 

Source Link

Usage

From source file:jcaster_vaadin.Gui2.java

License:Open Source License

@AutoGenerated
private GridLayout buildGridLayout_3() {
    // common part: create layout
    gridLayout_3 = new GridLayout();
    gridLayout_3.setWidth("100.0%");
    gridLayout_3.setHeight("100.0%");
    gridLayout_3.setImmediate(false);//from   w ww .j a v a2s . co  m
    gridLayout_3.setMargin(false);
    gridLayout_3.setSpacing(true);
    gridLayout_3.setColumns(4);
    gridLayout_3.setRows(7);

    // flnmLbl
    flnmLbl = new Label();
    flnmLbl.setWidth("-1px");
    flnmLbl.setHeight("-1px");
    flnmLbl.setValue("Filename");
    flnmLbl.setImmediate(false);
    gridLayout_3.addComponent(flnmLbl, 0, 1);

    // txtFlnm
    txtFlnm = new TextField();
    txtFlnm.setWidth("-1px");
    txtFlnm.setHeight("-1px");
    txtFlnm.setImmediate(false);
    txtFlnm.setValue("test"); //set default filename
    gridLayout_3.addComponent(txtFlnm, 1, 1);

    // svlcLbl
    svlcLbl = new Label();
    svlcLbl.setWidth("-1px");
    svlcLbl.setHeight("-1px");
    svlcLbl.setValue("Save location");
    svlcLbl.setImmediate(false);
    gridLayout_3.addComponent(svlcLbl, 0, 2);

    // txtSvLc
    txtSvLc = new TextField();
    txtSvLc.setWidth("-1px");
    txtSvLc.setHeight("-1px");
    txtSvLc.setImmediate(false);
    txtSvLc.setValue(System.getProperty("user.home") + File.separator);
    gridLayout_3.addComponent(txtSvLc, 1, 2);

    // brwBtn
    brwBtn = new NativeButton();
    brwBtn.setWidth("-1px");
    brwBtn.setHeight("-1px");
    brwBtn.setCaption("Browse...");
    brwBtn.setImmediate(true);
    gridLayout_3.addComponent(brwBtn, 2, 2);

    brwBtn.addListener(new Button.ClickListener() {

        private static final long serialVersionUID = -8389582613309805795L;

        public void buttonClick(Button.ClickEvent event) {
            //            browse();
        }
    });

    // rcrdLbl
    rcrdLbl = new Label();
    rcrdLbl.setWidth("-1px");
    rcrdLbl.setHeight("-1px");
    rcrdLbl.setValue("Record type");
    rcrdLbl.setImmediate(false);
    gridLayout_3.addComponent(rcrdLbl, 0, 3);

    // slctRrcdTp
    slctRrcdTp = new NativeSelect();
    slctRrcdTp.setWidth("-1px");
    slctRrcdTp.setHeight("-1px");
    slctRrcdTp.setImmediate(false);
    slctRrcdTp.addItem("audio+video");
    slctRrcdTp.addItem("video only");
    slctRrcdTp.addItem("audio only");
    slctRrcdTp.setValue("audio+video"); //set default record type
    gridLayout_3.addComponent(slctRrcdTp, 1, 3);

    // RcrdCtdLbl
    RcrdCtdLbl = new Label();
    RcrdCtdLbl.setWidth("-1px");
    RcrdCtdLbl.setHeight("-1px");
    RcrdCtdLbl.setValue("Recording countdown");
    RcrdCtdLbl.setImmediate(false);
    gridLayout_3.addComponent(RcrdCtdLbl, 0, 4);

    // txtRrcdCtd
    txtRrcdCtd = new TextField();
    txtRrcdCtd.setWidth("-1px");
    txtRrcdCtd.setHeight("-1px");
    txtRrcdCtd.setValue(0);
    txtRrcdCtd.setImmediate(false);
    gridLayout_3.addComponent(txtRrcdCtd, 1, 4);

    // DrRcrdLbl
    DrRcrdLbl = new Label();
    DrRcrdLbl.setWidth("-1px");
    DrRcrdLbl.setHeight("-1px");
    DrRcrdLbl.setValue("Duration of record");
    DrRcrdLbl.setImmediate(false);
    gridLayout_3.addComponent(DrRcrdLbl, 0, 5);

    // txtDrRcrd
    txtDrRcrd = new TextField();
    txtDrRcrd.setWidth("-1px");
    txtDrRcrd.setHeight("-1px");
    txtDrRcrd.setValue(0);
    txtDrRcrd.setImmediate(false);
    gridLayout_3.addComponent(txtDrRcrd, 1, 5);

    return gridLayout_3;
}

From source file:nl.amc.biolab.nsg.display.component.MainUI.java

License:Open Source License

private HorizontalLayout buildTopPanelLeft() {
    HorizontalLayout topPanelLeft = new HorizontalLayout();
    topPanelLeft.setImmediate(true);// www  .j  a  v  a 2s.c  o  m
    topPanelLeft.setWidth("-1px");
    topPanelLeft.setHeight("-1px");
    topPanelLeft.setMargin(false);
    topPanelLeft.setSpacing(false);

    // updateCatButton = new NativeButton();
    // updateCatButton.setCaption("synchronize data");
    // updateCatButton.setVisible(false);
    // topPanelLeft.addComponent(updateCatButton);
    // topPanelLeft.setComponentAlignment(updateCatButton, new
    // Alignment(33));

    projectsButton = new NativeButton();
    projectsButton.setImmediate(true);
    projectsButton.setWidth("-1px");
    projectsButton.setHeight("-1px");
    projectsButton.setHtmlContentAllowed(true);

    elementsButton = new NativeButton();
    elementsButton.setCaption("data");
    elementsButton.setImmediate(true);
    elementsButton.setWidth("-1px");
    elementsButton.setHeight("-1px");
    elementsButton.setHtmlContentAllowed(true);

    processingsButton = new NativeButton();
    processingsButton.setImmediate(true);
    processingsButton.setWidth("-1px");
    processingsButton.setHeight("-1px");
    processingsButton.setHtmlContentAllowed(true);

    return topPanelLeft;
}

From source file:nl.amc.biolab.nsg.display.component.MainUI.java

License:Open Source License

private HorizontalLayout buildTopPanelMid() {
    // common part: create layout
    HorizontalLayout topPanelMid = new HorizontalLayout();
    topPanelMid.setImmediate(false);//  w  ww. ja  va  2  s  .  co m
    topPanelMid.setWidth("-1px");
    topPanelMid.setHeight("-1px");
    topPanelMid.setMargin(false);
    topPanelMid.setSpacing(true);

    // searchLabel
    searchLabel = new Label();
    searchLabel.setImmediate(false);
    searchLabel.setWidth("-1px");
    searchLabel.setHeight("-1px");
    searchLabel.setValue("search ");
    topPanelMid.addComponent(searchLabel);
    topPanelMid.setComponentAlignment(searchLabel, Alignment.MIDDLE_CENTER);

    // searchSelect
    searchSelect = new Select();
    searchSelect.setImmediate(false);
    searchSelect.setWidth("-1px");
    searchSelect.setHeight("-1px");
    topPanelMid.addComponent(searchSelect);
    topPanelMid.setComponentAlignment(searchSelect, Alignment.MIDDLE_CENTER);

    // label_1
    label_1 = new Label();
    label_1.setImmediate(false);
    label_1.setWidth("-1px");
    label_1.setHeight("-1px");
    label_1.setValue(" with ");
    topPanelMid.addComponent(label_1);
    topPanelMid.setComponentAlignment(label_1, Alignment.MIDDLE_CENTER);

    // searchTextField
    searchTextField = new TextField();
    searchTextField.setImmediate(false);
    searchTextField.setWidth("-1px");
    searchTextField.setHeight("-1px");
    topPanelMid.addComponent(searchTextField);
    topPanelMid.setComponentAlignment(searchTextField, Alignment.MIDDLE_CENTER);

    searchButton = new NativeButton();
    searchButton.setCaption("refine search");
    topPanelMid.addComponent(searchButton);
    topPanelMid.setComponentAlignment(searchButton, Alignment.MIDDLE_CENTER);

    allSearchButton = new NativeButton();
    allSearchButton.setCaption("search in all columns");
    topPanelMid.addComponent(allSearchButton);
    topPanelMid.setComponentAlignment(allSearchButton, Alignment.MIDDLE_CENTER);

    newSearchButton = new NativeButton();
    newSearchButton.setCaption("new search");
    topPanelMid.addComponent(newSearchButton);
    topPanelMid.setComponentAlignment(newSearchButton, Alignment.MIDDLE_CENTER);

    return topPanelMid;
}

From source file:nl.amc.biolab.nsg.display.component.MainUI.java

License:Open Source License

private HorizontalLayout buildTopPanelRight() {
    // common part: create layout
    pagePanel = new HorizontalLayout();
    pagePanel.setStyleName("topPanel");
    pagePanel.setImmediate(false);/*from  w w  w .j a va  2  s  . c  o  m*/
    pagePanel.setWidth("-1px");
    pagePanel.setHeight("-1px");
    pagePanel.setSpacing(true);

    // dataElementButton
    dataElementButton = new NativeButton();
    dataElementButton.setCaption("view");
    dataElementButton.setImmediate(true);
    dataElementButton.setWidth("-1px");
    dataElementButton.setHeight("-1px");
    pagePanel.addComponent(dataElementButton);
    pagePanel.setComponentAlignment(dataElementButton, new Alignment(34));
    dataElementButton.setVisible(false);

    // processingButton
    processingButton = new NativeButton();
    processingButton.setCaption("use data");
    processingButton.setImmediate(true);
    processingButton.setWidth("-1px");
    processingButton.setHeight("-1px");
    pagePanel.addComponent(processingButton);
    pagePanel.setComponentAlignment(processingButton, new Alignment(34));

    return pagePanel;
}

From source file:nl.amc.biolab.nsg.display.component.ProcessingForm.java

License:Open Source License

public void setButtons() {
    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setHeight("40px");
    buttons.setSpacing(true);/* w  w  w .j  a va 2  s  . c o m*/
    getLayout().addComponent(buttons);

    final Button startButton = new NativeButton();

    startButton.setCaption(SUBMIT);
    startButton.setImmediate(true);
    startButton.setWidth("-1px");
    startButton.setHeight("-1px");
    startButton.addListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1906358615316029946L;

        public void buttonClick(ClickEvent event) {
            System.out.println(app.getValue());

            Set<Long> inputDbIds = new HashSet<Long>();

            for (Object iid : inputData.getItemIds()) {
                inputData.select(iid);

                inputDbIds.add(((DataElement) iid).getDbId());
            }

            ((VaadinTestApplication) getApplication()).getUserDataService().setDataElementDbIds(inputDbIds);

            form.commit();

            processing.setApplication((Application) app.getValue());

            startButton.setData(processing);

            form.fireEvent(new Event(startButton));
        }
    });

    buttons.addComponent(startButton);
    buttons.setComponentAlignment(startButton, Alignment.TOP_RIGHT);

    final Button delButton = new NativeButton();
    delButton.setCaption("remove inputs");
    delButton.setImmediate(true);
    delButton.setWidth("-1px");
    delButton.setHeight("-1px");
    delButton.addListener(new Button.ClickListener() {
        private static final long serialVersionUID = -3377452914254101817L;

        @SuppressWarnings("unchecked")
        public void buttonClick(ClickEvent event) {
            if (inputData.getValue() != null) {
                for (DataElement de : (Set<DataElement>) inputData.getValue()) {
                    inputData.removeItem(de);
                    dataElements.remove(de);
                }
            }
        }
    });
    buttons.addComponent(delButton);
    buttons.setComponentAlignment(delButton, Alignment.TOP_RIGHT);
}

From source file:nl.amc.biolab.nsg.display.component.ProcessingStatusForm.java

License:Open Source License

@Override
protected List<Component> createButtons() {
    List<Component> buttons = new ArrayList<Component>();
    final VaadinTestApplication app = (VaadinTestApplication) getApplication();

    refreshButton = new NativeButton();
    refreshButton.setCaption(REFRESH);//from w w  w .java 2s  . c o  m
    refreshButton.setDescription("Refresh the status of this processing");
    refreshButton.setData(processingStatus);
    refreshButton.addListener(new Button.ClickListener() {
        private static final long serialVersionUID = -4193539828744300010L;

        @Override
        public void buttonClick(ClickEvent event) {
            refreshButton.setData(processingStatus);
            userDataService.reopenSession();
            processingStatusForm.fireValueChange(false);
        }
    });

    resumeAllButton = new NativeButton();
    resumeAllButton.setCaption(RESUME_ALL);
    resumeAllButton.setDescription("Resume all submissions that are on hold.");
    resumeAllButton.addListener(new Button.ClickListener() {
        private static final long serialVersionUID = -8752115869501927142L;

        @Override
        public void buttonClick(ClickEvent event) {
            processingService.resubmit(processingStatus.getProcessing().getDbId());
            processingStatusForm.attach();
        }
    });

    cancelButton = new NativeButton();
    cancelButton.setCaption(CANCEL);
    cancelButton.setDescription("Cancel this processing");
    cancelButton.addListener(new Button.ClickListener() {
        private static final long serialVersionUID = -1060436804385447671L;

        @Override
        public void buttonClick(ClickEvent event) {
            //                logger.debug("Cancel button is clicked.");
            processingService.markFailed(processingStatus.getProcessing().getDbId());
            processingStatusForm.fireValueChange(false);
        }
    });

    deleteFilesButton = new NativeButton();
    deleteFilesButton.setCaption(DELETE_FILES);
    deleteFilesButton.setDescription(
            "Delete the copies of input and output files related to this processing from the grid");
    deleteFilesButton.addListener(new Button.ClickListener() {
        private static final long serialVersionUID = -2563970523271864224L;

        @Override
        public void buttonClick(ClickEvent event) {
            //                logger.debug("Delete Files button is clicked.");
            getApplication().getMainWindow().showNotification("Not implemented yet.");
        }
    });

    reportButton = new NativeButton();
    reportButton.setCaption(REPORT);
    reportButton.setDescription("Get a summary of what happened to this processing");
    reportButton.addListener(new Button.ClickListener() {
        private static final long serialVersionUID = -216255929194718747L;

        @Override
        public void buttonClick(ClickEvent event) {
            //                logger.debug("Report button is clicked.");
            final String htmlContent = userDataService
                    .getProcessingReport(processingStatus.getProcessing().getDbId());
            showHTML(htmlContent, app);
        }
    });

    restartButton = new NativeButton();
    restartButton.setCaption(RESTART);
    restartButton.setDescription("Start a new processing to run the same application on the same data");
    restartButton.addListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1474073840913621689L;

        @Override
        public void buttonClick(ClickEvent event) {
            //                logger.debug("Restart button is clicked.");
            processingService.restart(processingStatus.getProcessing().getDbId());
            processingStatusForm.fireValueChange(false);
        }
    });

    if (app == null) {
        System.out.println("app is null");
    } else if (app.getUserDataService() == null) {
        System.out.println("app user data service is null");
    } else {
        refreshButton.setVisible(false);
        resumeAllButton.setVisible(false);
    }

    buttons.add(refreshButton);
    buttons.add(resumeAllButton);

    return buttons;
}

From source file:org.eclipse.skalli.view.internal.window.ProjectEditPanelEntry.java

License:Open Source License

@SuppressWarnings("serial")
private ComponentContainer createTray() {
    CssLayout layout = new CssLayout();
    layout.setStyleName(STYLE_TRAY);/*from  w  w  w  . j  av a2s  . com*/
    layout.setMargin(true);

    HorizontalLayout header = new HorizontalLayout();
    header.setSpacing(true);
    header.setStyleName(STYLE_TRAY_HEADER);
    header.setWidth("100%"); //$NON-NLS-1$

    trayIcon = new Embedded();
    trayIcon.setStyleName(STYLE_TRAY_HEADER_ICON);

    final String icon = formService.getIconPath();
    if (StringUtils.isNotBlank(icon)) {
        trayIcon.setSource(new StreamResource(new ExtensionStreamSource(formService.getClass(), icon),
                FilenameUtils.getName(icon), application));
    }
    header.addComponent(trayIcon);
    header.setComponentAlignment(trayIcon, Alignment.MIDDLE_LEFT);
    header.setExpandRatio(trayIcon, 0);

    Label captionLabel = new Label(getCaptionWithAnchor(), Label.CONTENT_XHTML);
    captionLabel.setStyleName(STYLE_TRAY_HEADER_LABEL);
    header.addComponent(captionLabel);
    header.setExpandRatio(captionLabel, 1);
    header.setComponentAlignment(captionLabel, Alignment.MIDDLE_LEFT);

    editButton = new Button();
    layoutLinkButton(editButton, header, new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            switch (state) {
            case DISABLED:
                setState(TrayState.EDITABLE_VISIBLE);
                break;
            case INHERITED_VISIBLE:
                setState(TrayState.EDITABLE_VISIBLE);
                break;
            case INHERITED_INVISIBLE:
                setState(TrayState.EDITABLE_VISIBLE);
                break;
            }
        }
    });

    inheritButton = new Button();
    layoutLinkButton(inheritButton, header, new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            form.commit();
            switch (state) {
            case DISABLED:
                setState(TrayState.INHERITED_VISIBLE);
                break;
            case EDITABLE_VISIBLE:
                setState(TrayState.INHERITED_VISIBLE);
                break;
            case EDITABLE_INVISIBLE:
                setState(TrayState.INHERITED_VISIBLE);
                break;
            }
        }
    });

    disableButton = new Button();
    layoutLinkButton(disableButton, header, new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            form.commit();
            switch (state) {
            case EDITABLE_INVISIBLE:
                setState(TrayState.DISABLED);
                break;
            case EDITABLE_VISIBLE:
                setState(TrayState.DISABLED);
                break;
            case INHERITED_INVISIBLE:
                setState(TrayState.DISABLED);
                break;
            case INHERITED_VISIBLE:
                setState(TrayState.DISABLED);
                break;
            }
        }
    });

    visibleButton = new NativeButton();
    layoutIconButton(visibleButton, header, new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            switch (state) {
            case EDITABLE_INVISIBLE:
                setState(TrayState.EDITABLE_VISIBLE);
                break;
            case EDITABLE_VISIBLE:
                setState(TrayState.EDITABLE_INVISIBLE);
                break;
            case INHERITED_INVISIBLE:
                setState(TrayState.INHERITED_VISIBLE);
                break;
            case INHERITED_VISIBLE:
                setState(TrayState.INHERITED_INVISIBLE);
                break;
            }
        }
    });

    layout.addComponent(header);

    CssLayout content = new CssLayout();
    Label descriptionLabel = new Label(extensionService.getDescription(), Label.CONTENT_XHTML);
    descriptionLabel.setStyleName(STYLE_TRAY_DESCRIPTION);
    content.addComponent(descriptionLabel);

    layout.addComponent(content);
    return layout;
}

From source file:org.jdal.vaadin.ui.table.VaadinPaginator.java

License:Apache License

private Button createButton(String icon) {
    Button b = nativeButtons ? new NativeButton() : new Button();
    b.setIcon(new ThemeResource(icon));

    return b;/*w  ww  . ja  va2  s .  c o m*/
}

From source file:org.lunifera.runtime.web.vaadin.components.fields.BeanReferenceField.java

License:Open Source License

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override/*www  . java  2s . c o m*/
protected Component initContent() {

    HorizontalLayout root = new HorizontalLayout();
    root.addStyleName("l-beansearchfield");
    comboBox = new CustomComboBox();
    comboBox.setImmediate(true);
    comboBox.setNullSelectionAllowed(false);
    comboBox.setInvalidAllowed(false);

    BeanServiceLazyLoadingContainer container = new BeanServiceLazyLoadingContainer(searchService, type,
            sharedState);
    // add the passed container filter
    if (filter != null) {
        container.addContainerFilter(filter);
    }
    comboBox.setContainerDataSource(container);
    comboBox.setFilteringMode(FilteringMode.CONTAINS);

    if (itemCaptionPropertyId != null) {
        comboBox.setItemCaptionPropertyId(itemCaptionPropertyId);
    }

    if (itemIconPropertyId != null) {
        comboBox.setItemIconPropertyId(itemIconPropertyId);
    }

    NativeButton searchButton = new NativeButton();
    searchButton.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            openSearchDialog();
        }
    });
    searchButton.setWidth("26px");
    searchButton.setIcon(new ThemeResource("icons/SearchButton.png"));

    root.addComponent(comboBox);
    root.addComponent(searchButton);

    // Create the property
    comboBox.setPropertyDataSource(property);

    // Create the bindings
    // valueBinding =
    // dbc.bindValue(VaadinObservables.observeValue(comboBox),
    // PojoObservables.observeValue(property, "value"));

    return root;
}