Search in sources :

Example 1 with ITableControl

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

the class JsonTable method initJsonProperties.

@Override
protected void initJsonProperties(T model) {
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_ENABLED, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isEnabled();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_MULTI_SELECT, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isMultiSelect();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_MULTI_CHECK, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isMultiCheck();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_MULTILINE_TEXT, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isMultilineText();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_CHECKABLE, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isCheckable();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_ROW_ICON_VISIBLE, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isRowIconVisible();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_HEADER_VISIBLE, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isHeaderVisible();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_HEADER_ENABLED, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isHeaderEnabled();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_KEYBOARD_NAVIGATION, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().hasKeyboardNavigation();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_AUTO_RESIZE_COLUMNS, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isAutoResizeColumns();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_SCROLL_TO_SELECTION, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isScrollToSelection();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_TABLE_STATUS_VISIBLE, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isTableStatusVisible();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_TABLE_STATUS, model) {

        @Override
        protected IStatus modelValue() {
            return getModel().getTableStatus();
        }

        @Override
        public Object prepareValueForToJson(Object value) {
            return JsonStatus.toJson((IStatus) value);
        }
    });
    putJsonProperty(new JsonAdapterProperty<ITable>(ITable.PROP_TABLE_CONTROLS, model, getUiSession()) {

        @Override
        protected JsonAdapterPropertyConfig createConfig() {
            return new JsonAdapterPropertyConfigBuilder().filter(new DisplayableActionFilter<ITableControl>()).build();
        }

        @Override
        protected List<ITableControl> modelValue() {
            return getModel().getTableControls();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_DROP_TYPE, model) {

        @Override
        protected Integer modelValue() {
            return getModel().getDropType();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_DROP_MAXIMUM_SIZE, model) {

        @Override
        protected Long modelValue() {
            return getModel().getDropMaximumSize();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_SORT_ENABLED, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isSortEnabled();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_UI_SORT_POSSIBLE, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isUiSortPossible();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_LOADING, model) {

        @Override
        protected Boolean modelValue() {
            return getModel().isLoading();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_GROUPING_STYLE, model) {

        @Override
        protected GroupingStyle modelValue() {
            return getModel().getGroupingStyle();
        }

        @Override
        public Object prepareValueForToJson(Object value) {
            return ((GroupingStyle) value).name().toLowerCase();
        }
    });
    putJsonProperty(new JsonAdapterProperty<ITable>(ITable.PROP_KEY_STROKES, model, getUiSession()) {

        @Override
        protected JsonAdapterPropertyConfig createConfig() {
            return new JsonAdapterPropertyConfigBuilder().filter(new DisplayableActionFilter<IAction>()).build();
        }

        @Override
        protected List<IKeyStroke> modelValue() {
            return getModel().getKeyStrokes();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_CSS_CLASS, model) {

        @Override
        protected String modelValue() {
            return getModel().getCssClass();
        }
    });
    putJsonProperty(new JsonProperty<ITable>(ITable.PROP_CONTEXT_COLUMN, model) {

        @Override
        protected Object modelValue() {
            return getModel().getContextColumn();
        }

        @Override
        public Object prepareValueForToJson(Object value) {
            if (value == null) {
                return null;
            }
            return m_jsonColumns.get(value).getId();
        }
    });
}
Also used : IStatus(org.eclipse.scout.rt.platform.status.IStatus) JsonAdapterPropertyConfig(org.eclipse.scout.rt.ui.html.json.form.fields.JsonAdapterPropertyConfig) IAction(org.eclipse.scout.rt.client.ui.action.IAction) ITableControl(org.eclipse.scout.rt.client.ui.basic.table.controls.ITableControl) JsonAdapterPropertyConfigBuilder(org.eclipse.scout.rt.ui.html.json.form.fields.JsonAdapterPropertyConfigBuilder) ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable) TextTransferObject(org.eclipse.scout.rt.client.ui.dnd.TextTransferObject) ResourceListTransferObject(org.eclipse.scout.rt.client.ui.dnd.ResourceListTransferObject) JSONObject(org.json.JSONObject) TransferObject(org.eclipse.scout.rt.client.ui.dnd.TransferObject) List(java.util.List) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) GroupingStyle(org.eclipse.scout.rt.client.ui.basic.table.GroupingStyle)

Example 2 with ITableControl

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

the class AbstractTable method createTableControlsInternal.

private void createTableControlsInternal() {
    List<Class<? extends ITableControl>> tcs = getConfiguredTableControls();
    OrderedCollection<ITableControl> tableControls = new OrderedCollection<ITableControl>();
    for (Class<? extends ITableControl> clazz : tcs) {
        ITableControl tableControl = ConfigurationUtility.newInnerInstance(this, clazz);
        ((AbstractTableControl) tableControl).setTable(this);
        tableControls.addOrdered(tableControl);
    }
    m_tableControls = tableControls.getOrderedList();
}
Also used : AbstractTableControl(org.eclipse.scout.rt.client.ui.basic.table.controls.AbstractTableControl) ITableControl(org.eclipse.scout.rt.client.ui.basic.table.controls.ITableControl) OrderedCollection(org.eclipse.scout.rt.platform.util.collection.OrderedCollection)

Example 3 with ITableControl

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

the class JsonFormTableControlTest method testLazyLoadingForm_onModelSelectionChanged.

@Test
public void testLazyLoadingForm_onModelSelectionChanged() throws JSONException {
    FormWithOneField form = new FormWithOneField();
    form.setShowOnStart(false);
    FormTableControl control = new FormTableControl();
    control.setTable(new Table());
    control.setForm(form);
    control.decorateForm();
    JsonTableControl<ITableControl> jsonControl = UiSessionTestUtility.newJsonAdapter(m_uiSession, control, null);
    assertNull(jsonControl.getAdapter(form));
    control.setSelected(true);
    IJsonAdapter<?> formAdapter = jsonControl.getAdapter(form);
    assertNotNull(formAdapter);
    String formId = JsonTestUtility.extractProperty(m_uiSession.currentJsonResponse(), jsonControl.getId(), "form");
    assertEquals(formAdapter.getId(), formId);
}
Also used : Table(org.eclipse.scout.rt.ui.html.json.table.fixtures.Table) ITableControl(org.eclipse.scout.rt.client.ui.basic.table.controls.ITableControl) FormTableControl(org.eclipse.scout.rt.ui.html.json.table.fixtures.FormTableControl) FormWithOneField(org.eclipse.scout.rt.ui.html.json.form.fixtures.FormWithOneField) Test(org.junit.Test)

Example 4 with ITableControl

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

the class AbstractPageWithTable method addDefaultTableControls.

@Override
protected void addDefaultTableControls() {
    T table = getTable();
    if (table == null) {
        return;
    }
    ITableControl control = createSearchFormTableControl();
    if (control != null) {
        table.addTableControl(control);
        linkSearchFormWithTableControl();
    }
    control = createAggregateTableControl();
    if (control != null) {
        table.addTableControl(control);
    }
}
Also used : ITableControl(org.eclipse.scout.rt.client.ui.basic.table.controls.ITableControl)

Example 5 with ITableControl

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

the class AbstractPageWithTable method detachSearchTableControl.

private void detachSearchTableControl() {
    T table = getTable();
    if (table == null) {
        return;
    }
    ITableControl searchControl = table.getTableControl(SearchFormTableControl.class);
    if (searchControl != null) {
        table.removeTableControl(searchControl);
    }
}
Also used : ITableControl(org.eclipse.scout.rt.client.ui.basic.table.controls.ITableControl)

Aggregations

ITableControl (org.eclipse.scout.rt.client.ui.basic.table.controls.ITableControl)9 FormWithOneField (org.eclipse.scout.rt.ui.html.json.form.fixtures.FormWithOneField)4 FormTableControl (org.eclipse.scout.rt.ui.html.json.table.fixtures.FormTableControl)4 Table (org.eclipse.scout.rt.ui.html.json.table.fixtures.Table)4 Test (org.junit.Test)4 ITable (org.eclipse.scout.rt.client.ui.basic.table.ITable)2 ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 IClientSession (org.eclipse.scout.rt.client.IClientSession)1 IAction (org.eclipse.scout.rt.client.ui.action.IAction)1 IKeyStroke (org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke)1 IMenu (org.eclipse.scout.rt.client.ui.action.menu.IMenu)1 IViewButton (org.eclipse.scout.rt.client.ui.action.view.IViewButton)1 CalendarComponent (org.eclipse.scout.rt.client.ui.basic.calendar.CalendarComponent)1 ICalendar (org.eclipse.scout.rt.client.ui.basic.calendar.ICalendar)1 IFileChooser (org.eclipse.scout.rt.client.ui.basic.filechooser.IFileChooser)1 IPlanner (org.eclipse.scout.rt.client.ui.basic.planner.IPlanner)1 GroupingStyle (org.eclipse.scout.rt.client.ui.basic.table.GroupingStyle)1 AbstractTableControl (org.eclipse.scout.rt.client.ui.basic.table.controls.AbstractTableControl)1