use of com.haulmont.cuba.gui.Fragments in project cuba by cuba-platform.
the class WebFragment 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 com.haulmont.cuba.gui.Fragments in project cuba by cuba-platform.
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 LookupSelectionChangeNotifier) {
LookupSelectionChangeNotifier selectionNotifier = (LookupSelectionChangeNotifier) lookupComponent;
if (selectAction != null) {
// noinspection unchecked
selectionNotifier.addLookupValueChangeListener(valueChangeEvent -> selectAction.setEnabled(!selectionNotifier.getLookupSelectedItems().isEmpty()));
selectAction.setEnabled(!selectionNotifier.getLookupSelectedItems().isEmpty());
}
}
}
Aggregations