public Boolean getResponsive() { return responsive.getValue(); }
public boolean getGeneratePasswords() { return Boolean.TRUE.equals(generatePasswordsCheckBox.getValue()); } }
protected EnumSet<ReportImportOption> getImportOptions() { if (BooleanUtils.isNotTrue(importRoles.getValue())) { return EnumSet.of(ReportImportOption.DO_NOT_IMPORT_ROLES); } return null; }
public boolean getSendEmails() { return Boolean.TRUE.equals(sendEmailsCheckBox.getValue()) && getGeneratePasswords(); }
private boolean isAllReadOnly() { return permissionControls.stream().allMatch(c -> c.readOnlyCheckBox.getValue() || !c.readOnlyCheckBox.isEditable()); }
private boolean isAllModified() { return permissionControls.stream().allMatch(c -> c.modifyCheckBox.getValue() || !c.modifyCheckBox.isEditable()); }
private boolean isAllHide() { return permissionControls.stream().allMatch(c -> c.hideCheckBox.getValue() || !c.hideCheckBox.isEditable()); }
public void applyFilter() { attributeTargetsDs.refresh(); if (attributeTargetsDs.getItemIds().isEmpty()) { String message; Object value = entityFilter.getValue(); if (Boolean.TRUE.equals(assignedOnlyCheckBox.getValue())) { message = String.format(getMessage("noAssignedItemsForFilter"), value != null ? value : " "); } else { message = String.format(getMessage("noItemsForFilter"), value != null ? value : " "); } showNotification(message, NotificationType.HUMANIZED); } }
protected void updateExpectedResultLabel() { if (Boolean.TRUE.equals(sendEmailsCheckBox.getValue())) { expectedResultLabel.setValue(getMessage("sendPasswords")); } else { expectedResultLabel.setValue(getMessage("printPasswords")); } }
@SuppressWarnings("unused") public void applyFilter() { entityTargetsDs.refresh(); if (entityTargetsDs.getItemIds().isEmpty()) { String message; Object value = entityFilter.getValue(); if (Boolean.TRUE.equals(assignedOnlyCheckBox.getValue())) { message = String.format(getMessage("noAssignedItemsForFilter"), value != null ? value : " "); } else { message = String.format(getMessage("noItemsForFilter"), value != null ? value : " "); } showNotification(message, NotificationType.HUMANIZED); } }
protected void saveTimeZoneSettings() { UserTimeZone userTimeZone = new UserTimeZone(timeZoneLookup.getValue(), timeZoneAutoField.getValue()); userManagementService.saveOwnTimeZone(userTimeZone); }
protected void checkAllCheckboxes() { CheckBox selectAllCheckBox = (CheckBox) attributesBoxScroll.getOwnComponent(SELECT_ALL_CHECK_BOX); if (selectAllCheckBox != null) { for (Component c : attributesBoxScroll.getComponents()) { if (!c.equals(selectAllCheckBox)) { CheckBox checkBox = (CheckBox) c; if (!checkBox.getValue()) { setSelectAllCheckBox(false); return; } } } if (attributesBoxScroll.getComponents().size() != 1) setSelectAllCheckBox(true); } }
@Override public boolean test(@Nullable T target) { if (target != null) { if (Boolean.TRUE.equals(assignedOnlyCheckBox.getValue()) && !target.isAssigned()) { return false; } if (Boolean.FALSE.equals(systemLevelCheckBox.getValue()) && (target instanceof EntityPermissionTarget) && !target.isAssigned()) { Class entityClass = ((EntityPermissionTarget) target).getEntityClass(); MetaClass metaClass = metadata.getSession().getClassNN(entityClass); if (metadata.getTools().isSystemLevel(metaClass)) { return false; } } String filterValue = StringUtils.trimToEmpty(entityFilter.getValue()); return StringUtils.isBlank(filterValue) || StringUtils.containsIgnoreCase(target.getCaption(), filterValue); } return false; } }
@SuppressWarnings("unused") public void applyPermissionMask() { Set<OperationPermissionTarget> selected = entityPermissionsTable.getSelected(); if (!selected.isEmpty() && (selected.size() > 1)) { for (OperationPermissionTarget target : selected) { for (EntityOperationControl control : operationControls) { if (control.isControlVisible() && control.applicableToEntity(target.getEntityClass())) { PermissionVariant variant; if (Boolean.TRUE.equals(control.getAllowChecker().getValue())) { variant = PermissionVariant.ALLOWED; } else if (Boolean.TRUE.equals(control.getDenyChecker().getValue())) { variant = PermissionVariant.DISALLOWED; } else { variant = PermissionVariant.NOTSET; } markTargetPermission(target, control.getMetaProperty(), control.getOperation(), variant); } } } // update all after data change entityPermissionsTable.repaint(); showNotification(getMessage("notification.applied"), NotificationType.HUMANIZED); } }
protected void updateCheckBoxes(OperationPermissionTarget item) { itemChanging = true; if (isSingleSelection()) { if (item != null) { for (EntityOperationControl control : operationControls) { updateCheckBoxes(item.getValue(control.getMetaProperty()), control.getAllowChecker(), control.getDenyChecker()); } boolean isAllowedAll = true; boolean isDenyAll = true; for (EntityOperationControl control : operationControls) { if (control.isControlVisible()) { isAllowedAll &= Boolean.TRUE.equals(control.getAllowChecker().getValue()); isDenyAll &= Boolean.TRUE.equals(control.getDenyChecker().getValue()); } } allAllowCheck.setValue(isAllowedAll); allDenyCheck.setValue(isDenyAll); } else { deselectAllCheckers(); } } else { deselectAllCheckers(); } itemChanging = false; }
protected void setRememberMeCookies() { if (connection.isAuthenticated()) { if (webConfig.getRememberMeEnabled()) { if (Boolean.TRUE.equals(rememberMeCheckBox.getValue())) { if (!loginByRememberMe) { app.addCookie(COOKIE_REMEMBER_ME, Boolean.TRUE.toString()); String login = loginField.getValue(); String encodedLogin = URLEncodeUtils.encodeUtf8(login); app.addCookie(COOKIE_LOGIN, StringEscapeUtils.escapeJava(encodedLogin)); UserSession session = connection.getSession(); if (session == null) { throw new IllegalStateException("Unable to get session after login"); } User user = session.getUser(); String rememberMeToken = userManagementService.generateRememberMeToken(user.getId()); app.addCookie(COOKIE_PASSWORD, rememberMeToken); } } else { app.removeCookie(COOKIE_REMEMBER_ME); app.removeCookie(COOKIE_LOGIN); app.removeCookie(COOKIE_PASSWORD); } } } }
protected void initLocales() { localesSelect.setOptionsMap(globalConfig.getAvailableLocales()); localesSelect.setValue(app.getLocale()); boolean localeSelectVisible = globalConfig.getLocaleSelectVisible(); localesSelect.setVisible(localeSelectVisible); // if old layout is used Component localesSelectLabel = getComponent("localesSelectLabel"); if (localesSelectLabel != null) { localesSelectLabel.setVisible(localeSelectVisible); } localesSelect.addValueChangeListener(e -> { Locale selectedLocale = (Locale) e.getValue(); app.setLocale(selectedLocale); authInfoThreadLocal.set(new AuthInfo(loginField.getValue(), passwordField.getValue(), rememberMeCheckBox.getValue())); try { app.createTopLevelWindow(); } finally { authInfoThreadLocal.set(null); } }); }
@Override public void actionPerform(Component component) { LoggedEntity selectedEntity = loggedEntityTable.getSelected().iterator().next(); Set<LoggedAttribute> enabledAttributes = selectedEntity.getAttributes(); for (Component c : attributesBoxScroll.getComponents()) { CheckBox currentCheckBox = (CheckBox) c; if (currentCheckBox.getId().equals(SELECT_ALL_CHECK_BOX)) continue; Boolean currentCheckBoxValue = currentCheckBox.getValue(); if (currentCheckBoxValue && !isEntityHaveAttribute(currentCheckBox.getId(), enabledAttributes)) { //add attribute if checked and not exist in table LoggedAttribute newLoggedAttribute = metadata.create(LoggedAttribute.class); newLoggedAttribute.setName(currentCheckBox.getId()); newLoggedAttribute.setEntity(selectedEntity); loggedAttrDs.addItem(newLoggedAttribute); } if (!currentCheckBoxValue && isEntityHaveAttribute(currentCheckBox.getId(), enabledAttributes)) { //remove attribute if unchecked and exist in table LoggedAttribute removeAtr = getLoggedAttribute(currentCheckBox.getId(), enabledAttributes); if (removeAtr != null) loggedAttrDs.removeItem(removeAtr); } } getDsContext().commit(); loggedEntityDs.refresh(); disableControls(); loggedEntityTable.setEnabled(true); loggedEntityTable.focus(); logService.invalidateCache(); } }
@Override public ParameterValue getValue() { switch (type) { case DATETIME: return new DateTimeParameterValue(dateField.getValue()); case TIME: return new TimeParameterValue(timeField.getValue()); case DATE: return new DateParameterValue(dateField.getValue()); case DECIMAL: return new DecimalParameterValue(textField.getValue()); case INTEGER: return new IntegerParameterValue(textField.getValue()); case LONG: return new LongParameterValue(textField.getValue()); case STRING: return new StringParameterValue(textField.getValue()); case UUID: return new UuidParameterValue(UUID.fromString(textField.getValue())); case BOOLEAN: return new BooleanParameterValue(checkBox.getValue()); default: return null; } }