当前位置: 首页>>代码示例>>Java>>正文


Java EditorError类代码示例

本文整理汇总了Java中com.google.gwt.editor.client.EditorError的典型用法代码示例。如果您正苦于以下问题:Java EditorError类的具体用法?Java EditorError怎么用?Java EditorError使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EditorError类属于com.google.gwt.editor.client包,在下文中一共展示了EditorError类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initTemplateName

import com.google.gwt.editor.client.EditorError; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void initTemplateName() {
	Validator<String> validator = new Validator<String>() {
		@Override
		public int getPriority() {
			return 0;
		}

		@Override
		public List<EditorError> validate(Editor<String> editor,
				String value) {
			List<EditorError> errors = new ArrayList<EditorError>();
			if (value == null || "".equals(value)) {
				errors.add(new BasicEditorError(editor, value, Application.MESSAGES.wte4j_message_template_name_not_empty()));
			}
			return errors;
		}
	};
	templateName.setValidators(validator);
	templateName.setValidateOnBlur(true);
}
 
开发者ID:wte4j,项目名称:wte4j,代码行数:22,代码来源:NewTemplatePanel.java

示例2: validate

import com.google.gwt.editor.client.EditorError; //导入依赖的package包/类
@Override
public List<EditorError> validate(Editor<String> editor, String value) {
	if(value==null){
		return null;
	}
	String[] lines=value.split("\n");
	for(String line:lines){
		line=line.trim();
		if(line.equals("")){
			break;
		}
		if(!line.contains("=")){
			EditorError ee=new DefaultEditorError(editor, "格式不正确", null);
			return Arrays.asList(ee);
		}
	}
	return null;
}
 
开发者ID:ctripcorp,项目名称:dataworks-zeus,代码行数:19,代码来源:FormatUtil.java

示例3: showErrors

import com.google.gwt.editor.client.EditorError; //导入依赖的package包/类
@Override
public void showErrors(List<EditorError> errors) {
    init();
    String errorMsg = "";
    for (int index = 0; index < errors.size(); index++) {
        errorMsg = errors.get(0).getMessage();
        if (index + 1 < errors.size()) {
            errorMsg += "; ";
        }
    }

    if (inputWidget instanceof HasError) {
        ((HasError) inputWidget).setError(errorMsg);
    }

    if (helpBlock != null) {
        helpBlock.addStyleName("field-error-label");
        helpBlock.removeStyleName("field-success-label");
        helpBlock.setText(errorMsg);
    }
}
 
开发者ID:GwtMaterialDesign,项目名称:gwt-material,代码行数:22,代码来源:DefaultErrorHandler.java

示例4: showErrors

import com.google.gwt.editor.client.EditorError; //导入依赖的package包/类
@Override
public void showErrors(List<EditorError> errors) {
  StringBuilder buf = new StringBuilder();
  for (EditorError error : errors) {
    if (error.getEditor().equals(editProxy)) {
      buf.append("\n");
      if (error.getUserData() instanceof ParseException) {
        buf.append(((ParseException) error.getUserData()).getMessage());
      } else {
        buf.append(error.getMessage());
      }
    }
  }

  if (0 < buf.length()) {
    errorLabel.setInnerText(buf.substring(1));
    errorLabel.getStyle().setDisplay(Display.BLOCK);
  } else {
    errorLabel.setInnerText("");
    errorLabel.getStyle().setDisplay(Display.NONE);
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:23,代码来源:ValueEditor.java

示例5: testAttributeNameValidatorSuccess

import com.google.gwt.editor.client.EditorError; //导入依赖的package包/类
@Test
public void testAttributeNameValidatorSuccess() {
    Editor<String> editorMock = mock(Editor.class);
    List<EditorError> result = presenter.attributeNameValidator.validate(editorMock,
                                                                         "s1");
    assertTrue(result.isEmpty());
    verify(view,
           times(0)).init(any(NewUserAttributeEditor.class));
    verify(view,
           times(0)).configure(any(Validator.class),
                               any(Validator.class));
    verify(view,
           times(0)).reset();
    verify(view,
           times(0)).setShowAddButton(any(Boolean.class));
    verify(view,
           times(0)).setShowForm(any(Boolean.class));
    verify(view,
           times(0)).createAttributeNameError(anyString(),
                                              anyString());
    verify(view,
           times(0)).createAttributeValueError(anyString(),
                                               anyString());
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:25,代码来源:NewUserAttributeEditorTest.java

示例6: testAttributeNameValidatorFail

import com.google.gwt.editor.client.EditorError; //导入依赖的package包/类
@Test
public void testAttributeNameValidatorFail() {
    Editor<String> editorMock = mock(Editor.class);
    List<EditorError> result = presenter.attributeNameValidator.validate(editorMock,
                                                                         "");
    assertFalse(result.isEmpty());
    verify(view,
           times(0)).init(any(NewUserAttributeEditor.class));
    verify(view,
           times(0)).configure(any(Validator.class),
                               any(Validator.class));
    verify(view,
           times(0)).reset();
    verify(view,
           times(0)).setShowAddButton(any(Boolean.class));
    verify(view,
           times(0)).setShowForm(any(Boolean.class));
    verify(view,
           times(1)).createAttributeNameError(anyString(),
                                              anyString());
    verify(view,
           times(0)).createAttributeValueError(anyString(),
                                               anyString());
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:25,代码来源:NewUserAttributeEditorTest.java

示例7: testAttributeValueValidatorSuccess

import com.google.gwt.editor.client.EditorError; //导入依赖的package包/类
@Test
public void testAttributeValueValidatorSuccess() {
    Editor<String> editorMock = mock(Editor.class);
    List<EditorError> result = presenter.attributeValueValidator.validate(editorMock,
                                                                          "v1");
    assertTrue(result.isEmpty());
    verify(view,
           times(0)).init(any(NewUserAttributeEditor.class));
    verify(view,
           times(0)).configure(any(Validator.class),
                               any(Validator.class));
    verify(view,
           times(0)).reset();
    verify(view,
           times(0)).setShowAddButton(any(Boolean.class));
    verify(view,
           times(0)).setShowForm(any(Boolean.class));
    verify(view,
           times(0)).createAttributeNameError(anyString(),
                                              anyString());
    verify(view,
           times(0)).createAttributeValueError(anyString(),
                                               anyString());
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:25,代码来源:NewUserAttributeEditorTest.java

示例8: testAttributeValueValidatorFail

import com.google.gwt.editor.client.EditorError; //导入依赖的package包/类
@Test
public void testAttributeValueValidatorFail() {
    Editor<String> editorMock = mock(Editor.class);
    List<EditorError> result = presenter.attributeValueValidator.validate(editorMock,
                                                                          "");
    assertFalse(result.isEmpty());
    verify(view,
           times(0)).init(any(NewUserAttributeEditor.class));
    verify(view,
           times(0)).configure(any(Validator.class),
                               any(Validator.class));
    verify(view,
           times(0)).reset();
    verify(view,
           times(0)).setShowAddButton(any(Boolean.class));
    verify(view,
           times(0)).setShowForm(any(Boolean.class));
    verify(view,
           times(0)).createAttributeNameError(anyString(),
                                              anyString());
    verify(view,
           times(1)).createAttributeValueError(anyString(),
                                               anyString());
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:25,代码来源:NewUserAttributeEditorTest.java

示例9: showErrors

import com.google.gwt.editor.client.EditorError; //导入依赖的package包/类
@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());
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:20,代码来源:ToggleSwitchEditor.java

示例10: showErrors

import com.google.gwt.editor.client.EditorError; //导入依赖的package包/类
/*************************************************************
 ** GWT EDITOR CONTRACT METHODS **
 *************************************************************/

@Override
public void showErrors(final 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());
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:24,代码来源:MapEditor.java

示例11: showErrors

import com.google.gwt.editor.client.EditorError; //导入依赖的package包/类
/*************************************************************
 ** GWT EDITOR CONTRACT METHODS **
 *************************************************************/

@Override
public void showErrors(final List<EditorError> errors) {
    StringBuilder sb = new StringBuilder();
    for (EditorError error : errors) {
        if (error.getEditor().equals(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());
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:23,代码来源:DropDownEditor.java

示例12: showErrors

import com.google.gwt.editor.client.EditorError; //导入依赖的package包/类
@Override
public void showErrors(List<EditorError> errors) {
    StringBuilder sb = new StringBuilder();
    for (final 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());
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:20,代码来源:ValueBoxEditor.java

示例13: testShowErrors

import com.google.gwt.editor.client.EditorError; //导入依赖的package包/类
@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)).clearError();
    verify(view, times(0)).init(presenter);
    verify(view, times(0)).setAddText(anyString());
    verify(view, times(0)).setEmptyText(anyString());
    verify(view, times(0)).addButtonColumn(anyInt(), anyString(), anyInt());
    verify(view, times(0)).addTextColumn(anyInt(), anyString(), anyBoolean(), anyInt());
    verify(view, times(0)).setData(anyList());
    verify(view, times(0)).setRowCount(anyInt());
    verify(view, times(0)).removeColumn(anyInt());
    final SafeHtml value = errorSafeHtmlCaptor.getValue();
    Assert.assertEquals("m1\nm2", value.asString());
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:23,代码来源:MapEditorTest.java

示例14: testShowErrors

import com.google.gwt.editor.client.EditorError; //导入依赖的package包/类
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(0)).clear();
    verify(view, times(0)).init(any(ImageListEditor.class));
    verify(view, times(0)).clearError();
    verify(view, times(0)).add(any(SafeUri.class), anyString(), anyString(), any(SafeHtml.class),
            any(SafeHtml.class), anyBoolean(), any(Command.class));
    verify(view, times(1)).showError(errorSafeHtmlCaptor.capture());
    final SafeHtml value = errorSafeHtmlCaptor.getValue();
    Assert.assertEquals("m1\nm2", value.asString());
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:19,代码来源:ImageListEditorTest.java

示例15: testShowErrors

import com.google.gwt.editor.client.EditorError; //导入依赖的package包/类
@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());
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:17,代码来源:ToggleSwitchEditorTest.java


注:本文中的com.google.gwt.editor.client.EditorError类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。