Package org.eclipse.e4.xwt

Examples of org.eclipse.e4.xwt.XWTException


      for (int i = 0; i < segments.length - 1; i++) {
        IProperty property = currentMetaclass.findProperty(segments[i]);
        if (property != null) {
          target = property.getValue(target);
          if (target == null) {
            LoggerManager.log(new XWTException("Property \""
                + segments[i] + "\" is null."));
          }
          currentMetaclass = loader.getMetaclass(target);
        } else {
          LoggerManager.log(new XWTException("Property \""
              + segments[i] + "\" not found in "
              + element.getName() + "."));
        }
      }
      initSegmentAttribute(currentMetaclass,
View Full Code Here


                  && type != null
                  && !(type == Table.class
                      && "TableColumn"
                          .equals(child.getName()) && Table.class
                      .isInstance(directTarget))) {
                throw new XWTException(child.getName()
                    + " cannot be a content of "
                    + type.getName() + " "
                    + target.getClass().getName() + "."
                    + property.getName());
              }
              if (value instanceof IDynamicBinding) {
                ((IDynamicBinding) value).setType(attrName);
              }
            }
          }
        }
      }
    }
    if (contentValue != null && value == null
        && !IConstants.XAML_COMMAND.equalsIgnoreCase(propertyName)) {
      if (property.getType().isInstance(Class.class)) {
        int index = contentValue.lastIndexOf(':');
        if (index != -1) {
          String prefix = contentValue.substring(0, index);
          contentValue = findNamespace(attribute, prefix)
              + contentValue.substring(index);
        }
      }
      value = loader.convertFrom(property.getType(), contentValue);
    }
    if (!usingExistingValue) {
      if (value != null) {
        Class<?> propertyType = property.getType();
        if (!propertyType.isAssignableFrom(value.getClass())
            || (value instanceof IBinding && !(IBinding.class
                .isAssignableFrom(propertyType)))) {
          Object orginalValue = value;
          IConverter converter = loader.findConvertor(value
              .getClass(), propertyType);
          if (converter != null) {
            value = converter.convert(value);
            if (value != null
                && orginalValue instanceof IBinding
                && !propertyType.isAssignableFrom(value
                    .getClass())) {
              converter = loader.findConvertor(value.getClass(),
                  propertyType);
              if (converter != null) {
                value = converter.convert(value);
              } else {
                LoggerManager.log(new XWTException("Convertor "
                    + value.getClass().getSimpleName()
                    + "->" + propertyType.getSimpleName()
                    + " is not found"));
              }
            }
          } else {
            LoggerManager.log(new XWTException("Convertor "
                + value.getClass().getSimpleName() + "->"
                + propertyType.getSimpleName()
                + " is not found"));
          }
        }
View Full Code Here

      Element element = null;
      if (stream == null) {
        element = manager.load(input, (IBeforeParsingCallback) options.get(IXWTLoader.BEFORE_PARSING_CALLBACK));
      }
      else {
        IBeforeParsingCallback callback = (IBeforeParsingCallback) options.get(IXWTLoader.BEFORE_PARSING_CALLBACK);
        InputStream inputStream = stream;
        if (callback != null) {
          int size = stream.read();
          byte[] buffer = new byte[size];
          stream.read(buffer);
          String content = new String(buffer);
          stream.close();
          content = callback.onParsing(content);
          inputStream = new ByteArrayInputStream(content.getBytes());
          element = manager.load(stream, input);         
        }
        element = manager.load(inputStream, input);
      }
View Full Code Here

    if (source == target
        || (source != Object.class && source.isAssignableFrom(target))) {
      return ObjectToObject.instance;
    }
    if (String.class == source && target.isEnum()) {
      return new StringToEnum(target);
    }
    ValueConvertorRegister convertorRegister = (ValueConvertorRegister)
        getService(ValueConvertorRegister.class);
    if (convertorRegister == null) {
      return null;
View Full Code Here

    if (dataContext == null) {
      Object dataContextHost = getDataContextHost();
      if (dataContextHost != null) {
        dataContext = UserData.getLocalDataContext(dataContextHost);
        if (dataContext instanceof IDynamicBinding) {
          IDynamicBinding dynamicBinding = (IDynamicBinding) dataContext;
          Object boundSource = dynamicBinding.createBoundSource();
          if (boundSource != null) {
            dataContext = boundSource;
          }
        }
      }
View Full Code Here

          inputStream = new ByteArrayInputStream(content.getBytes());
          element = manager.load(stream, input);         
        }
        element = manager.load(inputStream, input);
      }
      IRenderingContext context = new ExtensionContext(loadingContext,
          manager, manager.getRootElement().getNamespace());
      Object visual = createCLRElement(context, element, options);
      if (TRACE_BENCH) {
        System.out.println("Loaded: "
            + (System.currentTimeMillis() - start) + "  "
View Full Code Here

  public void registerService(Class<?> serviceType, Object service) {
    registrations.put(serviceType, service);
  }

  protected Object createCLRElement(IRenderingContext context, Element element, Map<String, Object> options) {
    IVisualElementLoader loader = findElementLoader(element);
    if (loader != null) {
      return loader.createCLRElement(element, options);
    }
    loader = createElementLoader(context, element);
    Object visualObject = loader.createCLRElement(element, options);
    removeElementLoader(element);
    return visualObject;
  }
View Full Code Here

    removeElementLoader(element);
    return visualObject;
  }

  protected IVisualElementLoader findElementLoader(DocumentObject element) {
    IVisualElementLoader loader = elementsLoaders.get(element);
    if (loader != null) {
      return loader;
    }
    if (element.getParent() != null) {
      return findElementLoader(element.getParent());
View Full Code Here

    }
    return null;
  }

  protected IVisualElementLoader createElementLoader(IRenderingContext context, DocumentObject element) {
    IVisualElementLoader creator = loaderFactory.createElementLoader(context, xwtLoader);
    elementsLoaders.put(element, creator);
    return creator;
  }
View Full Code Here

  public void setValue(Object target, Object value) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchFieldException {
    if (!(value instanceof Style)) {
      throw new XWTException("Style is expected.");
    }
    Style style = (Style) value;
    style.apply(target);
  }
View Full Code Here

TOP

Related Classes of org.eclipse.e4.xwt.XWTException

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.