Search in sources :

Example 86 with ITable

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

the class JsonOutline method detachDetailTable.

protected void detachDetailTable(IPage page) {
    ITable table = page.getTable(false);
    if (table != null) {
        table.setProperty(JsonOutlineTable.PROP_PAGE, null);
        IJsonAdapter<?> jsonTableAdapter = getGlobalAdapter(table);
        if (jsonTableAdapter != null) {
            m_jsonDetailTables.remove(jsonTableAdapter);
            if (!jsonTableAdapter.isDisposed()) {
                jsonTableAdapter.dispose();
            }
        }
    }
}
Also used : ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable)

Example 87 with ITable

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

the class AbstractProposalColumnTest method testLookupRowWithTooLongText2.

@Test
public void testLookupRowWithTooLongText2() throws Exception {
    final AbstractProposalColumn<Long> column = new AbstractProposalColumn<Long>() {

        @Override
        protected boolean getConfiguredEditable() {
            return true;
        }

        @Override
        protected int getConfiguredMaxLength() {
            return 8;
        }
    };
    column.setCodeTypeClass(TestCodeType.class);
    final ITable table = new AbstractTable() {

        @Override
        protected void injectColumnsInternal(OrderedCollection<IColumn<?>> columns) {
            columns.addFirst(column);
        }
    };
    ITableRow row = table.addRow();
    @SuppressWarnings("unchecked") IProposalField<Long> field = (IProposalField<Long>) column.prepareEditInternal(row);
    field.getUIFacade().acceptProposalFromUI("1234567890", false, false);
    column.completeEdit(row, field);
    assertEquals("12345678", column.getValue(row));
}
Also used : AbstractTable(org.eclipse.scout.rt.client.ui.basic.table.AbstractTable) IProposalField(org.eclipse.scout.rt.client.ui.form.fields.smartfield.IProposalField) OrderedCollection(org.eclipse.scout.rt.platform.util.collection.OrderedCollection) ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable) ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow) Test(org.junit.Test)

Example 88 with ITable

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

the class AbstractProposalColumnTest method testLookupRowWithTooLongText1.

@Test
public void testLookupRowWithTooLongText1() throws Exception {
    final AbstractProposalColumn<Long> column = new AbstractProposalColumn<Long>() {

        @Override
        protected boolean getConfiguredEditable() {
            return true;
        }

        @Override
        protected int getConfiguredMaxLength() {
            return 32;
        }
    };
    column.setCodeTypeClass(TestCodeType.class);
    final ITable table = new AbstractTable() {

        @Override
        protected void injectColumnsInternal(OrderedCollection<IColumn<?>> columns) {
            columns.addFirst(column);
        }
    };
    ITableRow row = table.addRow();
    @SuppressWarnings("unchecked") IProposalField<Long> field = (IProposalField<Long>) column.prepareEditInternal(row);
    field.getUIFacade().acceptProposalFromUI("1234567890", false, false);
    column.completeEdit(row, field);
    assertEquals("1234567890", column.getValue(row));
}
Also used : AbstractTable(org.eclipse.scout.rt.client.ui.basic.table.AbstractTable) IProposalField(org.eclipse.scout.rt.client.ui.form.fields.smartfield.IProposalField) OrderedCollection(org.eclipse.scout.rt.platform.util.collection.OrderedCollection) ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable) ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow) Test(org.junit.Test)

Example 89 with ITable

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

the class OrganizeColumnsFormRegressionTest method givenAProfilesTable.

private void givenAProfilesTable() {
    ITable table = mock(ITable.class);
    OrganizeColumnsForm form = new OrganizeColumnsForm(table);
    profilesTable = form.getProfilesTableField().getTable();
    profilesTable.addTableListener(new TableListener() {

        @Override
        public void tableChangedBatch(List<? extends TableEvent> batch) {
            for (TableEvent e : batch) {
                tableChanged(e);
            }
        }

        @Override
        public void tableChanged(TableEvent e) {
            if (e.getType() == TableEvent.TYPE_REQUEST_FOCUS_IN_CELL) {
                IColumn focusedColumn = CollectionUtility.firstElement(e.getColumns());
                ITableRow focusedRow = CollectionUtility.firstElement(e.getRows());
                if (focusedColumn.equals(profilesTable.getConfigNameColumn())) {
                    lastFocusedRowIndex.setValue(focusedRow.getRowIndex());
                }
            }
        }
    });
    profilesTable.deselectAllRows();
}
Also used : TableEvent(org.eclipse.scout.rt.client.ui.basic.table.TableEvent) IColumn(org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn) ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable) ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow) TableListener(org.eclipse.scout.rt.client.ui.basic.table.TableListener)

Aggregations

ITable (org.eclipse.scout.rt.client.ui.basic.table.ITable)89 Test (org.junit.Test)64 ITableRow (org.eclipse.scout.rt.client.ui.basic.table.ITableRow)45 TableWith3Cols (org.eclipse.scout.rt.ui.html.json.table.fixtures.TableWith3Cols)28 JSONObject (org.json.JSONObject)23 JsonEvent (org.eclipse.scout.rt.ui.html.json.JsonEvent)16 JSONArray (org.json.JSONArray)12 ITableRowFilter (org.eclipse.scout.rt.client.ui.basic.table.ITableRowFilter)11 Table (org.eclipse.scout.rt.ui.html.json.table.fixtures.Table)10 ArrayList (java.util.ArrayList)9 ListBoxTable (org.eclipse.scout.rt.ui.html.json.table.fixtures.ListBoxTable)8 IMenu (org.eclipse.scout.rt.client.ui.action.menu.IMenu)6 AbstractTable (org.eclipse.scout.rt.client.ui.basic.table.AbstractTable)6 ITableField (org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField)5 TableWithLongColumn (org.eclipse.scout.rt.ui.html.json.table.fixtures.TableWithLongColumn)5 IColumn (org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn)4 IOutline (org.eclipse.scout.rt.client.ui.desktop.outline.IOutline)4 IPageWithTable (org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPageWithTable)4 IProposalField (org.eclipse.scout.rt.client.ui.form.fields.smartfield.IProposalField)4 OrderedCollection (org.eclipse.scout.rt.platform.util.collection.OrderedCollection)4