ParametrizedDataManagementWidgetFactory extends ParametrizedWidgetFactory { @Override public AbstractParametrizedWidget createParametrizedWidget(ContractInput input) { switch (inputTypeResolver.getContractInputType(input)) { case TEXT: return super.createInputWidget(input, InputType.TEXT); case NUMERIC: return super.createInputWidget(input, InputType.NUMBER); case LOCAL_DATE: return super.createDatePicker(input); case LOCAL_DATE_TIME: return super.createDateTimePicker(input, false); case OFFSET_DATE_TIME: return super.createDateTimePicker(input, true); case BOOLEAN: return super.createCheckBox(input); default: throw new IllegalStateException( String.format("Unable to create a widget for contract input %s.", input.getName())); } } ParametrizedDataManagementWidgetFactory(); @Override AbstractParametrizedWidget createParametrizedWidget(ContractInput input); Container createDetailsWidgetContainer(DimensionFactory dimensionFactory, NodeBusinessObjectInput businessObjectInput); @Override TitleWidget createTitle(String title); Container createSpacingContainer(DimensionFactory dimensionFactory, NodeBusinessObjectInput businessObjectInput);  }
@Test public void should_create_read_only_input_widget_when_leaf_is_readOnly() { LeafContractInput input = new LeafContractInput("LastName", String.class); input.setReadonly(true); AbstractParametrizedWidget widget = this.elementFactory.createParametrizedWidget(input); assertThat(widget).isInstanceOf(InputWidget.class); assertThat(((InputWidget) widget).isReadOnly()).isEqualTo(true); assertThat(((InputWidget) widget).getLabel()).isEqualTo("Last Name"); }