protected void createFtsSwitch() { ftsSwitch = uiComponents.create(CheckBox.class); ftsSwitch.setCaption(getMainMessage("filter.ftsSwitch")); ftsSwitch.setValue(filterMode == FilterMode.FTS_MODE); ftsSwitch.addValueChangeListener(e -> { filterMode = Boolean.TRUE.equals(e.getValue()) ? FilterMode.FTS_MODE : FilterMode.GENERIC_MODE; switchFilterMode(filterMode); }); ftsSwitch.setVisible(modeSwitchVisible); }
protected void attachCheckBoxListener(CheckBox checkBox, UiPermissionVariant activeVariant) { checkBox.addValueChangeListener(e -> { if (itemChanging) return; if (uiPermissionsTable.getSelected().isEmpty()) return; itemChanging = true; UiPermissionVariant permissionVariant = PermissionUiHelper.getCheckBoxVariant(e.getValue(), activeVariant); UiPermissionTarget target = uiPermissionsTable.getSingleSelected(); markItemPermission(permissionVariant, target); uiPermissionTargetsDs.updateItem(target); itemChanging = false; }); }
protected void initTimeZoneFields() { Map<String, String> options = new TreeMap<>(); for (String id : TimeZone.getAvailableIDs()) { TimeZone timeZone = TimeZone.getTimeZone(id); options.put(timeZones.getDisplayNameLong(timeZone), id); } timeZoneLookup.setOptionsMap(options); timeZoneAutoField.setCaption(messages.getMainMessage("timeZone.auto")); timeZoneAutoField.setDescription(messages.getMainMessage("timeZone.auto.descr")); timeZoneAutoField.addValueChangeListener(e -> timeZoneLookup.setEnabled(!Boolean.TRUE.equals(e.getValue()))); UserTimeZone userTimeZone = userManagementService.loadOwnTimeZone(); timeZoneLookup.setValue(userTimeZone.name); timeZoneAutoField.setValue(userTimeZone.auto); }
@Override public void init(Map<String, Object> params) { super.init(params); getDialogOptions() .setWidth(theme.get("cuba.gui.ResetPasswordsDialog.width")) .setResizable(false); generatePasswordsCheckBox.addValueChangeListener(e -> { if (Boolean.TRUE.equals(e.getValue())) { sendEmailsCheckBox.setEnabled(true); updateExpectedResultLabel(); } else { sendEmailsCheckBox.setValue(false); sendEmailsCheckBox.setEnabled(false); } expectedResultLabel.setVisible(getGeneratePasswords()); }); sendEmailsCheckBox.addValueChangeListener(e -> updateExpectedResultLabel()); }
protected CheckBox createUnaryField(final ValueProperty valueProperty) { CheckBox field = componentsFactory.createComponent(CheckBox.class); field.addValueChangeListener(e -> { Object newValue = BooleanUtils.isTrue((Boolean) e.getValue()) ? true : null; _setValue(newValue, valueProperty); }); field.setValue((Boolean) _getValue(valueProperty)); field.setAlignment(Component.Alignment.MIDDLE_LEFT); return field; }
@Override public void init(Map<String, Object> params) { String entityName = (String) params.get("entity"); if (entityName != null) { Session session = metadata.getSession(); selectedMeta = session.getClass(entityName); createEntitiesTable(selectedMeta); lookupBox.setVisible(false); } else { entitiesLookup.setOptionsMap(getEntitiesLookupFieldOptions()); entitiesLookup.addValueChangeListener(e -> showEntities()); removedRecords.addValueChangeListener(e -> showEntities()); } }
private void addSizeAutoFieldListener(CheckBox sizeAutoCheckbox, TextField field, LookupField unitsField) { sizeAutoCheckbox.addValueChangeListener(e -> { Boolean value = (Boolean) e.getValue(); if (value) { field.setValue(-1); unitsField.setValue(SizeUnit.PIXELS); } else { field.setValue(100); unitsField.setValue(SizeUnit.PERCENTAGE); } field.setVisible(!value); unitsField.setVisible(!value); }); }
protected void addAttribute(Set<LoggedAttribute> enabledAttributes, String name, boolean editable) { CheckBox checkBox = factory.createComponent(CheckBox.class); if (enabledAttributes != null && isEntityHaveAttribute(name, enabledAttributes)) { checkBox.setValue(true); } checkBox.setId(name); checkBox.setCaption(name); checkBox.setEditable(editable); checkBox.addValueChangeListener(e -> checkAllCheckboxes()); attributesBoxScroll.add(checkBox); }
protected void attachListener(CheckBox checkBox, final AttributePermissionVariant activeVariant) { checkBox.addValueChangeListener(e -> { if (itemChanging) { return; } if (propertyPermissionsTable.getSelected().isEmpty()) { return; } itemChanging = true; markTargetPermission(PermissionUiHelper.getCheckBoxVariant(e.getValue(), activeVariant)); if (activeVariant != AttributePermissionVariant.MODIFY) modifyCheckBox.setValue(false); if (activeVariant != AttributePermissionVariant.READ_ONLY) readOnlyCheckBox.setValue(false); if (activeVariant != AttributePermissionVariant.HIDE) hideCheckBox.setValue(false); allModifyCheck.setValue(isAllModified()); allReadOnlyCheck.setValue(isAllReadOnly()); allHideCheck.setValue(isAllHide()); // todo enforce property change instead of item attributeTargetsDs.updateItem(item); itemChanging = false; }); }
protected void attachCheckBoxListener(final CheckBox checkBox, final String metaProperty, final EntityOp operation, final PermissionVariant activeVariant) { checkBox.addValueChangeListener(e -> { if (itemChanging) return;
protected void initIsDefaultCheckbox() { isDefault.setValue(BooleanUtils.isTrue(category.getIsDefault())); isDefault.addValueChangeListener(e -> { if (Boolean.TRUE.equals(e.getValue())) { LoadContext<Category> lc = new LoadContext<>(Category.class) .setView("category.defaultEdit"); lc.setQueryString("select c from sys$Category c where c.entityType = :entityType and not c.id = :id") .setParameter("entityType", category.getEntityType()) .setParameter("id", category.getId()); List<Category> result = dataManager.loadList(lc); for (Category cat : result) { cat.setIsDefault(false); } CommitContext commitCtx = new CommitContext(result); dataManager.commit(commitCtx); category.setIsDefault(true); } else if (Boolean.FALSE.equals(e.getValue())) { category.setIsDefault(false); } }); }
protected void attachAllCheckboxListener(CheckBox checkBox, final AttributePermissionVariant activeVariant) { checkBox.addValueChangeListener(e -> { if (itemChanging) { return; } if (propertyPermissionsTable.getSelected().isEmpty()) { return; } itemChanging = true; MultiplePermissionTarget item = propertyPermissionsTable.getSingleSelected(); if (item != null) { for (AttributePermissionControl control : permissionControls) { AttributePermissionVariant permissionVariant = PermissionUiHelper.getCheckBoxVariant(e.getValue(), activeVariant); control.markTargetPermission(permissionVariant); control.updateCheckers(permissionVariant); } // todo enforce value change propertyPermissionsTable.repaint(); allModifyCheck.setValue(isAllModified()); allReadOnlyCheck.setValue(isAllReadOnly()); allHideCheck.setValue(isAllHide()); } itemChanging = false; }); }
protected void initTransformations() { ReportInputParameter parameter = getItem(); predefinedTransformation.setValue(parameter.getPredefinedTransformation() != null); enableControlsByTransformationType(parameter.getPredefinedTransformation() != null); predefinedTransformation.addValueChangeListener(e -> { boolean hasPredefinedTransformation = e.getValue() != null && e.getValue(); enableControlsByTransformationType(hasPredefinedTransformation); if (hasPredefinedTransformation) { parameter.setTransformationScript(null); } else { parameter.setPredefinedTransformation(null); } }); predefinedTransformation.setEditable(security.isEntityOpPermitted(ReportInputParameter.class, EntityOp.UPDATE)); }
protected void attachAllCheckBoxListener(CheckBox checkBox, final PermissionVariant activeVariant) { checkBox.addValueChangeListener(e -> { if (itemChanging) return; if (entityPermissionsTable.getSelected().isEmpty()) return; itemChanging = true; PermissionVariant permissionVariant = PermissionUiHelper.getCheckBoxVariant(e.getValue(), activeVariant); if (isSingleSelection()) { for (EntityOperationControl control : operationControls) { OperationPermissionTarget target = entityPermissionsTable.getSingleSelected(); //noinspection ConstantConditions if (control.applicableToEntity(target.getEntityClass())) { markItemPermission(control.getMetaProperty(), control.getOperation(), permissionVariant); } } } else { for (EntityOperationControl control : operationControls) { control.getAllowChecker().setValue(permissionVariant == PermissionVariant.ALLOWED); control.getDenyChecker().setValue(permissionVariant == PermissionVariant.DISALLOWED); } allAllowCheck.setValue(permissionVariant == PermissionVariant.ALLOWED); allDenyCheck.setValue(permissionVariant == PermissionVariant.DISALLOWED); } entityPermissionsTable.repaint(); itemChanging = false; }); }
assignedOnlyCheckBox.addValueChangeListener(e -> applyFilter());
numberField.addValueChangeListener(e -> intervalValue.setNumber(e.getValue())); timeUnitLookup.addValueChangeListener(e -> intervalValue.setTimeUnit(e.getValue())); includingCurrentCheckBox.addValueChangeListener(e -> intervalValue.setIncludingCurrent(e.getValue())); predefinedIntervalsLookup.addValueChangeListener(e -> intervalValue.setPredefinedDateInterval(e.getValue()));
allowCheckBox.addValueChangeListener(e -> { if (!itemChanging) { itemChanging = true; disallowCheckBox.addValueChangeListener(e -> { if (!itemChanging) { itemChanging = true;
autoRefreshCheck.addValueChangeListener(e -> { if (Boolean.TRUE.equals(e.getValue())) { updateLogTailTimer.start();
screenFilter.addEnterPressListener(e -> applyFilter()); allowCheckBox.addValueChangeListener(e -> { if (!itemChanging) { itemChanging = true; disallowCheckBox.addValueChangeListener(e -> { if (!itemChanging) { itemChanging = true;
assignedOnlyCheckBox.addValueChangeListener(e -> applyFilter());