Example usage for com.vaadin.ui Button setHeight

List of usage examples for com.vaadin.ui Button setHeight

Introduction

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

Prototype

@Override
    public void setHeight(float height, Unit unit) 

Source Link

Usage

From source file:com.klwork.explorer.ui.mainlayout.MainMenuBar.java

License:Apache License

protected Button addMenuButton(String type, String label, Resource icon, boolean active, float width) {
    Button button = new Button(label);
    button.addStyleName(type);/*ww  w . jav a 2  s .com*/
    button.addStyleName(ExplorerLayout.STYLE_MAIN_MENU_BUTTON);
    button.addStyleName(Reindeer.BUTTON_LINK);
    button.setHeight(54, Unit.PIXELS);
    button.setIcon(icon);
    button.setWidth(width, Unit.PIXELS);

    addComponent(button);
    setComponentAlignment(button, Alignment.TOP_CENTER);

    return button;
}

From source file:com.logicbomb.newschool.pages.masterpages.PrimaryMasterPage.java

public PrimaryMasterPage() {

    //ContextWidget c= new ContextWidget();

    HorizontalLayout iHorizontalLayout = new HorizontalLayout();
    //addComponent(iHorizontalLayout,"top:0px;left:0px");
    iHorizontalLayout.setWidth(String.valueOf(Page.getCurrent().getBrowserWindowWidth()));
    iHorizontalLayout.setHeight(String.valueOf(Page.getCurrent().getBrowserWindowHeight()));
    iHorizontalLayout.setStyleName("backColorBlack");

    //String[] captions1 = {"Logo Here", "My Cool School", "Third"};

    //Layout A and its sub components
    Panel AP = new Panel();
    iHorizontalLayout.addComponent(AP);//from   ww w.  ja va 2s .c  om
    AP.setSizeFull();
    AP.setStyleName("backColorBlack");
    VerticalLayout A1 = new VerticalLayout();
    AP.setContent(A1);
    //A.setSizeFull();
    A1.setSpacing(true);
    iHorizontalLayout.setExpandRatio(AP, 1);

    A1.setStyleName("backColorBlack");
    A1.setMargin(new MarginInfo(true, true, true, true));

    Button logoImage = new Button();
    logoImage.setIcon(FontAwesome.PICTURE_O);
    logoImage.setWidth("80px");
    logoImage.setHeight(logoImage.getWidth(), Unit.PIXELS);
    //logoImage.setWidth("100px");
    A1.addComponent(logoImage);
    A1.setComponentAlignment(logoImage, Alignment.TOP_CENTER);

    Label schoolName = new Label("The School Of Future");
    schoolName.setStyleName("v-label-big");
    A1.addComponent(schoolName);
    //A.setComponentAlignment(schoolName,Alignment.TOP_CENTER);

    Label schoolMinorName = new Label("Random Branch");
    schoolMinorName.setStyleName("v-label-small");
    A1.addComponent(schoolMinorName);

    VerticalLayout A2 = new VerticalLayout();
    A1.addComponent(A2);
    MainMenuWidget iMainMenuWidget = new MainMenuWidget();
    A2.addComponent(iMainMenuWidget);

    //A.setComponentAlignment(schoolName,Alignment.TOP_CENTER);

    //Layout B
    ContextWidgetTop c = new ContextWidgetTop();
    c = ContextWidgetTop.ContextWidgetTransformer(c, new UserDetailsWidget(), SliderMode.TOP,
            SliderPanelStyles.COLOR_RED);
    VerticalLayout B = new VerticalLayout();
    B.setSizeFull();
    //B.setSpacing(true);
    iHorizontalLayout.addComponent(c);
    c.addComponent(B);
    iHorizontalLayout.setExpandRatio(c, 7);

    //Layout B1 and its sub Components
    HorizontalLayout B1 = new HorizontalLayout();
    B.addComponent(B1);
    //B.setExpandRatio(B1, 1);
    //B1.setHeight("70px");
    B1.setSizeFull();
    //B1=ContextWidget.ContextWidgetTransformer(B1, new SliderMasterPage(),SliderMode.RIGHT,SliderPanelStyles.COLOR_RED);

    HorizontalLayout B11 = new HorizontalLayout();
    B1.addComponent(B11);
    B1.setStyleName("backColorBlack");
    B11.setSizeFull();
    B1.setHeight("45px");
    //B1.setStyleName("backColorWhite");
    //B1.setMargin(new MarginInfo(false, true, false, true));

    TextField iTextField = new TextField();
    iTextField.setWidth("200px");
    iTextField.setInputPrompt("Search!");
    iTextField.setStyleName("v-text-type-search");
    iTextField.focus();
    B11.addComponent(iTextField);
    B11.setComponentAlignment(iTextField, Alignment.MIDDLE_LEFT);

    //Layout B2 and its Sub Components
    ContextWidget B2 = new ContextWidget();
    B2.setSizeFull();
    B.addComponent(B2);
    B.setExpandRatio(B2, 10);
    B2 = ContextWidget.ContextWidgetTransformer(B2, new SliderMasterPage(), SliderMode.RIGHT,
            SliderPanelStyles.COLOR_BLUE);
    //B2=ContextWidget.ContextWidgetTransformer(B2, new SliderMasterPage(),SliderMode.TOP,SliderPanelStyles.COLOR_RED);
    VerticalLayout v = new VerticalLayout();
    B2.addComponent(v);

    Button b1111 = new Button(
            "Put all the inner components like this Put all the inner components like this Put all the inner components like this Put all the inner components like this");
    v.addComponent(b1111);
    Button b1112 = new Button("Put all the inner components like this");
    v.addComponent(b1112);

    /*
    Panel p = new Panel();
    VerticalLayout v= new VerticalLayout();
    v.addComponent(new TextField("Name"));
    v.addComponent(new TextField("Street address"));
    v.addComponent(new TextField("Postal code"));
    p.setContent(v);
    B2.addComponent(p);
    v.setWidth(String.valueOf(B2.getWidth()*10)+"px");
    //v.setSizeFull();// <- This will cause issues. Don't do this
    p.setSizeFull();
    */

    //ContextWidget iContextPanel= new ContextWidget(p);
    //B2.addComponent(iContextPanel);
    //setPosition(p, iComponentPositionPanel);

    addComponent(iHorizontalLayout);
}

From source file:org.activiti.explorer.ui.mainlayout.MainMenuBar.java

License:Apache License

protected Button addMenuButton(String type, String label, Resource icon, boolean active, float width) {
    Button button = new Button(label);
    button.addStyleName(type);//www.j  a va  2  s .c o  m
    button.addStyleName(ExplorerLayout.STYLE_MAIN_MENU_BUTTON);
    button.addStyleName(Reindeer.BUTTON_LINK);
    button.setHeight(54, UNITS_PIXELS);
    button.setIcon(icon);
    button.setWidth(width, UNITS_PIXELS);

    addComponent(button);
    setComponentAlignment(button, Alignment.TOP_CENTER);

    return button;
}

From source file:org.activiti.kickstart.ui.MainMenuBar.java

License:Apache License

protected Button addMenuButton(String label, Resource icon, boolean active, float width) {
    Button button = new Button(label);
    button.addStyleName(STYLE_MAIN_MENU_BUTTON);
    button.addStyleName(Reindeer.BUTTON_LINK);
    button.setHeight(54, UNITS_PIXELS);
    button.setIcon(icon);/*from ww  w .  j a  v  a  2  s  .c  o m*/
    button.setWidth(width, UNITS_PIXELS);

    addComponent(button);
    setComponentAlignment(button, Alignment.TOP_CENTER);

    return button;
}

From source file:org.apache.tamaya.ui.NavBar.java

License:Apache License

public void addViewButton(final String uri, String displayName) {
    Button viewButton = new Button(displayName, new Button.ClickListener() {
        @Override//from   www. ja  v a  2  s . c o  m
        public void buttonClick(Button.ClickEvent clickEvent) {
            EventBus.post(new NavigationEvent(uri));
        }
    });
    viewButton.addStyleName(UIConstants.BUTTON_LOGOUT);
    // viewButton.addStyleName(UIConstants.MENU_ITEM);
    viewButton.addStyleName(UIConstants.BUTTON_BORDERLESS);
    addComponent(viewButton, components.size() - 1);
    viewButton.setHeight(20, Unit.PIXELS);

    buttonMap.put(uri, viewButton);
}

From source file:org.inakirj.imagerulette.screens.DicePlayView.java

License:Open Source License

/**
 * Sets the layout.//from  w  ww  .j a  v  a2 s  .c  om
 */
private void setLayout() {
    mainLayout = new VerticalLayout();
    mainLayout.setWidth(100, Unit.PERCENTAGE);
    FileResource resource = new FileResource(new File(
            VaadinService.getCurrent().getBaseDirectory().getAbsolutePath() + "/WEB-INF/image/nope.png"));
    Image none = new Image("", resource);
    randomImgToBeReplaced = none;
    randomImgToBeReplaced.setWidth(78, Unit.PIXELS);
    randomImgToBeReplaced.setHeight(81, Unit.PIXELS);
    randomImgToBeReplaced.addStyleName("random-image");

    imageLayout = new HorizontalLayout();
    imageLayout.addComponent(randomImgToBeReplaced);
    imageLayout.setWidth(100, Unit.PERCENTAGE);
    imageLayout.setComponentAlignment(randomImgToBeReplaced, Alignment.TOP_CENTER);

    Button rollBtn = new Button();
    rollBtn.addClickListener(e -> onPickABallClick());
    rollBtn.setWidth(25, Unit.PERCENTAGE);
    rollBtn.setHeight(50, Unit.PIXELS);
    rollBtn.setIcon(FontAwesome.CUBE);
    rollBtn.addStyleName("dice-button-roll");

    mainLayout.addComponent(imageLayout);
    mainLayout.addComponent(rollBtn);
    mainLayout.setComponentAlignment(rollBtn, Alignment.BOTTOM_CENTER);

    calculateStats();
    addComponent(mainLayout);
}