Search in sources :

Example 16 with IForm

use of org.eclipse.scout.rt.client.ui.form.IForm in project scout.rt by eclipse.

the class ListBoxTest method testGetForm.

@Test
public void testGetForm() {
    IForm formMock = mock(IForm.class);
    DynamicStringField stringField = new DynamicStringField("id", "test");
    addField(stringField);
    try {
        setFormInternal(formMock);
        assertEquals(formMock, getForm());
        assertEquals(formMock, getListBoxFilterBox().getForm());
        assertEquals(formMock, stringField.getForm());
    } finally {
        removeField(stringField);
    }
}
Also used : DynamicStringField(org.eclipse.scout.testing.client.form.DynamicStringField) IForm(org.eclipse.scout.rt.client.ui.form.IForm) Test(org.junit.Test)

Example 17 with IForm

use of org.eclipse.scout.rt.client.ui.form.IForm in project scout.rt by eclipse.

the class BookmarkUtility method bmStoreTablePage.

private static TablePageState bmStoreTablePage(IPageWithTable page, IPage<?> childPage) {
    ITable table = page.getTable();
    TablePageState state = new TablePageState();
    state.setPageClassName(page.getClass().getName());
    IBookmarkAdapter bookmarkAdapter = getBookmarkAdapter(page);
    state.setBookmarkIdentifier(bookmarkAdapter.getIdentifier());
    state.setLabel(bookmarkAdapter.getText());
    state.setExpanded(page.isExpanded());
    IForm searchForm = page.getSearchFormInternal();
    if (searchForm != null) {
        state.setSearchFormState(searchForm.storeToXmlString());
        state.setSearchFilterState(searchForm.getSearchFilter().isCompleted(), "" + createSearchFilterCRC(searchForm.getSearchFilter()));
    }
    if (page.getTable().getTableCustomizer() != null) {
        state.setTableCustomizerData(page.getTable().getTableCustomizer().getSerializedData());
    }
    if (page.getTable().getUserFilterManager() != null) {
        state.setUserFilterData(page.getTable().getUserFilterManager().getSerializedData());
    }
    List<TableColumnState> allColumns = backupTableColumns(page.getTable());
    state.setAvailableColumns(allColumns);
    // 
    ArrayList<CompositeObject> pkList = new ArrayList<CompositeObject>();
    for (ITableRow row : table.getSelectedRows()) {
        pkList.add(new CompositeObject(BookmarkUtility.makeSerializableKeys(row.getKeyValues(), false)));
    }
    state.setSelectedChildrenPrimaryKeys(pkList);
    // 
    if (childPage != null) {
        for (int j = 0; j < table.getRowCount(); j++) {
            if (page.getChildNode(j) == childPage) {
                ITableRow childRow = table.getRow(j);
                state.setExpandedChildPrimaryKey(new CompositeObject(BookmarkUtility.makeSerializableKeys(childRow.getKeyValues(), false)));
                break;
            }
        }
    }
    return state;
}
Also used : CompositeObject(org.eclipse.scout.rt.platform.util.CompositeObject) IBookmarkAdapter(org.eclipse.scout.rt.client.services.common.bookmark.IBookmarkAdapter) ArrayList(java.util.ArrayList) ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable) IForm(org.eclipse.scout.rt.client.ui.form.IForm) ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow) TablePageState(org.eclipse.scout.rt.shared.services.common.bookmark.TablePageState) TableColumnState(org.eclipse.scout.rt.shared.services.common.bookmark.TableColumnState)

Example 18 with IForm

use of org.eclipse.scout.rt.client.ui.form.IForm in project scout.rt by eclipse.

the class AbstractDisplayParentViewIndex method addToIndex.

@Override
public boolean addToIndex(final IForm element) {
    if (m_mapByElement.containsKey(element)) {
        removeFromIndex(element);
    }
    final IDisplayParent index = calculateIndexFor(element);
    if (index == null) {
        return false;
    }
    List<IForm> elements = m_mapByIndex.get(index);
    if (elements == null) {
        elements = new ArrayList<>();
        m_mapByIndex.put(index, elements);
    }
    int position = calculatePositionForElement(element);
    elements.add(position, element);
    m_mapByElement.put(element, index);
    return true;
}
Also used : IDisplayParent(org.eclipse.scout.rt.client.ui.IDisplayParent) IForm(org.eclipse.scout.rt.client.ui.form.IForm)

Example 19 with IForm

use of org.eclipse.scout.rt.client.ui.form.IForm in project scout.rt by eclipse.

the class AbstractDisplayParentViewIndex method removeFromIndex.

@Override
public boolean removeFromIndex(final IForm element) {
    final IDisplayParent index = m_mapByElement.remove(element);
    if (index == null) {
        return false;
    }
    final List<IForm> elements = m_mapByIndex.get(index);
    elements.remove(element);
    if (elements.isEmpty()) {
        m_mapByIndex.remove(index);
    }
    return true;
}
Also used : IDisplayParent(org.eclipse.scout.rt.client.ui.IDisplayParent) IForm(org.eclipse.scout.rt.client.ui.form.IForm)

Example 20 with IForm

use of org.eclipse.scout.rt.client.ui.form.IForm in project scout.rt by eclipse.

the class AbstractDesktop method findForms.

@Override
public <FORM extends IForm> List<FORM> findForms(final Class<FORM> formType) {
    if (formType == null) {
        return CollectionUtility.emptyArrayList();
    }
    final List<FORM> forms = new ArrayList<FORM>();
    for (final IForm candidate : m_formStore.values()) {
        if (formType.isAssignableFrom(candidate.getClass())) {
            @SuppressWarnings("unchecked") FORM form = (FORM) candidate;
            forms.add(form);
        }
    }
    return forms;
}
Also used : ArrayList(java.util.ArrayList) IForm(org.eclipse.scout.rt.client.ui.form.IForm)

Aggregations

IForm (org.eclipse.scout.rt.client.ui.form.IForm)38 Test (org.junit.Test)8 ArrayList (java.util.ArrayList)7 IOutline (org.eclipse.scout.rt.client.ui.desktop.outline.IOutline)5 PlatformError (org.eclipse.scout.rt.platform.exception.PlatformError)4 IDisplayParent (org.eclipse.scout.rt.client.ui.IDisplayParent)3 IMenu (org.eclipse.scout.rt.client.ui.action.menu.IMenu)3 ITable (org.eclipse.scout.rt.client.ui.basic.table.ITable)3 IDesktop (org.eclipse.scout.rt.client.ui.desktop.IDesktop)3 JSONObject (org.json.JSONObject)3 List (java.util.List)2 ModelContext (org.eclipse.scout.rt.client.ModelContextProxy.ModelContext)2 DeepLinkException (org.eclipse.scout.rt.client.deeplink.DeepLinkException)2 IFileChooser (org.eclipse.scout.rt.client.ui.basic.filechooser.IFileChooser)2 ISearchForm (org.eclipse.scout.rt.client.ui.desktop.outline.pages.ISearchForm)2 IGroupBox (org.eclipse.scout.rt.client.ui.form.fields.groupbox.IGroupBox)2 ITabBox (org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox)2 ProcessingException (org.eclipse.scout.rt.platform.exception.ProcessingException)2 IRunnable (org.eclipse.scout.rt.platform.util.concurrent.IRunnable)2 PropertyChangeEvent (java.beans.PropertyChangeEvent)1