use of io.jmix.ui.component.Frame in project jmix by jmix-framework.
the class ShowPivotAction method showPivotTable.
@SuppressWarnings("unchecked")
protected void showPivotTable(ShowPivotMode mode) {
Frame frame = target.getFrame();
if (frame == null) {
throw new IllegalStateException(String.format("ShowPivotAction cannot be used by component '%s' which is not added to frame", target.getId()));
}
Collection items;
if (ShowPivotMode.ALL_ROWS.equals(mode)) {
if (target.getItems() instanceof ContainerDataUnit) {
CollectionContainer container = ((ContainerDataUnit) target.getItems()).getContainer();
items = container.getItems();
} else {
items = Collections.emptyList();
}
} else {
items = target.getSelected();
}
PivotScreenBuilder showPivotManager = applicationContext.getBean(PivotScreenBuilder.class, target);
showPivotManager.withItems(items).withIncludedProperties(parseProperties(includedProperties)).withExcludedProperties(parseProperties(excludedProperties)).build().show();
}
use of io.jmix.ui.component.Frame in project jmix by jmix-framework.
the class UiDataFilterSupport method isDefaultForMeFieldVisible.
protected boolean isDefaultForMeFieldVisible(Filter.Configuration currentConfiguration, FilterConfiguration configurationModel) {
Frame filterFrame = currentConfiguration.getOwner().getFrame();
if (currentConfiguration.getOwner().getId() != null && filterFrame != null) {
ScreenSettingsFacet settingsFacet = UiControllerUtils.getFacet(filterFrame, ScreenSettingsFacet.class);
if (settingsFacet != null) {
ScreenSettings settings = settingsFacet.getSettings();
if (settings != null) {
settings.getSettings(currentConfiguration.getOwner().getId(), FilterSettings.class).ifPresent(filterSettings -> {
String defaultConfigurationId = filterSettings.getDefaultConfigurationId();
if (defaultConfigurationId != null) {
boolean defaultForMe = defaultConfigurationId.equals(configurationModel.getConfigurationId());
configurationModel.setDefaultForMe(defaultForMe);
}
});
}
return true;
}
}
return false;
}
use of io.jmix.ui.component.Frame in project jmix by jmix-framework.
the class RelatedAction method execute.
@Override
public void execute() {
if (target == null) {
throw new IllegalStateException("RelatedAction target is not set");
}
if (!(target.getItems() instanceof EntityDataUnit)) {
throw new IllegalStateException("RelatedAction target items is null or does not implement EntityDataUnit");
}
MetaClass metaClass = ((EntityDataUnit) target.getItems()).getEntityMetaClass();
if (metaClass == null) {
throw new IllegalStateException("Target is not bound to entity");
}
if (metaProperty == null && property == null) {
throw new IllegalStateException("Either 'metaProperty' or 'property' must be defined");
}
Frame frame = target.getFrame();
if (frame == null) {
throw new IllegalStateException("Target is not bound to a frame");
}
RelatedEntitiesBuilder builder = relatedEntitiesSupport.builder(frame.getFrameOwner()).withMetaClass(metaClass).withProperty(property).withMetaProperty(metaProperty).withSelectedEntities(target.getSelected()).withConfigurationName(configurationName);
builder = screenInitializer.initBuilder(builder);
Screen screen = builder.build();
screenInitializer.initScreen(screen);
screen.show();
}
use of io.jmix.ui.component.Frame in project jmix by jmix-framework.
the class FilterUtils method generateFilterPath.
public static String generateFilterPath(Filter filter) {
StringBuilder sb = new StringBuilder();
Frame frame = filter.getFrame();
while (frame != null) {
String s = frame.getId() != null ? frame.getId() : "frameWithoutId";
s = "[" + s + "]";
sb.insert(0, s);
if (frame instanceof Window) {
break;
}
frame = frame.getFrame();
}
sb.append(".").append(filter.getId() != null ? filter.getId() : "filterWithoutId");
return sb.toString();
}
Aggregations