use of com.github.bordertech.wcomponents.WPanel in project wcomponents by BorderTech.
the class WRowExample method createRow.
/**
* Creates a row containing columns with the given widths.
*
* @param hgap the horizontal gap between columns, in pixels.
* @param colWidths the percentage widths for each column.
* @return a WRow containing columns with the given widths.
*/
private WRow createRow(final int hgap, final int[] colWidths) {
WRow row = new WRow(hgap);
for (int i = 0; i < colWidths.length; i++) {
WColumn col = new WColumn(colWidths[i]);
WPanel box = new WPanel(WPanel.Type.BOX);
box.add(new WText(colWidths[i] + "%"));
col.add(box);
row.add(col);
}
return row;
}
use of com.github.bordertech.wcomponents.WPanel in project wcomponents by BorderTech.
the class AbstractSetMandatory_Test method testExecuteWithWPanel.
@Test
public void testExecuteWithWPanel() {
// Setup targets in a Panel
WPanel panel = new WPanel();
MyTarget target1 = new MyTarget();
MyTarget target2 = new MyTarget();
MyTarget target3 = new MyTarget();
panel.add(target1);
panel.add(target2);
panel.add(target3);
AbstractSetMandatory enable = new MyMandatory(panel, Boolean.TRUE);
// Targets should be optional by default
Assert.assertFalse("WPanel - Target1 should be optional", target1.isMandatory());
Assert.assertFalse("WPanel - Target2 should be optional", target2.isMandatory());
Assert.assertFalse("WPanel - Target3 should be optional", target3.isMandatory());
enable.execute();
// Targets should be mandatory
Assert.assertTrue("WPanel - Target1 should be mandatory", target1.isMandatory());
Assert.assertTrue("WPanel - Target2 should be mandatory", target2.isMandatory());
Assert.assertTrue("WPanel - Target3 should be mandatory", target3.isMandatory());
}
use of com.github.bordertech.wcomponents.WPanel in project wcomponents by BorderTech.
the class TargetableInterceptor_Test method setUp.
@Before
public void setUp() {
UIContext uic = new UIContextImpl();
WPanel root = new WPanel();
originalUI = new WLabel();
targetUI = new TargetableWLabel();
root.add(originalUI);
root.add(targetUI);
uic.setUI(root);
setActiveContext(uic);
interceptor = new TargetableInterceptor();
interceptor.setBackingComponent(originalUI);
}
use of com.github.bordertech.wcomponents.WPanel in project wcomponents by BorderTech.
the class ColumnLayoutRenderer_Test method testDoRenderWhenEmpty.
@Test
public void testDoRenderWhenEmpty() throws IOException, SAXException, XpathException {
WPanel container = new WPanel();
container.setLayout(new ColumnLayout(new int[] { 50, 50 }));
assertSchemaMatch(container);
assertXpathNotExists("//ui:panel/ui:columnlayout/ui:cell", container);
}
use of com.github.bordertech.wcomponents.WPanel in project wcomponents by BorderTech.
the class FlowLayoutRenderer_Test method testDoRenderWithContent.
@Test
public void testDoRenderWithContent() throws IOException, SAXException, XpathException {
final String text1 = "FlowRenderer_Test.testPaint.text1";
final String text2 = "FlowRenderer_Test.testPaint.text2";
WPanel panel = new WPanel();
panel.setLayout(new FlowLayout());
assertSchemaMatch(panel);
panel.add(new WText(text1));
panel.add(new WText(text2));
assertSchemaMatch(panel);
assertXpathEvaluatesTo("2", "count(//ui:panel/ui:flowlayout/ui:cell)", panel);
assertXpathEvaluatesTo(text1, "normalize-space(//ui:panel/ui:flowlayout/ui:cell[1])", panel);
assertXpathEvaluatesTo(text2, "normalize-space(//ui:panel/ui:flowlayout/ui:cell[2])", panel);
}
Aggregations