protected void clear(Field... fields) { for (Field component : fields) { component.setValue(null); } }
@Override protected void doSetValue(T value) { columnComponent.setValue(value); }
protected void setCurrentDateAsNow(ReportInputParameter parameter, Field dateField) { Date now = reportService.currentDateOrTime(parameter.getType()); dateField.setValue(now); parameter.setDefaultValue(reportService.convertToString(now.getClass(), now)); }
if (closeAction instanceof StandardCloseAction && ((StandardCloseAction) closeAction).getActionId().equals(Window.COMMIT_ACTION_ID)) { actualField.setValue(((ListEditorWindowController) screen).getValue());
protected void setFullName(String displayedName) { if (datasource != null) { datasource.getItem().setValue("name", displayedName); } else if (window != null) { Field field = (Field) window.getComponentNN("name"); field.setValue(displayedName); } else { fieldGroup.setFieldValue("name", displayedName); } }
@SuppressWarnings("unchecked") @Override public void paramChanged(Param oldParam, Param newParam) { Component oldParamEditComponent = paramEditComponent; for (Component component : paramEditComponentLayout.getComponents()) { paramEditComponentLayout.remove(component); } createParamEditLayout(); if (paramEditComponent instanceof Field) { ((Field) paramEditComponent).setRequired(condition.getRequired()); if (oldParam.getJavaClass().equals(newParam.getJavaClass()) && paramEditComponent.getClass().equals(oldParamEditComponent.getClass())) { ((Field) paramEditComponent).setValue(((Field) oldParamEditComponent).getValue()); } } }
protected void _addValue(Field componentForAdding) { Object value = componentForAdding.getValue(); if (value != null) { componentForAdding.setValue(null); if (!valueExists(value)) { addValueToLayout(value, ListEditorHelper.getValueCaption(value, itemType, timeZone, optionCaptionProvider)); } } }
@Override public void actionPerform(Component component) { editField.setEnabled(!editField.isEnabled()); if (!editField.isEnabled()) { if (editField instanceof ListEditor) { editField.setValue(Collections.EMPTY_LIST); } else { editField.setValue(null); } setIcon("icons/edit.png"); clearButton.setDescription(getMessage("bulk.editAttribute")); } else { setIcon("icons/trash.png"); clearButton.setDescription(getMessage("bulk.clearAttribute")); } } };
protected void setFieldValue(Field field, ProcFormParam formParam, String actExecutionId) { if (!Strings.isNullOrEmpty(formParam.getValue())) { Object value = null; if (isExpression(formParam.getValue())) { value = processRuntimeService.evaluateExpression(formParam.getValue(), actExecutionId); } else { EntityLoadInfoBuilder entityLoadInfoBuilder = AppBeans.get(EntityLoadInfoBuilder.class); EntityLoadInfo entityLoadInfo = entityLoadInfoBuilder.parse(formParam.getValue()); if (entityLoadInfo != null) { value = loadEntityInstance(entityLoadInfo); } } field.setValue(value); } }
/** * Sets the value from the {@code formParam} to the field. Before setting is performed the value is * parsed or if an UEL expression is stored in {@code formParam} this expression is evaluated. */ protected void setFieldValue(Field field, ProcFormParam formParam, Datatype datatype, String actExecutionId) { if (!Strings.isNullOrEmpty(formParam.getValue())) { try { Object value; if (isExpression(formParam.getValue())) { value = processRuntimeService.evaluateExpression(formParam.getValue(), actExecutionId); } else { value = datatype.parse(formParam.getValue()); } field.setValue(value); } catch (ParseException e) { throw new BpmException("Error when parsing process form parameter value", e); } } }
protected void addClearBtn() { clearBtn = uiComponents.create(Button.class); clearBtn.setIconFromSet(CubaIcon.PICKERFIELD_CLEAR); clearBtn.setStyleName("c-listeditor-button"); clearBtn.setCaption(""); clearBtn.setAction(new BaseAction("clear") .withCaption("Clear") .withHandler(event -> actualField.setValue(null) )); layout.add(clearBtn); }
protected void initMaxResults() { checkState(); int maxResults; if (this.maxResults != -1) { maxResults = this.maxResults; } else { maxResults = adapter.getMaxResults(); } if (maxResults == 0 || maxResults == persistenceManager.getMaxFetchUI(adapter.getMetaClass().getName())) { maxResults = persistenceManager.getFetchUI(adapter.getMetaClass().getName()); } if (maxResultsAddedToLayout) { if (!textMaxResults) { List<Integer> optionsList = ((LookupField) maxResultsField).getOptionsList(); if (!optionsList.contains(maxResults)) { maxResults = findClosestValue(maxResults, optionsList); Collections.sort(optionsList); ((LookupField) maxResultsField).setOptionsList(optionsList); } } maxResultsField.setValue(maxResults); } adapter.setMaxResults(maxResults); }
field.setValue(value); } else { CollectionDatasource datasource = (CollectionDatasource) field.getDatasource();
protected void initDefaultValueField() { defaultValueLabel.setVisible(false); defaultValueBox.removeAll(); ReportInputParameter parameter = getItem(); if (canHaveDefaultValue()) { Field<Object> field = parameterFieldCreator.createField(parameter); field.addValueChangeListener(e -> { if (e.getValue() != null) { parameter.setDefaultValue(reportService.convertToString(e.getValue().getClass(), e.getValue())); } else { parameter.setDefaultValue(null); } }); if (parameter.getParameterClass() != null) { field.setValue(reportService.convertFromString(parameter.getParameterClass(), parameter.getDefaultValue())); } field.setRequired(false); defaultValueBox.add(field); defaultValueLabel.setVisible(true); } defaultValueBox.setEnabled(security.isEntityOpPermitted(metadata.getClassNN(ReportInputParameter.class), EntityOp.UPDATE)); }