@Test public void initWithDefinitionSet() throws Exception { resetMocks(); SequenceFlow sequenceFlow = new SequenceFlow(); SequenceFlowExecutionSet sequenceFlowExecutionSet = sequenceFlow.getExecutionSet(); ConditionExpression conditionExpression = sequenceFlowExecutionSet.getConditionExpression(); PowerMockito.mockStatic(ClientBindingUtils.class); BDDMockito.given(ClientBindingUtils.getProxiedValue(sequenceFlow, "executionSet")).willReturn(sequenceFlowExecutionSet); BDDMockito.given(ClientBindingUtils.getProxiedValue(sequenceFlowExecutionSet, "conditionExpression")).willReturn(conditionExpression); when(conditionalComboBoxFieldDefinition.getRelatedField()).thenReturn("executionSet.conditionExpression"); when(renderingContext.getModel()).thenReturn(null); when(renderingContext.getParentContext()).thenReturn(renderingContextParent); when(renderingContextParent.getModel()).thenReturn(sequenceFlow); when(adapterManager.forProperty()).thenReturn(Mockito.mock(PropertyAdapter.class)); when(adapterManager.forProperty().getValue(conditionExpression)).thenReturn("value"); conditionalComboBoxFieldRenderer.init(renderingContext, conditionalComboBoxFieldDefinition); verify(conditionalComboBoxFieldRenderer, never()).setReadOnly(true); verify(conditionalComboBoxFieldRenderer, times(1)).setReadOnly(false); when(adapterManager.forProperty().getValue(conditionExpression)).thenReturn(""); conditionalComboBoxFieldRenderer.init(renderingContext, conditionalComboBoxFieldDefinition); verify(conditionalComboBoxFieldRenderer, times(1)).setReadOnly(true); when(adapterManager.forProperty().getValue(conditionExpression)).thenReturn(null); conditionalComboBoxFieldRenderer.init(renderingContext, conditionalComboBoxFieldDefinition); verify(conditionalComboBoxFieldRenderer, atLeastOnce()).setReadOnly(true); }
@Override public void init(final FormRenderingContext renderingContext, ConditionalComboBoxFieldDefinition field) { super.init(renderingContext, field); initializeRelatedFieldCondition(renderingContext, field); }
ConditionalComboBoxFieldRenderer extends AbstractComboBoxFieldRenderer<ConditionalComboBoxFieldDefinition> { @Override public void init(final FormRenderingContext renderingContext, ConditionalComboBoxFieldDefinition field) { super.init(renderingContext, field); initializeRelatedFieldCondition(renderingContext, field); } }
ConditionalComboBoxFieldRenderer extends AbstractComboBoxFieldRenderer<ConditionalComboBoxFieldDefinition> { @Override public void init(final FormRenderingContext renderingContext, ConditionalComboBoxFieldDefinition field) { super.init(renderingContext, field); initializeRelatedFieldCondition(renderingContext, field); } @Inject  ConditionalComboBoxFieldRenderer(@FixedValues final ComboBoxFixedValuesWidgetView comboBoxEditor,
                                            final ClientTranslationService translationService,
                                            final AdapterManager adapterManager); }
ConditionalComboBoxFieldRenderer extends AbstractComboBoxFieldRenderer<ConditionalComboBoxFieldDefinition> { @Override public void init(final FormRenderingContext renderingContext, ConditionalComboBoxFieldDefinition field) { super.init(renderingContext, field); initializeRelatedFieldCondition(renderingContext, field); } @Inject  ConditionalComboBoxFieldRenderer(@FixedValues final ComboBoxFixedValuesWidgetView comboBoxEditor,
                                            final ClientTranslationService translationService,
                                            final AdapterManager adapterManager); @Override void init(final FormRenderingContext renderingContext,
                     ConditionalComboBoxFieldDefinition field); void refreshFieldCondition(Object conditionValue); @Override String getName(); }
ConditionalComboBoxFieldRenderer extends AbstractComboBoxFieldRenderer<ConditionalComboBoxFieldDefinition> { @Override public void init(final FormRenderingContext renderingContext, ConditionalComboBoxFieldDefinition field) { super.init(renderingContext, field); initializeRelatedFieldCondition(renderingContext, field); } @Inject  ConditionalComboBoxFieldRenderer(@FixedValues final ComboBoxFixedValuesWidgetView comboBoxEditor,
                                            final ClientTranslationService translationService,
                                            final AdapterManager adapterManager); @Override void init(final FormRenderingContext renderingContext,
                     ConditionalComboBoxFieldDefinition field); void refreshFieldCondition(Object conditionValue); @Override String getName(); static final String TYPE_NAME; }