@Override public void init(Map<String, Object> params) { getDialogOptions() .setWidth(theme.get("cuba.gui.saveFilterWindow.dialog.width")); super.init(params); String filterNameParam = (String) params.get("filterName"); if (!Strings.isNullOrEmpty(filterNameParam)) { filterName.setValue(filterNameParam); } MetaProperty property = metadata.getClassNN(FilterEntity.class).getPropertyNN("name"); Map<String, Object> annotations = property.getAnnotations(); Integer maxLength = (Integer) annotations.get("length"); if (maxLength != null) { filterName.setMaxLength(maxLength); } }
protected void initMainFields() { mainFields.addCustomField("entity", (datasource, propertyId) -> { LookupField lookupField = componentsFactory.createComponent(LookupField.class); lookupField.requestFocus(); entity = lookupField; return lookupField; }); mainFields.addCustomField("reportName", (datasource, propertyId) -> { TextField textField = componentsFactory.createComponent(TextField.class); textField.setMaxLength(255); reportName = textField; return textField; }); mainFields.addCustomField("templateFileFormat", (datasource, propertyId) -> { LookupField lookupField = componentsFactory.createComponent(LookupField.class); templateFileFormat = lookupField; return lookupField; }); mainFields.addCustomField("reportType", (datasource, propertyId) -> { OptionsGroup optionsGroup = componentsFactory.createComponent(OptionsGroup.class); optionsGroup.setMultiSelect(false); optionsGroup.setOrientation(OptionsGroup.Orientation.VERTICAL); reportTypeOptionGroup = optionsGroup; return optionsGroup; }); }
protected void createMaxResultsLayout() { maxResultsLayout = uiComponents.create(HBoxLayout.class); maxResultsLayout.setStyleName("c-maxresults"); maxResultsLayout.setSpacing(true); Label<String> maxResultsLabel = uiComponents.create(Label.NAME); maxResultsLabel.setStyleName("c-maxresults-label"); maxResultsLabel.setValue(messages.getMainMessage("filter.maxResults.label1")); maxResultsLabel.setAlignment(Alignment.MIDDLE_RIGHT); maxResultsLayout.add(maxResultsLabel); maxResultsTextField = uiComponents.create(TextField.TYPE_INTEGER); maxResultsTextField.setStyleName("c-maxresults-input"); maxResultsTextField.setMaxLength(4); maxResultsTextField.setWidth(theme.get("cuba.gui.Filter.maxResults.width")); maxResultsLookupField = maxResultsFieldHelper.createMaxResultsLookupField(); maxResultsLookupField.setStyleName("c-maxresults-select"); maxResultsField = textMaxResults ? maxResultsTextField : maxResultsLookupField; maxResultsField.addValueChangeListener(integerValueChangeEvent -> maxResultValueChanged = true); maxResultsLayout.add(maxResultsField); }
Integer maxLength = (Integer) annotations.get("length"); if (maxLength != null) { filterName.setMaxLength(maxLength);