コード例 #1
0
ファイル: SimpleViolation.java プロジェクト: hammoum/gwt
 /**
  * Records an error in any delegates that match the {@code absolutePath}, returning true if any
  * matched. ({@code originalAbsolutePath} is not used for finding delegates, but is instead used
  * to determine how to record the error.)
  */
 private static boolean processLeafDelegates(
     DelegateMap delegateMap,
     String originalAbsolutePath,
     String absolutePath,
     SimpleViolation error) {
   // Find the leaf editor's delegate.
   List<AbstractEditorDelegate<?, ?>> leafDelegates = delegateMap.getDelegatesByPath(absolutePath);
   if (leafDelegates == null) {
     return false;
   }
   String addlPath = originalAbsolutePath.substring(absolutePath.length());
   for (AbstractEditorDelegate<?, ?> delegate : leafDelegates) {
     // If this is the original path value, don't record the additional path.
     if (addlPath.isEmpty()) {
       delegate.recordError(error.getMessage(), null, error.getUserDataObject());
     } else {
       // Otherwise, include the additional path.
       delegate.recordError(
           error.getMessage(), null, error.getUserDataObject(), addlPath, delegate.getEditor());
     }
   }
   return true;
 }
コード例 #2
0
ファイル: SimpleViolation.java プロジェクト: hammoum/gwt
 /** Records an error in any editors that match the path, returning true if any editors matched. */
 private static boolean processEditors(
     DelegateMap delegateMap,
     AbstractEditorDelegate<?, ?> baseDelegate,
     String absolutePath,
     SimpleViolation error) {
   List<Editor<?>> editors = delegateMap.getEditorByPath(absolutePath);
   if (editors == null) {
     return false;
   }
   // No EditorDelegate to attach it to, so record on the baseDelegate
   // with the appropriate editor & path.
   for (Editor<?> editor : editors) {
     baseDelegate.recordError(
         error.getMessage(), null, error.getUserDataObject(), error.getPath(), editor);
   }
   return true;
 }