Esempio n. 1
0
  private final void init() {

    if (content instanceof AbstractOrderedLayout) {
      ((AbstractOrderedLayout) content).setSpacing(true);
      ((AbstractOrderedLayout) content).setMargin(true);
    }
    if (content instanceof GridLayout) {
      addStyleName("marginTop");
    }

    if (null != content) {
      mainLayout.addComponent(content);
      mainLayout.setExpandRatio(content, 1.0F);
    }

    createMandatoryLabel();

    final HorizontalLayout buttonLayout = createActionButtonsLayout();
    mainLayout.addComponent(buttonLayout);
    mainLayout.setComponentAlignment(buttonLayout, Alignment.TOP_CENTER);

    setCaption(caption);
    setCaptionAsHtml(true);
    setContent(mainLayout);
    setResizable(false);
    center();
    setModal(true);
    addStyleName("fontsize");
    setOrginaleValues();
    addComponentListeners();
  }
  @Override
  protected Component getRenderComponent(final AbstractOrderedLayout orderedLayout) {
    if (GroupType.COLLAPSIBLE.equals(getVElement().getGroupType())) {
      final VerticalLayout mainLayout = new VerticalLayout();
      final NativeButton collapseButton =
          new NativeButton(
              StringUtils.EMPTY,
              new Button.ClickListener() {

                @Override
                public void buttonClick(ClickEvent event) {
                  final boolean switchVisible = !orderedLayout.isVisible();
                  setCollapseStyle(event.getButton(), switchVisible);
                  orderedLayout.setVisible(switchVisible);
                }
              });
      collapseButton.setWidth(100, Unit.PERCENTAGE);
      mainLayout.addComponent(collapseButton);
      mainLayout.addComponent(orderedLayout);
      orderedLayout.setMargin(true);
      orderedLayout.setSpacing(true);
      orderedLayout.setVisible(getVElement().isCollapsed());
      setCollapseStyle(collapseButton, getVElement().isCollapsed());
      mainLayout.addStyleName(GROUP_STYLE_NAME);
      return mainLayout;
    }
    return super.getRenderComponent(orderedLayout);
  }
Esempio n. 3
0
  private void createUI(AbstractOrderedLayout layout) {
    Button b = new Button("This is a button");
    CheckBox cb = new CheckBox("This is a checkbox");
    cb.setImmediate(true);
    setTheme("tests-tickets");
    layout.setStyleName("mylayout");
    status = new Label("Result:");
    layout.addComponent(status);
    layout.setSpacing(true);
    layout.setMargin(true);

    layout.addComponent(b);
    layout.addComponent(cb);

    layout.addComponent(new Label("a"));
    layout.addComponent(new Label("b"));
    layout.addComponent(new Label("c"));

    checkButton(Button.class);
    checkCheckBox(CheckBox.class);
    checkDataBinding(CheckBox.class);
  }