コード例 #1
0
 public ComponentDefRefHandler(
     RootTagHandler<P> parentHandler, XMLStreamReader xmlReader, Source<?> source) {
   super(parentHandler, xmlReader, source);
   builder.setDescriptor(DefDescriptorImpl.getInstance(getTagName(), ComponentDef.class));
   builder.setLocation(getLocation());
   body = new ArrayList<>();
 }
コード例 #2
0
  @SuppressWarnings("rawtypes")
  @Override
  protected void readSystemAttributes() throws QuickFixException {
    super.readSystemAttributes();
    builder.setLocalId(getSystemAttributeValue("id"));
    String load = getSystemAttributeValue("load");
    if (!AuraTextUtil.isNullEmptyOrWhitespace(load)) {
      Load loadVal;
      try {
        loadVal = Load.valueOf(load.toUpperCase());
      } catch (IllegalArgumentException e) {
        throw new AuraRuntimeException(
            String.format("Invalid value '%s' specified for 'aura:load' attribute", load),
            getLocation());
      }
      builder.setLoad(loadVal);
      if (loadVal == Load.LAZY || loadVal == Load.EXCLUSIVE) {
        ((BaseComponentDefHandler) getParentHandler()).setRender("client");
      }
    }

    String flavor = getSystemAttributeValue("flavor");
    if (!AuraTextUtil.isNullEmptyOrWhitespace(flavor)) {
      builder.setFlavor(flavor);
    }
  }
コード例 #3
0
 /**
  * this one is only used by {@link HTMLComponentDefRefHandler}, which passes in the descriptor,
  * the one above can't use it cause of java stupidness
  */
 protected ComponentDefRefHandler(
     RootTagHandler<P> parentHandler,
     DefDescriptor<ComponentDef> descriptor,
     XMLStreamReader xmlReader,
     Source<?> source) {
   super(parentHandler, xmlReader, source);
   builder.setDescriptor(descriptor);
   builder.setLocation(getLocation());
   body = new ArrayList<>();
 }
コード例 #4
0
 @Override
 protected void readAttributes() throws QuickFixException {
   for (Map.Entry<DefDescriptor<AttributeDef>, AttributeDefRef> entry :
       getAttributes().entrySet()) {
     builder.setAttribute(entry.getKey(), entry.getValue());
   }
 }
コード例 #5
0
  /** Expects either Set tags or ComponentDefRefs */
  @Override
  protected void handleChildTag() throws XMLStreamException, QuickFixException {

    String tag = getTagName();
    if (AttributeDefRefHandler.TAG.equalsIgnoreCase(tag)) {
      AttributeDefRefImpl attributeDefRef =
          new AttributeDefRefHandler<>(getParentHandler(), xmlReader, source).getElement();
      builder.setAttribute(attributeDefRef.getDescriptor(), attributeDefRef);
    } else {
      ComponentDefRef cdr = getDefRefHandler(getParentHandler()).getElement();
      if (cdr.isFlavorable() || cdr.hasFlavorableChild()) {
        builder.setHasFlavorableChild(true);
      }
      body.add(cdr);
    }
  }
コード例 #6
0
  @Override
  protected ComponentDefRef createDefinition() {
    if (!body.isEmpty()) {
      setBody(body);
    }

    // hacky. if there is an interface, grab that descriptor too
    DefDescriptor<InterfaceDef> id =
        DefDescriptorImpl.getInstance(
            builder.getDescriptor().getQualifiedName(), InterfaceDef.class);
    if (id.exists()) {
      builder.setIntfDescriptor(id);
    }

    return builder.build();
  }
コード例 #7
0
 protected void setBody(List<ComponentDefRef> body) {
   builder.setAttribute(AttributeDefRefImpl.BODY_ATTRIBUTE_NAME, body);
 }