Search in sources :

Example 81 with ITableRow

use of org.eclipse.scout.rt.client.ui.basic.table.ITableRow in project scout.rt by eclipse.

the class AbstractTableFieldTest method setUp.

@Before
public void setUp() {
    for (int i = 0; i < 10; i++) {
        ITableRow row = getTable().createRow();
        getTable().getIntegerColumn().setValue(row, i);
        getTable().getLongColumn().setValue(row, Long.valueOf(i * 2));
        getTable().getString1Column().setValue(row, i + ". row");
        getTable().getString2Column().setValue(row, getTextFor(i, " "));
        getTable().getString3Column().setValue(row, getTextFor(i, " "));
        getTable().getString4Column().setValue(row, getTextFor(i, "\n"));
        getTable().getBigDecimalColumn().setValue(row, FAR_BELOW_ZERO.add(BigDecimal.valueOf(1.11).multiply(BigDecimal.valueOf(i))));
        getTable().addRow(row);
        getTable().selectAllRows();
    }
}
Also used : ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow) Before(org.junit.Before)

Example 82 with ITableRow

use of org.eclipse.scout.rt.client.ui.basic.table.ITableRow in project scout.rt by eclipse.

the class TableFieldTest method addNewTableRow.

private void addNewTableRow(P_TableField tableField) {
    ITableRow newRow = tableField.getTable().createRow();
    tableField.getTable().getKeyColumn().setValue(newRow, 4);
    tableField.getTable().getHiddenColumn().setValue(newRow, true);
    tableField.getTable().getStringColumn().setValue(newRow, "Sit");
    tableField.getTable().addRow(newRow);
}
Also used : ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow)

Example 83 with ITableRow

use of org.eclipse.scout.rt.client.ui.basic.table.ITableRow in project scout.rt by eclipse.

the class TableFieldTest method updateThirdRow.

private void updateThirdRow(P_TableField tableField) {
    ITableRow updatedRow = tableField.getTable().getRow(2);
    updatedRow.getCellForUpdate(1).setValue("Amet");
    updatedRow.getCellForUpdate(2).setValue(true);
    tableField.getTable().updateRow(updatedRow);
}
Also used : ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow)

Example 84 with ITableRow

use of org.eclipse.scout.rt.client.ui.basic.table.ITableRow in project scout.rt by eclipse.

the class JsonCellToJsonTest method testDateColumn_jsonDatePattern.

/**
 * Don't send value and text if they are equal. They may be equal if the date column uses the same pattern as
 * {@link JsonDate}.
 */
@Test
public void testDateColumn_jsonDatePattern() throws JSONException {
    TableWithDateColumn table = new TableWithDateColumn();
    table.initTable();
    ITableRow row = table.addRow(table.createRow());
    table.getColumn().setFormat(JsonDate.JSON_PATTERN_DATE_ONLY);
    table.getColumn().setValue(row, DateUtility.parse("01.01.2015", "dd.MM.yyyy"));
    JsonTable<ITable> jsonTable = UiSessionTestUtility.newJsonAdapter(m_uiSession, table, null);
    Object jsonObj = jsonTable.cellToJson(row, table.getColumn());
    assertTrue(jsonObj instanceof String);
}
Also used : ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable) JSONObject(org.json.JSONObject) ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow) TableWithDateColumn(org.eclipse.scout.rt.ui.html.json.table.fixtures.TableWithDateColumn) Test(org.junit.Test)

Example 85 with ITableRow

use of org.eclipse.scout.rt.client.ui.basic.table.ITableRow in project scout.rt by eclipse.

the class JsonCellToJsonTest method testLongColumn.

/**
 * Don't send value and text if they are equal.
 */
@Test
public void testLongColumn() throws JSONException {
    TableWithLongColumn table = new TableWithLongColumn();
    table.initTable();
    ITableRow row = table.addRow(table.createRow());
    table.getColumn().setValue(row, 15L);
    JsonTable<ITable> jsonTable = UiSessionTestUtility.newJsonAdapter(m_uiSession, table, null);
    JSONObject jsonObj = (JSONObject) jsonTable.cellToJson(row, table.getColumn());
    Assert.assertEquals("15", jsonObj.get("text"));
    assertNull(jsonObj.opt("value"));
}
Also used : TableWithLongColumn(org.eclipse.scout.rt.ui.html.json.table.fixtures.TableWithLongColumn) JSONObject(org.json.JSONObject) ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable) ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow) Test(org.junit.Test)

Aggregations

ITableRow (org.eclipse.scout.rt.client.ui.basic.table.ITableRow)127 Test (org.junit.Test)77 ITable (org.eclipse.scout.rt.client.ui.basic.table.ITable)47 ArrayList (java.util.ArrayList)23 JSONObject (org.json.JSONObject)22 TableWith3Cols (org.eclipse.scout.rt.ui.html.json.table.fixtures.TableWith3Cols)16 JSONArray (org.json.JSONArray)13 JsonEvent (org.eclipse.scout.rt.ui.html.json.JsonEvent)12 ITableRowFilter (org.eclipse.scout.rt.client.ui.basic.table.ITableRowFilter)11 AbstractTable (org.eclipse.scout.rt.client.ui.basic.table.AbstractTable)7 IProposalField (org.eclipse.scout.rt.client.ui.form.fields.smartfield.IProposalField)7 ListBoxTable (org.eclipse.scout.rt.ui.html.json.table.fixtures.ListBoxTable)6 IMixedSmartField (org.eclipse.scout.rt.client.ui.form.fields.smartfield.IMixedSmartField)5 Table (org.eclipse.scout.rt.ui.html.json.table.fixtures.Table)5 TableWithLongColumn (org.eclipse.scout.rt.ui.html.json.table.fixtures.TableWithLongColumn)5 DecimalFormat (java.text.DecimalFormat)4 List (java.util.List)4 Cell (org.eclipse.scout.rt.client.ui.basic.cell.Cell)4 ICell (org.eclipse.scout.rt.client.ui.basic.cell.ICell)4 IColumn (org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn)4