Package com.googlecode.gwt.test.exceptions

Examples of com.googlecode.gwt.test.exceptions.GwtTestUiBinderException


                     // remove the attribute from the map to populate the widget with since it's
                     // used in the constructor
                     attributes.remove(argName);
                  } catch (Exception e) {
                     throw new GwtTestUiBinderException("Error while converting argument "
                              + argNames[i] + " to " + paramTypes[i], e);
                  }
               }
            }
View Full Code Here


         case 0:
            return null;
         case 1:
            return (U) GwtReflectionUtils.callPrivateMethod(owner, compatibleFactories.get(0));
         default:
            throw new GwtTestUiBinderException("Duplicate factory in class '"
                     + owner.getClass().getName() + " for type '" + clazz.getName() + "'");
      }
   }
View Full Code Here

            Object owner) throws GwtTestUiBinderException {

      String alias = getResourceAlias(localName, attributes);

      if (resources.containsKey(alias)) {
         throw new GwtTestUiBinderException("Two inner resources '" + alias + " are declared in "
                  + owner.getClass().getSimpleName()
                  + ".ui.xml. You should add a 'field' attribute to one of them");
      }

      Class<?> type = getResourceType(alias, localName, attributes);

      if ("with".equals(localName)) {
         // special resource <ui:with> : the resource can be annotated with
         // @UiConstructor, @UiFactory or @UiField(provided=true)
         Object resource = UiBinderInstanciator.getInstance(type, attributes, owner);
         resources.put(alias, resource);
         return new UiWithTag(resource);

      }

      ResourcePrototypeProxyBuilder builder = ResourcePrototypeProxyBuilder.createBuilder(type,
               owner.getClass());
      // common properties
      builder.name(alias);

      if ("style".equals(localName)) {
         // <ui:style>
         return new UiStyleTag(builder, alias, parentTag, owner, resources);

      } else if ("image".equals(localName)) {
         // <ui:image>
         return new UiImgTag(builder, alias, parentTag, owner, resources, attributes);

      } else if ("data".equals(localName)) {
         // <ui:data>
         return new UiDataTag(builder, alias, parentTag, owner, resources, attributes);
      } else {
         throw new GwtTestUiBinderException("resource <" + localName
                  + "> element is not yet implemented by gwt-test-utils");
      }
   }
View Full Code Here

      alias = (String) attributes.get("ui:field");
      if (alias == null && !"with".equals(localName)) {
         alias = localName;
      }
      if (alias == null) {
         throw new GwtTestUiBinderException("Cannot find the required 'field' value for tag <"
                  + localName + "> in " + owner.getClass().getSimpleName() + ".ui.xml");
      }

      return alias;
   }
View Full Code Here

         return DataResource.class;
      } else if (type == null && "text".equals(localName)) {
         // sepcial code for <ui:text> with no 'type' attribute
         return TextResource.class;
      } else if (type == null) {
         throw new GwtTestUiBinderException("<" + localName + "> element declared in "
                  + owner.getClass().getSimpleName() + ".ui.xml must specify a 'type' attribute");
      }

      try {
         return GwtReflectionUtils.getClass(type);
      } catch (ClassNotFoundException e2) {
         throw new GwtTestUiBinderException("Cannot find class '" + type + "' for resource '"
                  + alias + "' declared in file '" + owner.getClass().getSimpleName() + ".ui.xml'");
      }
   }
View Full Code Here

      private URL computeImageURL(Object owner, String src) {
         URL dataURL = owner.getClass().getResource(src);

         if (dataURL == null) {
            throw new GwtTestUiBinderException("Cannot find binary file with src=\"" + src
                     + "\" declared in " + owner.getClass().getSimpleName() + ".ui.xml");
         }

         return dataURL;
      }
View Full Code Here

      private URL computeImageURLs(Object owner, String src) {
         URL imageURL = owner.getClass().getResource(src);

         if (imageURL == null) {
            throw new GwtTestUiBinderException("Cannot find image file with src=\"" + src
                     + "\" declared in " + owner.getClass().getSimpleName() + ".ui.xml");
         }

         return imageURL;
      }
View Full Code Here

                  resources.put(field.getName(), value);
               }
            }

         } catch (Exception e) {
            throw new GwtTestUiBinderException("Error while trying to import multiple ui fields '"
                     + importValue + "'", e);
         }
      }
View Full Code Here

            // register static field value in UiResourcesManager inner map
            resources.put(fieldName, objectToImport);

         } catch (Exception e) {
            throw new GwtTestUiBinderException("Error while trying to import ui field '"
                     + importValue + "'", e);
         }
      }
View Full Code Here

         Field result = null;

         for (Field f : resourceFields) {
            if (alias.equals(f.getName()) && f.isAnnotationPresent(UiField.class)) {
               if (result != null) {
                  throw new GwtTestUiBinderException("There are more than one '" + f.getName()
                           + "' @UiField in class '" + owner.getClass().getName()
                           + "' or its superclass");
               }

               result = f;
View Full Code Here

TOP

Related Classes of com.googlecode.gwt.test.exceptions.GwtTestUiBinderException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.