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());
}
}
}
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));
}
}
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;
}
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;
}
Aggregations