@Test public void testAlignment() { AbstractOrderedLayout layout = new AbstractOrderedLayout() {}; AbstractComponent first = new AbstractComponent() {}; AbstractComponent second = new AbstractComponent() {}; layout.addComponent(first); layout.addComponent(second); Alignment alignment = Alignment.BOTTOM_RIGHT; layout.setComponentAlignment(first, alignment); layout.setComponentAlignment(second, Alignment.MIDDLE_CENTER); AbstractComponent replace = new AbstractComponent() {}; layout.replaceComponent(first, replace); Assert.assertEquals( "Alignment for replaced component is not " + "the same as for previous one", alignment, layout.getComponentAlignment(replace)); }
/** @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; }