class ToggleSwitchEditor implements IsWidget, LeafAttributeEditor<Boolean> {

    @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());
    }

    @Inject public  ToggleSwitchEditor(final View view,
                              final Event<org.dashbuilder.common.client.event.ValueChangeEvent<Boolean>> valueChangeEvent);

}