Search in sources :

Example 16 with WTableColumn

use of com.github.bordertech.wcomponents.WTableColumn in project wcomponents by BorderTech.

the class WTableRenderer_Test method testDoPaintMissingAttributes.

@Test
public void testDoPaintMissingAttributes() throws IOException, SAXException, XpathException {
    WTable component = new WTable();
    component.addColumn(new WTableColumn(COL1_HEADING_TEST, WTextField.class));
    component.addColumn(new WTableColumn(COL2_HEADING_TEST, WTextField.class));
    component.addColumn(new WTableColumn(COL3_HEADING_TEST, WTextField.class));
    component.setTableModel(createTableModel());
    component.setVisible(true);
    component.setStripingType(WTable.StripingType.NONE);
    component.setSeparatorType(WTable.SeparatorType.NONE);
    assertXpathNotExists("//ui:table/@caption", component);
    assertXpathEvaluatesTo("table", "//ui:table/@type", component);
    assertXpathNotExists("//ui:table/@striping", component);
    assertXpathNotExists("//ui:table/@separators", component);
}
Also used : WTable(com.github.bordertech.wcomponents.WTable) WTableColumn(com.github.bordertech.wcomponents.WTableColumn) WTextField(com.github.bordertech.wcomponents.WTextField) Test(org.junit.Test)

Example 17 with WTableColumn

use of com.github.bordertech.wcomponents.WTableColumn in project wcomponents by BorderTech.

the class WTableRenderer_Test method testDoPaintWithColAlignment.

@Test
public void testDoPaintWithColAlignment() throws IOException, SAXException, XpathException {
    WTable table = new WTable();
    table.addColumn(new WTableColumn(COL1_HEADING_TEST, WTextField.class));
    table.addColumn(new WTableColumn(COL2_HEADING_TEST, WTextField.class));
    table.addColumn(new WTableColumn(COL3_HEADING_TEST, WTextField.class));
    table.getColumn(0).setAlign(WTableColumn.Alignment.LEFT);
    table.getColumn(1).setAlign(WTableColumn.Alignment.CENTER);
    table.getColumn(2).setAlign(WTableColumn.Alignment.RIGHT);
    TableModel tableModel = createTableModel();
    table.setTableModel(tableModel);
    assertXpathNotExists("//ui:table/ui:thead/ui:th[1]/@align", table);
    assertXpathEvaluatesTo("center", "//ui:table/ui:thead/ui:th[2]/@align", table);
    assertXpathEvaluatesTo("right", "//ui:table/ui:thead/ui:th[3]/@align", table);
}
Also used : WTable(com.github.bordertech.wcomponents.WTable) WTableColumn(com.github.bordertech.wcomponents.WTableColumn) WTextField(com.github.bordertech.wcomponents.WTextField) TableModel(com.github.bordertech.wcomponents.WTable.TableModel) AdapterBasicTableModel(com.github.bordertech.wcomponents.AdapterBasicTableModel) SimpleTableModel(com.github.bordertech.wcomponents.SimpleTableModel) Test(org.junit.Test)

Example 18 with WTableColumn

use of com.github.bordertech.wcomponents.WTableColumn in project wcomponents by BorderTech.

the class WTableRenderer_Test method testDoPaintOfRowHeaderWithNoRowHeaderColumn.

@Test
public void testDoPaintOfRowHeaderWithNoRowHeaderColumn() throws IOException, SAXException, XpathException {
    WTable table = new WTable();
    table.addColumn(new WTableColumn(COL1_HEADING_TEST, WTextField.class));
    table.addColumn(new WTableColumn(COL2_HEADING_TEST, WTextField.class));
    table.addColumn(new WTableColumn(COL3_HEADING_TEST, WTextField.class));
    // no row headers set
    TableModel tableModel = createTableModel();
    table.setTableModel(tableModel);
    assertXpathNotExists("//ui:table/ui:tbody/ui:tr/ui:th", table);
}
Also used : WTable(com.github.bordertech.wcomponents.WTable) WTableColumn(com.github.bordertech.wcomponents.WTableColumn) WTextField(com.github.bordertech.wcomponents.WTextField) TableModel(com.github.bordertech.wcomponents.WTable.TableModel) AdapterBasicTableModel(com.github.bordertech.wcomponents.AdapterBasicTableModel) SimpleTableModel(com.github.bordertech.wcomponents.SimpleTableModel) Test(org.junit.Test)

Example 19 with WTableColumn

use of com.github.bordertech.wcomponents.WTableColumn in project wcomponents by BorderTech.

the class WTableRenderer_Test method testRenderedWithMargins.

@Test
public void testRenderedWithMargins() throws IOException, SAXException, XpathException {
    WTable table = new WTable();
    table.addColumn(new WTableColumn(COL1_HEADING_TEST, WTextField.class));
    assertXpathNotExists("//ui:table/ui:margin", table);
    Margin margin = new Margin(0);
    table.setMargin(margin);
    assertXpathNotExists("//ui:table/ui:margin", table);
    margin = new Margin(Size.SMALL);
    table.setMargin(margin);
    assertXpathEvaluatesTo("sm", "//ui:table/ui:margin/@all", table);
    assertXpathEvaluatesTo("", "//ui:table/ui:margin/@north", table);
    assertXpathEvaluatesTo("", "//ui:table/ui:margin/@east", table);
    assertXpathEvaluatesTo("", "//ui:table/ui:margin/@south", table);
    assertXpathEvaluatesTo("", "//ui:table/ui:margin/@west", table);
    margin = new Margin(Size.SMALL, Size.MEDIUM, Size.LARGE, Size.XL);
    table.setMargin(margin);
    assertXpathEvaluatesTo("", "//ui:table/ui:margin/@all", table);
    assertXpathEvaluatesTo("sm", "//ui:table/ui:margin/@north", table);
    assertXpathEvaluatesTo("med", "//ui:table/ui:margin/@east", table);
    assertXpathEvaluatesTo("lg", "//ui:table/ui:margin/@south", table);
    assertXpathEvaluatesTo("xl", "//ui:table/ui:margin/@west", table);
}
Also used : WTable(com.github.bordertech.wcomponents.WTable) WTableColumn(com.github.bordertech.wcomponents.WTableColumn) WTextField(com.github.bordertech.wcomponents.WTextField) Margin(com.github.bordertech.wcomponents.Margin) Test(org.junit.Test)

Example 20 with WTableColumn

use of com.github.bordertech.wcomponents.WTableColumn in project wcomponents by BorderTech.

the class WTableRenderer_Test method testDoPaintExpandModeDynamic.

@Test
public void testDoPaintExpandModeDynamic() throws IOException, SAXException, XpathException {
    WTable component = new WTable();
    component.addColumn(new WTableColumn(COL1_HEADING_TEST, WTextField.class));
    component.addColumn(new WTableColumn(COL2_HEADING_TEST, WTextField.class));
    component.addColumn(new WTableColumn(COL3_HEADING_TEST, WTextField.class));
    TableModel tableModel = createTableModel();
    component.setTableModel(tableModel);
    component.setVisible(true);
    component.setExpandMode(ExpandMode.DYNAMIC);
    assertXpathEvaluatesTo("dynamic", "//ui:table/ui:rowexpansion/@mode", component);
}
Also used : WTable(com.github.bordertech.wcomponents.WTable) WTableColumn(com.github.bordertech.wcomponents.WTableColumn) WTextField(com.github.bordertech.wcomponents.WTextField) TableModel(com.github.bordertech.wcomponents.WTable.TableModel) AdapterBasicTableModel(com.github.bordertech.wcomponents.AdapterBasicTableModel) SimpleTableModel(com.github.bordertech.wcomponents.SimpleTableModel) Test(org.junit.Test)

Aggregations

WTableColumn (com.github.bordertech.wcomponents.WTableColumn)73 WTextField (com.github.bordertech.wcomponents.WTextField)60 Test (org.junit.Test)56 WDataTable (com.github.bordertech.wcomponents.WDataTable)38 WTable (com.github.bordertech.wcomponents.WTable)30 TableModel (com.github.bordertech.wcomponents.WTable.TableModel)25 TableDataModel (com.github.bordertech.wcomponents.TableDataModel)24 AdapterBasicTableModel (com.github.bordertech.wcomponents.AdapterBasicTableModel)23 SimpleTableDataModel (com.github.bordertech.wcomponents.SimpleTableDataModel)23 SimpleTableModel (com.github.bordertech.wcomponents.SimpleTableModel)23 WText (com.github.bordertech.wcomponents.WText)9 WButton (com.github.bordertech.wcomponents.WButton)8 WDateField (com.github.bordertech.wcomponents.WDateField)7 TableTreeNode (com.github.bordertech.wcomponents.TableTreeNode)5 ActionConstraint (com.github.bordertech.wcomponents.WDataTable.ActionConstraint)4 ActionConstraint (com.github.bordertech.wcomponents.WTable.ActionConstraint)4 XmlStringBuilder (com.github.bordertech.wcomponents.XmlStringBuilder)4 UIContext (com.github.bordertech.wcomponents.UIContext)3 TreeTableDataModel (com.github.bordertech.wcomponents.TreeTableDataModel)2 MockRequest (com.github.bordertech.wcomponents.util.mock.MockRequest)2