Search in sources :

Example 11 with ContainerDataUnit

use of com.haulmont.cuba.gui.components.data.meta.ContainerDataUnit in project cuba by cuba-platform.

the class TestCommentaryPanel method addMessage.

private void addMessage(String text) {
    if (getCommentProvider() == null) {
        return;
    }
    Comment comment = getCommentProvider().apply(text);
    DataGridItems<Comment> items = commentsDataGrid.getItems();
    if (items instanceof ContainerDataUnit) {
        // noinspection unchecked
        CollectionContainer<Comment> container = ((ContainerDataUnit<Comment>) items).getContainer();
        container.getMutableItems().add(comment);
    } else {
        throw new IllegalStateException("Items must implement com.haulmont.cuba.gui.components.data.meta.ContainerDataUnit");
    }
}
Also used : Comment(com.haulmont.cuba.web.testmodel.compositecomponent.Comment) ContainerDataUnit(com.haulmont.cuba.gui.components.data.meta.ContainerDataUnit)

Example 12 with ContainerDataUnit

use of com.haulmont.cuba.gui.components.data.meta.ContainerDataUnit in project cuba by cuba-platform.

the class TestProgrammaticCommentaryPanel method addMessage.

private void addMessage(String text) {
    if (getCommentProvider() == null) {
        return;
    }
    Comment comment = getCommentProvider().apply(text);
    DataGridItems<Comment> items = commentsDataGrid.getItems();
    if (items instanceof ContainerDataUnit) {
        // noinspection unchecked
        CollectionContainer<Comment> container = ((ContainerDataUnit<Comment>) items).getContainer();
        container.getMutableItems().add(comment);
    } else {
        throw new IllegalStateException("Items must implement com.haulmont.cuba.gui.components.data.meta.ContainerDataUnit");
    }
}
Also used : Comment(com.haulmont.cuba.web.testmodel.compositecomponent.Comment) ContainerDataUnit(com.haulmont.cuba.gui.components.data.meta.ContainerDataUnit)

Aggregations

ContainerDataUnit (com.haulmont.cuba.gui.components.data.meta.ContainerDataUnit)12 MetaClass (com.haulmont.chile.core.model.MetaClass)5 MetaProperty (com.haulmont.chile.core.model.MetaProperty)4 DataUnit (com.haulmont.cuba.gui.components.data.DataUnit)3 Nested (com.haulmont.cuba.gui.model.Nested)3 Screens (com.haulmont.cuba.gui.Screens)2 com.haulmont.cuba.gui.components (com.haulmont.cuba.gui.components)2 DatasourceDataUnit (com.haulmont.cuba.gui.components.data.meta.DatasourceDataUnit)2 CollectionContainer (com.haulmont.cuba.gui.model.CollectionContainer)2 FrameOwner (com.haulmont.cuba.gui.screen.FrameOwner)2 Screen (com.haulmont.cuba.gui.screen.Screen)2 Comment (com.haulmont.cuba.web.testmodel.compositecomponent.Comment)2 Node (com.haulmont.bali.datastruct.Node)1 AbstractSearchFolder (com.haulmont.cuba.core.entity.AbstractSearchFolder)1 Entity (com.haulmont.cuba.core.entity.Entity)1 Folder (com.haulmont.cuba.core.entity.Folder)1 BeanLocator (com.haulmont.cuba.core.global.BeanLocator)1 Configuration (com.haulmont.cuba.core.global.Configuration)1 UiComponents (com.haulmont.cuba.gui.UiComponents)1 HasValueSource (com.haulmont.cuba.gui.components.data.HasValueSource)1