Search in sources :

Example 1 with Fragments

use of io.jmix.ui.Fragments in project jmix by jmix-framework.

the class AbstractLookup method initLookupLayout.

@Override
public void initLookupLayout() {
    Action selectAction = getAction(LOOKUP_SELECT_ACTION_ID);
    if (selectAction != null && selectAction.getOwner() == null) {
        Fragments fragments = UiControllerUtils.getScreenContext(this).getFragments();
        ScreenFragment lookupWindowActions = fragments.create(this, "lookupWindowActions");
        lookupWindowActions.getFragment().setId("lookupWindowActions");
        lookupWindowActions.getFragment().setVisible(false);
        getFrame().add(lookupWindowActions.getFragment());
    }
    Element element = ((Component.HasXmlDescriptor) getFrame()).getXmlDescriptor();
    if (element != null) {
        String lookupComponent = element.attributeValue("lookupComponent");
        if (StringUtils.isNotEmpty(lookupComponent)) {
            Component component = getFrame().getComponent(lookupComponent);
            setLookupComponent(component);
        }
    }
    Component lookupComponent = getLookupComponent();
    if (lookupComponent instanceof LookupComponent.LookupSelectionChangeNotifier) {
        LookupComponent.LookupSelectionChangeNotifier selectionNotifier = (LookupComponent.LookupSelectionChangeNotifier) lookupComponent;
        if (selectAction != null) {
            // noinspection unchecked
            selectionNotifier.addLookupValueChangeListener(valueChangeEvent -> selectAction.setEnabled(!selectionNotifier.getLookupSelectedItems().isEmpty()));
            selectAction.setEnabled(!selectionNotifier.getLookupSelectedItems().isEmpty());
        }
    }
}
Also used : Action(io.jmix.ui.action.Action) BaseAction(io.jmix.ui.action.BaseAction) ScreenFragment(io.jmix.ui.screen.ScreenFragment) Element(org.dom4j.Element) Fragments(io.jmix.ui.Fragments) Component(io.jmix.ui.component.Component)

Example 2 with Fragments

use of io.jmix.ui.Fragments in project jmix by jmix-framework.

the class FragmentImpl method attached.

@Override
public void attached() {
    super.attached();
    FragmentContextImpl context = (FragmentContextImpl) getContext();
    if (context.isManualInitRequired()) {
        if (!context.isInitialized()) {
            Fragments fragments = UiControllerUtils.getScreenContext(frameOwner).getFragments();
            fragments.init(frameOwner);
        }
        UiControllerUtils.fireEvent(frameOwner, ScreenFragment.AttachEvent.class, new ScreenFragment.AttachEvent(frameOwner));
    }
}
Also used : ScreenFragment(io.jmix.ui.screen.ScreenFragment) Fragments(io.jmix.ui.Fragments) FragmentContextImpl(io.jmix.ui.sys.FragmentContextImpl)

Example 3 with Fragments

use of io.jmix.ui.Fragments in project jmix by jmix-framework.

the class UiDataFilterSupport method createFilterConfigurationFragment.

@Override
public ScreenFragment createFilterConfigurationFragment(FrameOwner owner, boolean isNewConfiguration, Filter.Configuration currentConfiguration) {
    FilterConfiguration configurationModel = loadFilterConfigurationModel(isNewConfiguration, currentConfiguration);
    boolean defaultForMeFieldVisible = isDefaultForMeFieldVisible(currentConfiguration, configurationModel);
    registerConfigurationDc(configurationModel, owner);
    Fragments fragments = UiControllerUtils.getScreenContext(owner).getFragments();
    UiDataFilterConfigurationModelFragment fragment = fragments.create(owner, UiDataFilterConfigurationModelFragment.class);
    fragment.setDefaultForMeFieldVisible(defaultForMeFieldVisible);
    return fragment;
}
Also used : FilterConfiguration(io.jmix.uidata.entity.FilterConfiguration) Fragments(io.jmix.ui.Fragments) UiDataFilterConfigurationModelFragment(io.jmix.uidata.app.filter.configuration.UiDataFilterConfigurationModelFragment)

Example 4 with Fragments

use of io.jmix.ui.Fragments in project jmix by jmix-framework.

the class FilterSupport method createFilterConfigurationFragment.

public ScreenFragment createFilterConfigurationFragment(FrameOwner owner, boolean isNewConfiguration, Filter.Configuration currentConfiguration) {
    Fragments fragments = UiControllerUtils.getScreenContext(owner).getFragments();
    FilterConfigurationModelFragment fragment = fragments.create(owner, FilterConfigurationModelFragment.class);
    initFilterConfigurationFragment(fragment, isNewConfiguration, currentConfiguration);
    return fragment;
}
Also used : Fragments(io.jmix.ui.Fragments) FilterConfigurationModelFragment(io.jmix.ui.app.filter.configuration.FilterConfigurationModelFragment)

Aggregations

Fragments (io.jmix.ui.Fragments)4 ScreenFragment (io.jmix.ui.screen.ScreenFragment)2 Action (io.jmix.ui.action.Action)1 BaseAction (io.jmix.ui.action.BaseAction)1 FilterConfigurationModelFragment (io.jmix.ui.app.filter.configuration.FilterConfigurationModelFragment)1 Component (io.jmix.ui.component.Component)1 FragmentContextImpl (io.jmix.ui.sys.FragmentContextImpl)1 UiDataFilterConfigurationModelFragment (io.jmix.uidata.app.filter.configuration.UiDataFilterConfigurationModelFragment)1 FilterConfiguration (io.jmix.uidata.entity.FilterConfiguration)1 Element (org.dom4j.Element)1