Example usage for com.vaadin.ui NativeButton setWidth

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

Introduction

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

Prototype

@Override
    public void setWidth(String width) 

Source Link

Usage

From source file:com.foc.vaadin.FocWebVaadinWindow.java

License:Apache License

protected void menuBarIcons_Add(String menuItem, NativeButton button) {
    if (menuBarIconsMap == null) {
        menuBarIconsMap = new HashMap<String, NativeButton>();
    }/*from   w  w w.  ja v  a2 s. c o m*/
    menuBarIconsMap.put(menuItem, button);
    button.addStyleName("foc-f22");
    button.addStyleName("foc-text-center");
    button.setWidth("40px");
}

From source file:com.foc.vaadin.gui.layouts.validationLayout.FVOptionMobileLayout.java

License:Apache License

public void fill() {
    if (focWebVaadinWindow != null) {
        focWebVaadinWindow.getCentralHeader().markAsDirty();
        if (validationLayout != null && validationLayout.getMenubar(false) != null) {
            FVMenuBar menuBar = validationLayout.getMenubar(false);
            addMoreItemsAsButtons(menuBar);
        }/*from  www  .  j  a  v  a 2 s . co  m*/
        NativeButton logoutButton = focWebVaadinWindow.getLogoutButton();
        if (logoutButton != null) {
            logoutButton.setCaption("Logout");
            logoutButton.setWidth("100%");
            addComponent(logoutButton);
        }
        NativeButton adminButton = focWebVaadinWindow.getAdminButton();
        if (adminButton != null) {
            adminButton.setCaption("Admin");
            adminButton.setWidth("100%");
            addComponent(adminButton);
        }
    }
    if (validationLayout != null) {
        FVViewSelector_MenuBar viewSelector = validationLayout.getViewSelector(true);
        viewSelector.addStyleName("focBannerButton");
        viewSelector.setWidth("100%");
        addComponent(viewSelector);
    }
    NativeButton closeButton = getCloseButton();
    addComponent(closeButton);
}

From source file:com.foc.vaadin.gui.layouts.validationLayout.FVOptionMobileLayout.java

License:Apache License

private void addMoreItemsAsButtons(FVMenuBar menuBar) {
    List<MenuItem> munItemList = menuBar.getItems();

    if (munItemList.size() > 0) {
        MenuItem moreItem = munItemList.get(0);
        if (moreItem != null) {
            List<MenuItem> children = moreItem.getChildren();
            for (int i = 0; i < children.size(); i++) {
                MenuItem menuItem = children.get(i);
                if (menuItem != null) {
                    String title = menuItem.getText();
                    FVMenuBarCommand menuBarCommand = (FVMenuBarCommand) menuItem.getCommand();
                    if (menuBarCommand != null) {
                        NativeButton button = new NativeButton(title);
                        button.setWidth("100%");
                        button.setHeight("40px");
                        button.addStyleName("focBannerButton");
                        addComponent(button);
                        button.addClickListener(new MenuItemButtonClickListener(menuItem, menuBarCommand));
                    }/*ww  w  .j  a va 2  s.  c  o m*/
                }
            }
        }
    }

}

From source file:edu.kit.dama.ui.repo.MyVaadinUI.java

License:Apache License

/**
 * Build the search view and execute the provided query immediately.
 *
 * @param pQuery The query to execute or null if an empty view should be
 * shown./*from ww w  .j a  v a2s.  c o  m*/
 */
private void buildSearchView(String pQuery) {
    loginButton.setWidth("70px");
    loginButton.setStyleName(BaseTheme.BUTTON_LINK);
    logoutButton.setWidth("70px");
    logoutButton.setStyleName(BaseTheme.BUTTON_LINK);
    adminButton.setWidth("70px");
    adminButton.setStyleName(BaseTheme.BUTTON_LINK);

    logoutButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            loggedInUser = UserData.NO_USER;
            refreshMainLayout();
        }
    });

    adminButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            Page.getCurrent()
                    .open(DataManagerSettings.getSingleton().getStringProperty(
                            DataManagerSettings.GENERAL_BASE_URL_ID, "http://localhost:8889/BaReDemo")
                            + "/admin", "_blank");
        }
    });

    searchField = UIUtils7.factoryTextField(null, "Search for...");
    searchField.setWidth("920px");
    searchField.setHeight("60px");
    searchField.addStyleName("searchField");

    paginationPanel = new PaginationPanel(this);
    paginationPanel.setSizeFull();
    paginationPanel.setAllEntries(new LinkedList<DigitalObjectId>());

    searchProvider = new FulltextElasticSearchProvider(
            DataManagerSettings.getSingleton()
                    .getStringProperty(DataManagerSettings.ELASTIC_SEARCH_DEFAULT_CLUSTER_ID, "KITDataManager"),
            DataManagerSettings.getSingleton()
                    .getStringProperty(DataManagerSettings.ELASTIC_SEARCH_DEFAULT_HOST_ID, "localhost"),
            DataManagerSettings.getSingleton().getStringProperty(
                    DataManagerSettings.ELASTIC_SEARCH_DEFAULT_INDEX_ID,
                    ElasticsearchHelper.ELASTICSEARCH_TYPE),
            ElasticsearchHelper.ELASTICSEARCH_TYPE);
    NativeButton goButton = new NativeButton();
    goButton.setIcon(new ThemeResource("img/24x24/search.png"));
    goButton.setWidth("60px");
    goButton.setHeight("60px");
    goButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            doSearch();
        }
    });
    goButton.setClickShortcut(KeyCode.ENTER);

    setupLoginForm();
    loginForm.setWidth("320px");
    loginForm.setHeight("150px");
    final PopupView loginPopup = new PopupView(null, loginForm);
    loginPopup.setHideOnMouseOut(false);
    loginButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            //mainLayout.replaceComponent(searchLayout, loginForm);
            loginPopup.setPopupVisible(true);
        }
    });

    Label filler = new Label();
    memberLayout = new HorizontalLayout(filler, adminButton, loginButton, loginPopup);
    memberLayout.setComponentAlignment(loginButton, Alignment.TOP_RIGHT);
    memberLayout.setComponentAlignment(adminButton, Alignment.TOP_RIGHT);
    memberLayout.setComponentAlignment(loginPopup, Alignment.TOP_RIGHT);

    memberLayout.setExpandRatio(filler, 1.0f);
    memberLayout.setMargin(false);
    memberLayout.setSpacing(false);
    memberLayout.setWidth("100%");
    memberLayout.setHeight("30px");

    Label spacer = new Label("<hr/>", ContentMode.HTML);
    spacer.setHeight("20px");

    searchLayout = new UIUtils7.GridLayoutBuilder(3, 4)
            .addComponent(searchField, Alignment.TOP_LEFT, 0, 0, 2, 1)
            .addComponent(goButton, Alignment.TOP_RIGHT, 2, 0, 1, 1).fillRow(spacer, 0, 1, 1)
            .addComponent(paginationPanel, Alignment.MIDDLE_CENTER, 0, 2, 3, 2).getLayout();
    searchLayout.addStyleName("paper");
    searchLayout.setSpacing(true);
    searchLayout.setMargin(true);
    paginationPanel.setWidth("980px");
    //wrapper
    Label icon8Link = new Label("<a href=\"http://icons8.com\">Icons by icon8.com</a>", ContentMode.HTML);
    mainLayout = new VerticalLayout(memberLayout, searchLayout, icon8Link);
    mainLayout.setComponentAlignment(memberLayout, Alignment.TOP_CENTER);
    mainLayout.setComponentAlignment(searchLayout, Alignment.TOP_CENTER);
    mainLayout.setComponentAlignment(icon8Link, Alignment.BOTTOM_RIGHT);
    mainLayout.setExpandRatio(memberLayout, .05f);
    mainLayout.setExpandRatio(searchLayout, .93f);
    mainLayout.setExpandRatio(icon8Link, .02f);

    VerticalLayout fullscreen = new VerticalLayout(mainLayout);
    fullscreen.setComponentAlignment(mainLayout, Alignment.TOP_CENTER);
    fullscreen.setSizeFull();
    setContent(fullscreen);

    mainLayout.setWidth("1024px");
    mainLayout.setHeight("768px");

    if (pQuery != null) {
        searchField.setValue(pQuery);
        doSearch();
    }
}

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

License:Open Source License

@HibernateSessionThreadLocalConstructor
public CardChainTreeTablePopup(Object rootId, boolean modal, boolean wantSaveButton) {
    super(null);//from w  ww  .j  a v  a 2s.co  m
    setWidth("600px");
    setHeight("400px");
    addStyleName("m-noborder"); // V7 difference

    super.initGui();
    selectedId = tempSelectedId = rootId;
    setModal(modal);
    setListener(this);
    setResizable(true);

    setTitleString("Card chain");
    saveClicked = false;

    contentVLayout.setSpacing(true);

    treeT = new CardChainTree(rootId, false, !modal);
    if (rootId == null) {
        setTitleString("Card chains");
        // instead, do some creative backgrounding to pseudo select children of a card, treeT.setMultiSelect(true);
    }
    //treeT.setSizeFull();
    treeT.setWidth("99%");
    treeT.setHeight("99%");
    treeT.addItemClickListener((ItemClickListener) this);
    treeT.addStyleName("m-greyborder");
    contentVLayout.addComponent(treeT);
    contentVLayout.setComponentAlignment(treeT, Alignment.MIDDLE_CENTER);
    contentVLayout.setExpandRatio(treeT, 1.0f);

    /* todo...the saved data was never being retrieved, should pass it back to create action plan panel */

    if (wantSaveButton) {
        // need a save button
        HorizontalLayout hl = new HorizontalLayout();
        hl.setWidth("100%");
        contentVLayout.addComponent(hl);
        Label lab;
        hl.addComponent(lab = new Label());
        hl.setExpandRatio(lab, 1.0f);

        NativeButton saveButt = new NativeButton();
        hl.addComponent(saveButt);
        saveButt.setIcon(Mmowgli2UI.getGlobals().getMediaLocator().getSaveButtonIcon());
        saveButt.setWidth("45px"); //38px");
        saveButt.setHeight("16px");
        saveButt.addStyleName("borderless");
        saveButt.addClickListener(saveListener = new SaveListener());
        saveButt.setClickShortcut(KeyCode.ENTER);
        hl.addComponent(lab = new Label());
        lab.setWidth("30px");
        contentVLayout.addComponent(hl);
    }
}

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

License:Open Source License

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override/*w w  w  . j ava2  s .  co 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;
}