use of io.jmix.ui.component.Component in project jmix by jmix-framework.
the class EntityCombinedScreen method initEditComponents.
/**
* Initializes edit controls, depending on if they should be enabled or disabled.
* @param enabled if true - enables edit controls and disables controls on the left side of the splitter
* if false - vice versa
*/
protected void initEditComponents(boolean enabled) {
TabSheet tabSheet = getTabSheet();
if (tabSheet != null) {
ComponentsHelper.walkComponents(tabSheet, (component, name) -> {
if (component instanceof FieldGroup) {
((FieldGroup) component).setEditable(enabled);
} else if (component instanceof Table) {
((Table) component).getActions().forEach(action -> action.setEnabled(enabled));
} else if (!(component instanceof HasComponents)) {
component.setEnabled(enabled);
}
});
}
getFieldGroup().setEditable(enabled);
getActionsPane().setVisible(enabled);
getLookupBox().setEnabled(!enabled);
}
use of io.jmix.ui.component.Component in project jmix by jmix-framework.
the class CubaComponentsHelper method findChildComponent.
@Nullable
protected static Component findChildComponent(Collection<Component> components, com.vaadin.ui.Component vaadinSource, com.vaadin.ui.Component target) {
com.vaadin.ui.Component targetComponent = ComponentsHelper.getDirectChildComponent(target, vaadinSource);
for (Component component : components) {
com.vaadin.ui.Component unwrapped = component.unwrapComposition(com.vaadin.ui.Component.class);
if (unwrapped == targetComponent) {
Component child = null;
if (component instanceof HasComponents) {
child = ComponentsHelper.findChildComponent((HasComponents) component, target);
}
if (component instanceof HasButtonsPanel) {
ButtonsPanel buttonsPanel = ((HasButtonsPanel) component).getButtonsPanel();
if (buttonsPanel != null) {
if (ComponentsHelper.getVaadinSource(buttonsPanel) == target) {
return buttonsPanel;
} else {
child = ComponentsHelper.findChildComponent(buttonsPanel, target);
}
}
}
if (component instanceof FieldGroup) {
FieldGroup fieldGroup = (FieldGroup) component;
child = ComponentsHelper.findChildComponent(fieldGroup, target);
}
return child != null ? child : component;
}
}
return null;
}
use of io.jmix.ui.component.Component in project jmix by jmix-framework.
the class WebFilter method setDelegate.
@Autowired
protected void setDelegate(FilterDelegate delegate) {
this.delegate = delegate;
delegate.setFilter(this);
ComponentContainer layout = delegate.getLayout();
layout.setParent(this);
component = layout.unwrapComposition(com.vaadin.ui.Component.class);
component.setWidth(100, Sizeable.Unit.PERCENTAGE);
component.addStyleName(FILTER_STYLENAME);
delegate.setExpandedStateChangeListener(e -> fireExpandStateChange(e.isExpanded(), e.isUserOriginated()));
delegate.setCaptionChangedListener(this::updateCaptions);
}
use of io.jmix.ui.component.Component in project jmix by jmix-framework.
the class ScreenSettingsFacetImpl method fillWithInnerComponents.
protected Collection<Component> fillWithInnerComponents(Collection<Component> components, HasInnerComponents hasInnerComponents) {
Collection<Component> innerComponents = hasInnerComponents.getInnerComponents();
components.addAll(innerComponents);
for (Component component : innerComponents) {
if (component instanceof HasInnerComponents) {
fillWithInnerComponents(components, (HasInnerComponents) component);
}
}
return components;
}
use of io.jmix.ui.component.Component in project jmix by jmix-framework.
the class FormImpl method setDebugId.
@Override
public void setDebugId(@Nullable String id) {
super.setDebugId(id);
AppUI ui = AppUI.getCurrent();
if (ui != null && id != null) {
for (final Component component : getOwnComponents()) {
com.vaadin.ui.Component composition = ComponentsHelper.getComposition(component);
composition.setId(ui.getTestIdManager().getTestId(id + "_" + component.getId()));
}
}
}
Aggregations