test_class.declarator: view
test_class.modifier: @Mock
test_class.original_string: @Mock ToggleSwitchEditor.View view;
test_class.type: ToggleSwitchEditor.View
test_class.var_name: view
test_class.declarator: valueChangeEvent
test_class.modifier: @Mock
test_class.original_string: @Mock EventSourceMock<ValueChangeEvent<Boolean>> valueChangeEvent;
test_class.type: EventSourceMock<ValueChangeEvent<Boolean>>
test_class.var_name: valueChangeEvent
test_class.declarator: presenter
test_class.modifier: private
test_class.original_string: private ToggleSwitchEditor presenter;
test_class.type: ToggleSwitchEditor
test_class.var_name: presenter
test_class.file: dashbuilder-client/dashbuilder-common-client/src/test/java/org/dashbuilder/common/client/editor/ToggleSwitchEditorTest.java
test_class.identifier: ToggleSwitchEditorTest
test_class.superclass: extends AbstractEditorTest
test_case.body: @Test
      public void testShowErrors() throws Exception {
          EditorError e1 = mockEditorError(presenter, "m1");
          EditorError e2 = mockEditorError(presenter, "m2");
          List<EditorError> errors = new ArrayList<EditorError>(2);
          errors.add(e1);
          errors.add(e2);
          presenter.showErrors(errors);
          final ArgumentCaptor<SafeHtml> errorSafeHtmlCaptor =  ArgumentCaptor.forClass(SafeHtml.class);
          verify(view, times(1)).showError(errorSafeHtmlCaptor.capture());
          verify(view, times(0)).init(presenter);
          verify(view, times(0)).clearError();
          verify(view, times(0)).setValue(anyBoolean());
          final SafeHtml value = errorSafeHtmlCaptor.getValue();
          Assert.assertEquals("m1\nm2", value.asString());
      }
test_case.class_method_signature: ToggleSwitchEditorTest.testShowErrors()
test_case.full_signature: @Test public void testShowErrors()
test_case.identifier: testShowErrors
test_case.invocations: mockEditorError mockEditorError add add showErrors forClass showError verify times capture init verify times clearError verify times setValue verify times anyBoolean getValue assertEquals asString
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testShowErrors()
focal_class.declarator: valueChangeEvent
focal_class.original_string: Event<org.dashbuilder.common.client.event.ValueChangeEvent<Boolean>> valueChangeEvent;
focal_class.type: Event<org.dashbuilder.common.client.event.ValueChangeEvent<Boolean>>
focal_class.var_name: valueChangeEvent
focal_class.declarator: view
focal_class.modifier: public
focal_class.original_string: public View view;
focal_class.type: View
focal_class.var_name: view
focal_class.declarator: value
focal_class.original_string: Boolean value;
focal_class.type: Boolean
focal_class.var_name: value
focal_class.file: dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/editor/ToggleSwitchEditor.java
focal_class.identifier: ToggleSwitchEditor
focal_class.interfaces: implements IsWidget, LeafAttributeEditor<Boolean>
focal_class.class_method_signature: ToggleSwitchEditor.ToggleSwitchEditor(final View view,
                                final Event<org.dashbuilder.common.client.event.ValueChangeEvent<Boolean>> valueChangeEvent)
focal_class.full_signature: @Inject public  ToggleSwitchEditor(final View view,
                                final Event<org.dashbuilder.common.client.event.ValueChangeEvent<Boolean>> valueChangeEvent)
focal_class.identifier: ToggleSwitchEditor
focal_class.modifiers: @Inject public
focal_class.parameters: (final View view,
                                final Event<org.dashbuilder.common.client.event.ValueChangeEvent<Boolean>> valueChangeEvent)
focal_class.signature:  ToggleSwitchEditor(final View view,
                                final Event<org.dashbuilder.common.client.event.ValueChangeEvent<Boolean>> valueChangeEvent)
focal_class.class_method_signature: ToggleSwitchEditor.init()
focal_class.full_signature: @PostConstruct public void init()
focal_class.identifier: init
focal_class.modifiers: @PostConstruct public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void init()
focal_class.class_method_signature: ToggleSwitchEditor.setEnabled(final boolean isEnabled)
focal_class.full_signature: public void setEnabled(final boolean isEnabled)
focal_class.identifier: setEnabled
focal_class.modifiers: public
focal_class.parameters: (final boolean isEnabled)
focal_class.return: void
focal_class.signature: void setEnabled(final boolean isEnabled)
focal_class.class_method_signature: ToggleSwitchEditor.showErrors(List<EditorError> errors)
focal_class.full_signature: @Override public void showErrors(List<EditorError> errors)
focal_class.identifier: showErrors
focal_class.modifiers: @Override public
focal_class.parameters: (List<EditorError> errors)
focal_class.return: void
focal_class.signature: void showErrors(List<EditorError> errors)
focal_class.class_method_signature: ToggleSwitchEditor.asWidget()
focal_class.full_signature: @Override public Widget asWidget()
focal_class.identifier: asWidget
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Widget
focal_class.signature: Widget asWidget()
focal_class.class_method_signature: ToggleSwitchEditor.setValue(Boolean value)
focal_class.full_signature: @Override public void setValue(Boolean value)
focal_class.identifier: setValue
focal_class.modifiers: @Override public
focal_class.parameters: (Boolean value)
focal_class.return: void
focal_class.signature: void setValue(Boolean value)
focal_class.class_method_signature: ToggleSwitchEditor.getValue()
focal_class.full_signature: @Override public Boolean getValue()
focal_class.identifier: getValue
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Boolean
focal_class.signature: Boolean getValue()
focal_class.class_method_signature: ToggleSwitchEditor.onValueChanged(final Boolean value)
focal_class.full_signature:  void onValueChanged(final Boolean value)
focal_class.identifier: onValueChanged
focal_class.parameters: (final Boolean value)
focal_class.return: void
focal_class.signature: void onValueChanged(final Boolean value)
focal_method.body: @Override
      public void showErrors(List<EditorError> errors) {
          StringBuilder sb = new StringBuilder();
          for (EditorError error : errors) {
  
              if (error.getEditor() == this) {
                  sb.append("\n").append(error.getMessage());
              }
          }
  
          boolean hasErrors = sb.length() > 0;
          if (!hasErrors) {
              view.clearError();
              return;
          }
  
          // Show the errors.
          view.showError(new SafeHtmlBuilder().appendEscaped(sb.substring(1)).toSafeHtml());
      }
focal_method.class_method_signature: ToggleSwitchEditor.showErrors(List<EditorError> errors)
focal_method.full_signature: @Override public void showErrors(List<EditorError> errors)
focal_method.identifier: showErrors
focal_method.invocations: getEditor append append getMessage length clearError showError toSafeHtml appendEscaped substring
focal_method.modifiers: @Override public
focal_method.parameters: (List<EditorError> errors)
focal_method.return: void
focal_method.signature: void showErrors(List<EditorError> errors)