Search in sources :

Example 1 with TextAreaFieldDefinition

use of org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textArea.definition.TextAreaFieldDefinition in project kie-wb-common by kiegroup.

the class TextAreaFieldRendererTest method getFieldDefinition.

@Override
protected TextAreaFieldDefinition getFieldDefinition() {
    TextAreaFieldDefinition textAreaFieldDefinition = new TextAreaFieldDefinition();
    textAreaFieldDefinition.setName(NAME);
    textAreaFieldDefinition.setBinding(NAME);
    textAreaFieldDefinition.setPlaceHolder(NAME);
    return textAreaFieldDefinition;
}
Also used : TextAreaFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textArea.definition.TextAreaFieldDefinition)

Example 2 with TextAreaFieldDefinition

use of org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textArea.definition.TextAreaFieldDefinition in project kie-wb-common by kiegroup.

the class FieldRendererManagerImplTest method testFunctionallity.

@Test
public void testFunctionallity() {
    testRendererFor(new CheckBoxFieldDefinition(), CheckBoxFieldRenderer.class, 1);
    testRendererFor(new DatePickerFieldDefinition(), DatePickerFieldRenderer.class, 1);
    testRendererFor(new EnumListBoxFieldDefinition(), EnumListBoxFieldRenderer.class, 1);
    testRendererFor(new StringListBoxFieldDefinition(), StringListBoxFieldRenderer.class, 1);
    testRendererFor(new IntegerListBoxFieldDefinition(), IntegerListBoxFieldRenderer.class, 1);
    testRendererFor(new StringRadioGroupFieldDefinition(), StringRadioGroupFieldRenderer.class, 1);
    testRendererFor(new IntegerRadioGroupFieldDefinition(), IntegerRadioGroupFieldRenderer.class, 1);
    testRendererFor(new TextAreaFieldDefinition(), TextAreaFieldRenderer.class, 1);
    testRendererFor(new IntegerSliderDefinition(), SliderFieldRenderer.class, 1);
    testRendererFor(new DoubleSliderDefinition(), SliderFieldRenderer.class, 2);
    testRendererFor(new MultipleSubFormFieldDefinition(), MultipleSubFormFieldRenderer.class, 1);
    testRendererFor(new SubFormFieldDefinition(), SubFormFieldRenderer.class, 1);
    testRendererFor(new TextBoxFieldDefinition(), TextBoxFieldRenderer.class, 1);
    testRendererFor(new CharacterBoxFieldDefinition(), TextBoxFieldRenderer.class, 2);
    testRendererFor(new DecimalBoxFieldDefinition(), DecimalBoxFieldRenderer.class, 1);
    testRendererFor(new IntegerBoxFieldDefinition(), IntegerBoxFieldRenderer.class, 1);
    testUnexistingRenderer(new PictureFieldDefinition());
}
Also used : IntegerListBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.selectors.listBox.definition.IntegerListBoxFieldDefinition) DoubleSliderDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.slider.definition.DoubleSliderDefinition) DatePickerFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.datePicker.definition.DatePickerFieldDefinition) CheckBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.checkBox.definition.CheckBoxFieldDefinition) StringListBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.selectors.listBox.definition.StringListBoxFieldDefinition) TextAreaFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textArea.definition.TextAreaFieldDefinition) EnumListBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.selectors.listBox.definition.EnumListBoxFieldDefinition) MultipleSubFormFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.relations.multipleSubform.definition.MultipleSubFormFieldDefinition) IntegerRadioGroupFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.selectors.radioGroup.definition.IntegerRadioGroupFieldDefinition) DecimalBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.decimalBox.definition.DecimalBoxFieldDefinition) StringRadioGroupFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.selectors.radioGroup.definition.StringRadioGroupFieldDefinition) CharacterBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textBox.definition.CharacterBoxFieldDefinition) SubFormFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.relations.subForm.definition.SubFormFieldDefinition) MultipleSubFormFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.relations.multipleSubform.definition.MultipleSubFormFieldDefinition) TextBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textBox.definition.TextBoxFieldDefinition) PictureFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.image.definition.PictureFieldDefinition) IntegerSliderDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.slider.definition.IntegerSliderDefinition) IntegerBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.integerBox.definition.IntegerBoxFieldDefinition) Test(org.junit.Test)

Example 3 with TextAreaFieldDefinition

use of org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textArea.definition.TextAreaFieldDefinition in project kie-wb-common by kiegroup.

the class FormEditorPresenterTest method testFieldProperties.

protected void testFieldProperties(String fieldId, boolean bound) {
    FormDefinition form = editorHelper.getFormDefinition();
    addField(editorHelper.getAvailableFields().values().stream().filter(fieldDefinition -> fieldDefinition.getBinding().equals(fieldId)).findFirst().get());
    checkExpectedFields(editorHelper.getAvailableFields().size(), 1, bound);
    FieldDefinition field = editorHelper.getFormDefinition().getFields().get(0);
    checkFieldType(field, TextBoxFieldDefinition.class);
    Collection<String> compatibleTypes = editorHelper.getCompatibleFieldTypes(field);
    assertNotNull("No compatibles types found!", compatibleTypes);
    assertTrue("There should exist more than one compatible types for TextBoxFieldDefinition!", compatibleTypes.size() > 1);
    assertTrue("Missing TextAreaFieldDefinition as a compatible type for TextBoxFieldDefinition", compatibleTypes.contains(TextAreaFieldDefinition.FIELD_TYPE.getTypeName()));
    field = editorHelper.switchToFieldType(field, TextAreaFieldDefinition.FIELD_TYPE.getTypeName());
    checkFieldType(field, TextAreaFieldDefinition.class);
    List<String> compatibleFields = editorHelper.getCompatibleModelFields(field);
    assertNotNull("No compatibles fields found!", compatibleFields);
    assertEquals("There should exist 1 compatible fields for " + field.getName() + "!", 1, compatibleFields.size());
    String expectedBindingExpression = "lastName";
    field = editorHelper.switchToField(field, expectedBindingExpression);
    assertEquals("Wrong binding expression after switch field!", field.getBinding(), expectedBindingExpression);
}
Also used : GwtMockitoTestRunner(com.google.gwtmockito.GwtMockitoTestRunner) FormEditorSyncPaletteEvent(org.kie.workbench.common.forms.editor.client.editor.events.FormEditorSyncPaletteEvent) FormEditorConstants(org.kie.workbench.common.forms.editor.client.resources.i18n.FormEditorConstants) FileNameAndCommitMessage(org.uberfire.ext.editor.commons.client.file.FileNameAndCommitMessage) ArgumentMatchers.eq(org.mockito.ArgumentMatchers.eq) RunWith(org.junit.runner.RunWith) FormModelerContent(org.kie.workbench.common.forms.editor.model.FormModelerContent) FieldDefinition(org.kie.workbench.common.forms.model.FieldDefinition) LayoutComponent(org.uberfire.ext.layout.editor.api.editor.LayoutComponent) Mockito.spy(org.mockito.Mockito.spy) ArrayList(java.util.ArrayList) UpdatedLockStatusEvent(org.uberfire.client.mvp.UpdatedLockStatusEvent) MenuItem(org.uberfire.workbench.model.menu.MenuItem) WorkspaceProject(org.guvnor.common.services.project.model.WorkspaceProject) FormDefinition(org.kie.workbench.common.forms.model.FormDefinition) ComponentRemovedEvent(org.uberfire.ext.layout.editor.client.api.ComponentRemovedEvent) Mockito.doReturn(org.mockito.Mockito.doReturn) Path(org.uberfire.backend.vfs.Path) Command(org.uberfire.mvp.Command) TextBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textBox.definition.TextBoxFieldDefinition) Assert.assertNotNull(org.junit.Assert.assertNotNull) Collection(java.util.Collection) FieldLayoutComponent(org.kie.workbench.common.forms.dynamic.client.rendering.FieldLayoutComponent) RenamePopUpPresenter(org.uberfire.ext.editor.commons.client.file.popups.RenamePopUpPresenter) Mockito.atLeastOnce(org.mockito.Mockito.atLeastOnce) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) Mockito.times(org.mockito.Mockito.times) Mockito.doNothing(org.mockito.Mockito.doNothing) Mockito.when(org.mockito.Mockito.when) CommandWithFileNameAndCommitMessage(org.uberfire.ext.editor.commons.client.file.CommandWithFileNameAndCommitMessage) Mockito.verify(org.mockito.Mockito.verify) VerificationMode(org.mockito.verification.VerificationMode) Mockito(org.mockito.Mockito) List(java.util.List) Mockito.never(org.mockito.Mockito.never) LayoutTemplate(org.uberfire.ext.layout.editor.api.editor.LayoutTemplate) Assert.assertFalse(org.junit.Assert.assertFalse) Optional(java.util.Optional) Assert(org.junit.Assert) AssetUpdateValidator(org.kie.workbench.common.widgets.metadata.client.validation.AssetUpdateValidator) DefaultFileNameValidator(org.uberfire.ext.editor.commons.client.validation.DefaultFileNameValidator) Mockito.any(org.mockito.Mockito.any) Mockito.reset(org.mockito.Mockito.reset) Assert.assertEquals(org.junit.Assert.assertEquals) TextAreaFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textArea.definition.TextAreaFieldDefinition) Mockito.mock(org.mockito.Mockito.mock) FieldDefinition(org.kie.workbench.common.forms.model.FieldDefinition) TextBoxFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textBox.definition.TextBoxFieldDefinition) TextAreaFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textArea.definition.TextAreaFieldDefinition) FormDefinition(org.kie.workbench.common.forms.model.FormDefinition)

Aggregations

TextAreaFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textArea.definition.TextAreaFieldDefinition)3 Test (org.junit.Test)2 TextBoxFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textBox.definition.TextBoxFieldDefinition)2 GwtMockitoTestRunner (com.google.gwtmockito.GwtMockitoTestRunner)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 List (java.util.List)1 Optional (java.util.Optional)1 WorkspaceProject (org.guvnor.common.services.project.model.WorkspaceProject)1 Assert (org.junit.Assert)1 Assert.assertEquals (org.junit.Assert.assertEquals)1 Assert.assertFalse (org.junit.Assert.assertFalse)1 Assert.assertNotNull (org.junit.Assert.assertNotNull)1 Assert.assertTrue (org.junit.Assert.assertTrue)1 RunWith (org.junit.runner.RunWith)1 FieldLayoutComponent (org.kie.workbench.common.forms.dynamic.client.rendering.FieldLayoutComponent)1 FormEditorSyncPaletteEvent (org.kie.workbench.common.forms.editor.client.editor.events.FormEditorSyncPaletteEvent)1 FormEditorConstants (org.kie.workbench.common.forms.editor.client.resources.i18n.FormEditorConstants)1 FormModelerContent (org.kie.workbench.common.forms.editor.model.FormModelerContent)1 CheckBoxFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.checkBox.definition.CheckBoxFieldDefinition)1