/** * Apply attribute access rules to a given frame according to the state of the given entities. All passed entities * will be sent to the middleware and their security state will be recalculated. All screen components * bound to datasources will adjust their visible/read-only/required state according to security state of entity * instances contained in the datasources. * * @param entities list of instances that should recalculate their security state * @param frameOwner frame or screen * @param reset whether to reset the components to the default state specified by role-based security and model * annotations. If you invoke this method to apply attribute access to already opened screen, set * the parameter to true, but keep in mind that previous programmatic changes in the components * visible/read-only/required state will be lost. */ public void applyAttributeAccess(FrameOwner frameOwner, boolean reset, Entity... entities) { for (Entity entity : entities) { attributeAccessUpdater.updateAttributeAccess(entity); } applyAttributeAccess(frameOwner, reset); }
protected void afterShowWindow(Screen screen) { WindowContext windowContext = screen.getWindow().getContext(); if (!WindowParams.DISABLE_APPLY_SETTINGS.getBool(windowContext)) { applySettings(screen, getSettingsImpl(screen.getId())); } if (screen instanceof LegacyFrame) { if (!WindowParams.DISABLE_RESUME_SUSPENDED.getBool(windowContext)) { DsContext dsContext = ((LegacyFrame) screen).getDsContext(); if (dsContext != null) { ((DsContextImplementation) dsContext).resumeSuspended(); } } } if (screen instanceof AbstractWindow) { AbstractWindow abstractWindow = (AbstractWindow) screen; if (abstractWindow.isAttributeAccessControlEnabled()) { attributeAccessSupport.applyAttributeAccess(abstractWindow, false); } } else { DisableAttributeAccessControl annotation = screen.getClass().getAnnotation(DisableAttributeAccessControl.class); if (annotation == null || !annotation.value()) { attributeAccessSupport.applyAttributeAccess(screen, false); } } }