Search in sources :

Example 11 with Frame

use of io.jmix.ui.component.Frame in project jmix by jmix-framework.

the class StandardEditor method getEditedEntityContainer.

protected InstanceContainer<T> getEditedEntityContainer() {
    EditedEntityContainer annotation = getClass().getAnnotation(EditedEntityContainer.class);
    if (annotation == null || Strings.isNullOrEmpty(annotation.value())) {
        throw new IllegalStateException(String.format("StandardEditor %s does not declare @EditedEntityContainer", getClass()));
    }
    String[] parts = annotation.value().split("\\.");
    ScreenData screenData;
    if (parts.length == 1) {
        screenData = getScreenData();
    } else {
        Frame frame = getWindow();
        for (int i = 0; i < parts.length - 1; i++) {
            String part = parts[i];
            Component component = frame.getComponent(part);
            if (!(component instanceof Frame)) {
                throw new IllegalStateException("Path to EditedEntityContainer must include frames only");
            }
            frame = (Frame) component;
        }
        screenData = UiControllerUtils.getScreenData(frame.getFrameOwner());
    }
    return screenData.getContainer(parts[parts.length - 1]);
}
Also used : Frame(io.jmix.ui.component.Frame) Component(io.jmix.ui.component.Component)

Example 12 with Frame

use of io.jmix.ui.component.Frame in project jmix by jmix-framework.

the class AbstractCollectionDatasource method getLoggingTag.

protected String getLoggingTag(String prefix) {
    String windowId = "";
    if (dsContext != null) {
        FrameContext windowContext = dsContext.getFrameContext();
        if (windowContext != null) {
            Frame frame = windowContext.getFrame();
            if (frame != null) {
                windowId = ComponentsHelper.getFullFrameId(windowContext.getFrame());
            }
        }
    }
    String tag = prefix + " " + id;
    if (StringUtils.isNotBlank(windowId))
        tag = windowId + "@" + id;
    return tag;
}
Also used : Frame(io.jmix.ui.component.Frame) FrameContext(io.jmix.ui.component.FrameContext)

Example 13 with Frame

use of io.jmix.ui.component.Frame in project jmix by jmix-framework.

the class ScreenFacetImpl method create.

@Override
public S create() {
    Frame owner = getOwner();
    if (owner == null) {
        throw new IllegalStateException("Screen facet is not attached to Frame");
    }
    screen = createScreen(owner.getFrameOwner());
    initScreenListeners(screen);
    injectScreenProperties(screen, properties);
    applyScreenConfigurer(screen);
    return screen;
}
Also used : Frame(io.jmix.ui.component.Frame)

Example 14 with Frame

use of io.jmix.ui.component.Frame in project jmix by jmix-framework.

the class FilterDelegateImpl method isScreenSettingsEnabled.

protected boolean isScreenSettingsEnabled() {
    Frame frame = filter.getFrame();
    if (frame == null) {
        return false;
    }
    if (frame.getFrameOwner() instanceof LegacyFrame) {
        return true;
    }
    ScreenSettingsFacet settingsFacet = UiControllerUtils.getFacet(frame, ScreenSettingsFacet.class);
    return settingsFacet != null;
}
Also used : LegacyFrame(com.haulmont.cuba.gui.screen.compatibility.LegacyFrame) Frame(io.jmix.ui.component.Frame) ScreenSettingsFacet(io.jmix.ui.settings.facet.ScreenSettingsFacet) LegacyFrame(com.haulmont.cuba.gui.screen.compatibility.LegacyFrame)

Example 15 with Frame

use of io.jmix.ui.component.Frame in project jmix by jmix-framework.

the class CubaComponentsHelper method getFilterComponentPath.

public static String getFilterComponentPath(Filter filter) {
    StringBuilder sb = new StringBuilder(filter.getId() != null ? filter.getId() : "filterWithoutId");
    Frame frame = filter.getFrame();
    while (frame != null) {
        sb.insert(0, ".");
        String s = frame.getId() != null ? frame.getId() : "frameWithoutId";
        if (s.contains(".")) {
            s = "[" + s + "]";
        }
        sb.insert(0, s);
        if (frame instanceof Window) {
            break;
        }
        frame = frame.getFrame();
    }
    return sb.toString();
}
Also used : Window(io.jmix.ui.component.Window) Frame(io.jmix.ui.component.Frame)

Aggregations

Frame (io.jmix.ui.component.Frame)24 LegacyFrame (com.haulmont.cuba.gui.screen.compatibility.LegacyFrame)6 Component (io.jmix.ui.component.Component)5 FrameOwner (io.jmix.ui.screen.FrameOwner)4 Screen (io.jmix.ui.screen.Screen)4 MetaClass (io.jmix.core.metamodel.model.MetaClass)3 GuiDevelopmentException (io.jmix.ui.GuiDevelopmentException)3 Window (io.jmix.ui.component.Window)3 CollectionDatasource (com.haulmont.cuba.gui.data.CollectionDatasource)2 MetaProperty (io.jmix.core.metamodel.model.MetaProperty)2 ContainerDataUnit (io.jmix.ui.component.data.meta.ContainerDataUnit)2 EntityDataUnit (io.jmix.ui.component.data.meta.EntityDataUnit)2 CollectionContainer (io.jmix.ui.model.CollectionContainer)2 ScreenSettingsFacet (io.jmix.ui.settings.facet.ScreenSettingsFacet)2 Nullable (javax.annotation.Nullable)2 Strings (com.google.common.base.Strings)1 Iterables (com.google.common.collect.Iterables)1 Security (com.haulmont.cuba.core.global.Security)1 UiComponents (com.haulmont.cuba.gui.UiComponents)1 AbstractWindow (com.haulmont.cuba.gui.components.AbstractWindow)1