Ladies_Man

customRadioButtons

Mar 7th, 2017
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.56 KB | None | 0 0
  1. package ru.pochta.abon.cabinet.ui.layout;
  2.  
  3. import com.vaadin.ui.*;
  4.  
  5. import java.util.List;
  6.  
  7. public abstract class CustomRadioButtonLayout extends CssLayout{
  8.  
  9.     List<Object> icons;
  10.     List<String> captions;
  11.     List<String> descriptions;
  12.  
  13.     void initLayout() {
  14.         setPrimaryStyleName("customRadioButtonLayout");
  15.  
  16.  
  17.         HorizontalLayout placeholder = new HorizontalLayout();
  18.  
  19.  
  20.         HorizontalLayout layout = new HorizontalLayout();
  21.  
  22.         System.out.println("caps:" + captions.size());
  23.         captions.forEach(System.out::println);
  24.  
  25.         for (int i = 0; i < 3; i++) {
  26.             VerticalLayout radioButton = new VerticalLayout();
  27.             radioButton.addStyleName("customRadioButtonLayout");
  28.             radioButton.addStyleName("radioButton");
  29.  
  30.             Component icon = new Label("icon " + i);
  31.             radioButton.addComponent(icon);
  32.             radioButton.setComponentAlignment(icon, Alignment.MIDDLE_CENTER);
  33.  
  34.             Component caption = new Label("label " + i);
  35.             radioButton.addComponent(caption);
  36.             radioButton.setComponentAlignment(caption, Alignment.MIDDLE_CENTER);
  37.  
  38.             Component description = new Label("descr " + i);
  39.             radioButton.addComponent(description);
  40.  
  41.             layout.addComponent(radioButton);
  42.             layout.setComponentAlignment(radioButton, Alignment.MIDDLE_CENTER);
  43.         }
  44.  
  45.         placeholder.addComponent(layout);
  46.         placeholder.setComponentAlignment(layout, Alignment.MIDDLE_CENTER);
  47.  
  48.         this.addComponent(placeholder);
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment