public String getFilterName() { return filterName.getValue(); } }
@Override public void postInit() { typesInfo = widgetRepository.getWidgetTypesInfo(); setWidgetType(); initParametersFrame(); widgetCaption.addValueChangeListener(v -> { if (StringUtils.isEmpty(widgetId.getValue())) { widgetId.setValue(v.getValue()); } }); ((AbstractDatasource) widgetDs).setModified(false); }
@Override public void actionPerform(Component component) { componentTextField.setValue(componentTextField.getRawValue() + selectedComponentId); } }
protected void initTextField(String dataType) { textField.setDatatype(dataType == null ? null : datatypes.get(dataType)); textField.setVisible(true); }
final TextField lastNameField = (TextField) fieldGroup.getFieldNN("lastName").getComponentNN(); final TextField nameField = (TextField) fieldGroup.getFieldNN("name").getComponentNN(); firstNameField.addValueChangeListener(e -> { String prevValue = (e.getPrevValue() != null ? e.getPrevValue() + " " : ""); if (e.getValue() != null) { if (nameField.getValue() == null || nameField.getRawValue().equals(prevValue + lastNameField.getValue())) { if (lastNameField.getValue() != null) { nameField.setValue(e.getValue() + " " + lastNameField.getValue()); } else { nameField.setValue(e.getValue()); if (lastNameField.getValue() == null) prevValue = prevValue.trim(); if (nameField.getRawValue().equals(prevValue + lastNameField.getRawValue())) { nameField.setValue(lastNameField.getValue()); lastNameField.addValueChangeListener(e -> { String prevValue = (e.getPrevValue() != null ? " " + e.getPrevValue() : ""); if (e.getValue() != null) { if (nameField.getValue() == null || nameField.getRawValue().equals(firstNameField.getValue() + prevValue)) { if (firstNameField.getValue() != null) { nameField.setValue(firstNameField.getValue() + " " + e.getValue()); } else { nameField.setValue(e.getValue()); if (firstNameField.getValue() == null) prevValue = prevValue.trim();
if (item.getOverridden()) { TextField<String> textField = uiComponents.create(TextField.NAME); textField.setValue(item.getDisplayedCurrentValue()); textField.setEditable(false); return textField; } else { TextField<Object> textField = uiComponents.create(TextField.NAME); textField.setValue(item.getCurrentValue()); textField.setDatatype(datatype); } catch (ParseException e) { textField.addValueChangeListener(e -> { appPropertyDs.getItem().setCurrentValue(e.getValue() == null ? null : e.getValue().toString()); }); displayedDefaultValueField.setFormatter(defaultValueFormatter);
field.addValueChangeListener(e -> { String strValue = e.getValue(); if (strValue == null) { field.setValue((String) _value); } else { field.setValue("");
field.setWidth(theme.get("cuba.gui.filter.Param.textComponent.width")); field.addValueChangeListener(e -> { Object paramValue = null; if (!StringUtils.isBlank((String) e.getValue())) { field.setValue(StringUtils.join((Collection) _value, ",")); } else if (_value instanceof String) { field.setValue((String) _value); } else { field.setValue("");
public void decorate(Table<DataSet> dataSets, final Datasource<BandDefinition> bandDefinitionDs) { dataSets.addGeneratedColumn("name", entity -> { TextField textField = componentsFactory.createComponent(TextField.class); textField.setParent(dataSets); textField.setWidthFull(); textField.setHeightAuto(); textField.setValue(entity.getName()); textField.setDatasource(dataSets.getItemDatasource(entity), "name"); !Strings.isNullOrEmpty(entity.getName()) && (entity.getName().endsWith(HORIZONTAL_TPL) || entity.getName().endsWith(VERTICAL_TPL))) { textField.setEditable(false); textField.setEditable(isUpdatePermitted()); return textField; });
fillEnumLookup(timeUnitLookup, DateIntervalValue.TimeUnit.class); fillPredefinedIntervalsLookup(); numberField.setDatatype(Datatypes.get(Integer.class)); numberField.setValue(intervalValue.getNumber()); timeUnitLookup.setValue(intervalValue.getTimeUnit()); includingCurrentCheckBox.setValue(intervalValue.isIncludingCurrent()); initComponentsVisibility(type); }); numberField.addValueChangeListener(e -> intervalValue.setNumber(e.getValue())); timeUnitLookup.addValueChangeListener(e -> intervalValue.setTimeUnit(e.getValue())); includingCurrentCheckBox.addValueChangeListener(e -> intervalValue.setIncludingCurrent(e.getValue()));
protected Pair<TextField, HBoxLayout> createEditComponents(String loggerName, Level level) { final TextField loggerNameField = componentsFactory.createComponent(TextField.class); loggerNameField.setValue(loggerName); loggerNameField.setEditable(false); loggerNameField.setFrame(this); loggerNameField.setWidth("100%");
textField.setValue(value.getLocalizedValue()); textField.setStyleName("c-dateintervaleditor-text"); textField.setEditable(false); layout.add(textField);
protected void addRow(Object value, ComponentContainer parent, boolean isReadOnly) { BoxLayout row = componentsFactory.createComponent(HBoxLayout.class); row.setSpacing(true); row.setWidthFull(); TextField valueField = componentsFactory.createComponent(TextField.class); valueField.setValue(value); valueField.setEditable(!isReadOnly); row.add(valueField); row.expand(valueField); Button btnRemove = componentsFactory.createComponent(Button.class); btnRemove.setIconFromSet(CubaIcon.TIMES); btnRemove.setDescription(messages.getMessage(getClass(), "editAttribute.array.btnRemove")); Action removeRowAction = new BaseAction("removeRow") .withCaption("") .withHandler(actionPerformedEvent -> parent.remove(row) ); removeRowAction.setEnabled(!isReadOnly); btnRemove.setAction(removeRowAction); row.add(btnRemove); parent.add(row); }
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); }); }
searchField.addValueChangeListener(e -> { paramsDs.refresh(ParamsMap.of("name", e.getValue())); ); refreshAction.setAfterRefreshHandler(() -> { if (StringUtils.isNotEmpty(searchField.getValue())) { paramsTable.expandAll();
nameTypeOptionsGroup.setVisible(false); entityNameLookupField.setVisible(false); nameField.setEditable(false); timeoutSecField.focus(); } else { nameTypeOptionsGroup.setOptionsEnum(LockDescriptorNameType.class); nameTypeOptionsGroup.addValueChangeListener(e -> { if (LockDescriptorNameType.ENTITY.equals(e.getValue())) { nameField.setVisible(false); entityNameLookupField.setVisible(true); entityNameLookupField.focus(); } else { nameField.setVisible(true); nameField.focus(); entityNameLookupField.setVisible(false);
@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); } }
@Override public void init(Map<String, Object> params) { super.init(params); styleName.setValue(params.get(STYLENAME)); width.setValue(params.get(WIDTH)); widthUnits.setOptionsMap(getSizeUnitsValues()); widthUnits.setValue(params.get(WIDTH_UNITS)); height.setValue(params.get(HEIGHT)); heightUnits.setOptionsMap(getSizeUnitsValues()); heightUnits.setValue(params.get(HEIGHT_UNITS)); width.addTextChangeListener(e -> { String text = e.getText(); checkFieldInput(text, width, widthUnits); setSizeAutoVisible(autoWidth, height, heightUnits); }); height.addTextChangeListener(e -> { String text = e.getText(); checkFieldInput(text, height, heightUnits); setSizeAutoVisible(autoHeight, height, heightUnits); }); setSizeAutoVisible(autoWidth, width, widthUnits); setSizeAutoVisible(autoHeight, height, heightUnits); addSizeAutoFieldListener(autoWidth, width, widthUnits); addSizeAutoFieldListener(autoHeight, height, heightUnits); }