コード例 #1
0
 private int validateParentElementError(Element bindingElement) {
   int isError = 0;
   if (!bindingError.equals("")) {
     Object parentObj = bindingElement.getParent();
     while (parentObj != null) {
       bindingElement = (Element) parentObj;
       if (errorElements.contains(bindingElement.getId())) {
         isError = 1;
         break;
       }
       parentObj = bindingElement.getParent();
     }
   }
   return isError;
 }
コード例 #2
0
 private String getCurrentWidgetPosition(Element element) {
   if (element.getParent() != null) {
     return " " + getCurrentWidgetPosition((Element) element.getParent());
   }
   return "";
 }
コード例 #3
0
 public void tracking(Object swtObject, Element element, Object dataContext) {
   String bindingMessage = "";
   if (swtObject instanceof Binding) {
     String error = "";
     Binding newInstance = (Binding) swtObject;
     String path = null;
     Attribute attr = element.getAttribute("Path");
     if (null == attr) attr = element.getAttribute("path");
     if (null != attr) path = attr.getContent();
     Object dataContext2 = null;
     try {
       dataContext2 = newInstance.getValue(null);
       if (path != null && path.length() > 0) {
         String[] paths = path.trim().split("\\.");
         if (paths.length > 1) {
           String path1 = "";
           for (int i = 0; i < paths.length - 1; i++) {
             path1 = paths[i];
             if (dataContext2 != null) {
               dataContext2 = getObserveData(dataContext2, path1);
             }
           }
         }
       }
     } catch (Exception ex) {
       addErrorWidgetId(element.getParent().getParent().getId());
       setBindingErrorMessage("-> Error");
       error = "-> Error";
     }
     if (dataContext2 != null) {
       bindingMessage =
           " (DataContext="
               + dataContext2.getClass().getSimpleName()
               + ", Path="
               + path
               + ")"
               + error
               + "\n";
       addBindingMessageToMap(
           (Element) element.getParent().getParent(),
           bindingMessage); // bindingMap.put((Element) element.getParent().getParent(),
                            // bindingMessage);
     }
   } else if (swtObject instanceof Widget) {
     addWidgetElement(element);
     if (dataContext != null) {
       bindingMessage = " (DataContext=" + dataContext.getClass().getSimpleName() + ")\n";
       addBindingMessageToMap(element, bindingMessage);
     }
   } else if (JFacesHelper.isViewer(swtObject)) {
     if (dataContext != null) {
       bindingMessage = " (DataContext=" + dataContext.getClass().getSimpleName() + ")\n";
       addBindingMessageToMap(element, bindingMessage); // bindingMap.put(element, bindingMessage);
     }
   } else if (element.attributeNames(IConstants.XWT_X_NAMESPACE).length > 0) {
     // ??
     if (element.getParent() != null && element.getParent().getParent() != null) {
       bindingMessage = " (DataContext=" + element.getName() + ")\n";
       addBindingMessageToMap(
           (Element) element.getParent().getParent(),
           bindingMessage); // bindingMap.put((Element) element.getParent().getParent(),
                            // bindingMessage);
     }
   }
 }