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); }
/** @return the Panel containing input text fields */ public Component createInputPanel() { Panel inputPanel = new Panel("Send Message"); inputPanel.addComponent(createPanelLayout("App URL", urlTextField, "http://127.0.0.1:8080/")); inputPanel.addComponent(createPanelLayout("Phone #", phoneNoField, "94721345678")); inputPanel.addComponent(createPanelLayout("Message ", messageField, "Message Content")); Button sendButton = createSendMsgButton(); inputPanel.addComponent(sendButton); final AbstractOrderedLayout content = (AbstractOrderedLayout) inputPanel.getContent(); content.setSpacing(true); content.setComponentAlignment(sendButton, Alignment.BOTTOM_RIGHT); return inputPanel; }
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); }