Package flex2.compiler.mxml

Examples of flex2.compiler.mxml.Attribute


        if (file != null && file.exists())
        {
            try
            {
                result = new LocalFile(file.getCanonicalFile());
            }
            catch (IOException e)
            {
                // TODO Auto-generated catch block
                e.printStackTrace();
View Full Code Here


    for (int i = 0, size = directories == null ? 0 : directories.size(); i < size; i++)
    {
      String dir = directories.get(i).getAbsolutePath();
      if (name.startsWith(dir))
      {
        return new LocalFile(FileUtil.openFile(dir));
      }
    }
    // return new LocalFile(FileUtil.openFile(f.getParent()));
    return null;
  }
View Full Code Here

            {
                File file = FileUtil.openFile(directory, relativePath);

                if ((file != null) && file.exists())
                {
                    return new LocalFile(file);
                }
            }
        }

        return null;
View Full Code Here

      {
        Class retType = info.getGetterMethod().getReturnType();

        if (VirtualFile.class.isAssignableFrom(retType))
        {
          VirtualFile file = (VirtualFile) info.getGetterMethod().invoke(targetConfig, (Object[])null);
          if (file != null)
          {
            if (info.doChecksum())
              compile_checksum.append(file.getName());
            link_checksum.append(file.getName());
          }
          continue;
        }
        else if (retType.isArray() && VirtualFile.class.isAssignableFrom(retType.getComponentType()))
        {
          VirtualFile[] files = (VirtualFile[]) info.getGetterMethod().invoke(targetConfig, (Object[])null);
          for (int j = 0; files != null && j < files.length; j++)
          {
            if (files[j] != null)
            {
              if (info.doChecksum())
                compile_checksum.append(files[j].getName());
              link_checksum.append(files[j].getName());
            }
          }
          continue;
        }
      }

      if (args[i] instanceof Object[])
      {
        Object[] a = (Object[]) args[i];
        for (int j = 0; j < a.length; j++)
        {
          if (info.doChecksum())
            compile_checksum.append(a[j]);
          link_checksum.append(a[j]);
        }
      }
      else if (args[i] instanceof List)
      {
        List l = (List) args[i];
        for (int j = 0; j < l.size(); j++)
        {
          if (info.doChecksum())
            compile_checksum.append(l.get(j));
          link_checksum.append(l.get(j));
        }
      }
      else
      {
        if (info.doChecksum())
          compile_checksum.append(args[i]);
        link_checksum.append(args[i]);
      }
    }

    if (info.getGetterMethod() == null)
    {
      // C: need to make sure that all the VirtualFile-based config values should have getters.
      return;
    }

    Class retType = info.getGetterMethod().getReturnType();

    if (VirtualFile.class.isAssignableFrom(retType))
    {
      VirtualFile file = (VirtualFile) info.getGetterMethod().invoke(targetConfig, (Object[])null);
      if (file != null && !file.isDirectory())
      {
        if (info.doChecksum())
          compile_checksum_ts.append(file.getLastModified());
        link_checksum_ts.append(file.getLastModified());
      }
    }
    else if (retType.isArray() && VirtualFile.class.isAssignableFrom(retType.getComponentType()))
    {
      VirtualFile[] files = (VirtualFile[]) info.getGetterMethod().invoke(targetConfig, (Object[])null);
View Full Code Here

    /**
     * Create virtual file for given file and throw configuration exception if not possible
     */
    public static VirtualFile getVirtualFile(String path, boolean reportError) throws ConfigurationException
    {
        VirtualFile result = null;
        File file = new File(path);

        if (file != null && file.exists())
        {
            try
View Full Code Here

    {
            // No need to check to see if the appPath is supported again.
      if ((appPath != null && files[i].getName().equals(appPath.getName())) || isSupported(files[i]))
      {
        String name = files[i].getName();
        VirtualFile pathRoot = calculatePathRoot(files[i]);
        if (pathRoot != null)
        {
                    String relativePath = calculateRelativePath(name);
                    String namespaceURI = relativePath.replace('/', '.');
                    String localPart = calculateLocalPart(name);
View Full Code Here

    if (targetFile == null)
    {
          throw new ConfigurationException.MustSpecifyTarget( null, null, -1);
    }

        VirtualFile virt = getVirtualFile(targetFile);
        if (virt == null && checkTargetFileInFileSystem())
        {
            throw new ConfigurationException.IOError(targetFile);
        }
  }
View Full Code Here

     * @param localPart The unqualified attribute name
     * @return attribute value as a String, or null if the attribute was not found
     */
    protected Attribute getSpecialAttribute(Node node, String localPart)
    {
        Attribute attr = null;

        if (document.getVersion() < 4)
        {
            attr = node.getAttribute(DEFAULT_NAMESPACE, localPart);
        }
View Full Code Here

      // unit's context and incorporated into the generated IFlexBootstrap
      // derivative.

        Map<String, Object> swfvarmap = new TreeMap<String, Object>();

    Attribute frameRate = getSpecialAttribute(node, specialAttrFrameRate);
    if (frameRate != null)
    {
        Object value = rootAttributeParser.parseUInt((String)frameRate.getValue(),
                frameRate.getLine(),
                specialAttrFrameRate);
      if (value != null)
      {
              swfvarmap.put(specialAttrFrameRate, value.toString());
      }
    }

    Attribute scriptRecursionLimit = getSpecialAttribute(node, specialAttrScriptRecursionLimit);
    if (scriptRecursionLimit != null)
    {
      Object value = rootAttributeParser.parseUInt((String)scriptRecursionLimit.getValue(),
              scriptRecursionLimit.getLine(),
              specialAttrScriptRecursionLimit);
      if (value != null)
      {
              swfvarmap.put(specialAttrScriptRecursionLimit, value.toString());
      }
    }

    Attribute scriptTimeLimit = getSpecialAttribute(node, specialAttrScriptTimeLimit);
    if (scriptTimeLimit != null)
    {
      Object value = rootAttributeParser.parseUInt((String)scriptTimeLimit.getValue(),
              scriptTimeLimit.getLine(),
              specialAttrScriptTimeLimit);
      if (value != null)
      {
              swfvarmap.put(specialAttrScriptTimeLimit, value.toString());
      }
    }

    Attribute bgcolor = node.getAttribute(DEFAULT_NAMESPACE, rootAttrBackgroundColor);
    if (bgcolor != null)
    {
            Object value = rootAttributeParser.parseColor((String)bgcolor.getValue(),
                    bgcolor.getLine(),
                    rootAttrBackgroundColor);
            if (value != null)
            {
                swfvarmap.put(rootAttrBackgroundColor, value.toString());
            }
    }
   
    // useDirectBlit="true|false"
    Attribute useDirectBlit = node.getAttribute(DEFAULT_NAMESPACE, specialAttrUseDirectBlit);
    if(useDirectBlit != null)
    {
      Object value = rootAttributeParser.parseBoolean(
          (String) useDirectBlit.getValue(),
          useDirectBlit.getLine(),
          specialAttrUseDirectBlit);
      if (value != null)
      {
        swfvarmap.put(specialAttrUseDirectBlit, value.toString());
      }
    }
   
    // useGPU="true|false"
    Attribute useGPU = node.getAttribute(DEFAULT_NAMESPACE, specialAttrUseGPU);
    if(useGPU != null)
    {
      Object value = rootAttributeParser.parseBoolean(
          (String) useGPU.getValue(),
          useGPU.getLine(),
          specialAttrUseGPU);
      if (value != null)
      {
        swfvarmap.put(specialAttrUseGPU, value.toString());
      }
    }
   
        Attribute styleName = node.getAttribute(DEFAULT_NAMESPACE, rootAttrStyleName);
        if (styleName != null)
        {
            document.getCompilationUnit().styleName = (String) styleName.getValue();
        }

    Attribute title = getSpecialAttribute(node, specialAttrPageTitle);
    if (title != null)
    {
      swfvarmap.put(specialAttrPageTitle, title.getValue());
    }

    // Only do the "percent" logic for Application nodes, not modules. There is no
    // html wrapper for a module and the logic keeps modules from sizing
    // to the ModuleLoader component, SDK-9527.
        Type nodeType = nodeTypeResolver.resolveType(node, document);
        boolean isApplication = StandardDefs.isApplication(nodeType);

    Attribute width = node.getAttribute(DEFAULT_NAMESPACE, rootAttrWidth);
        if (width != null && isApplication)
        {
            String widthString = width.getValue().toString();
      Object value = rootAttributeParser.parseNumberOrPercentage(widthString,
              width.getLine(),
              rootAttrWidth);

      if (value != null)
      {
        if (rootAttributeParser.wasPercentage())
        {
          if (widthString.endsWith("%"))
                    {
                        swfvarmap.put("widthPercent", widthString);
                    }
                    else
                    {
                        swfvarmap.put("widthPercent", widthString + '%');
                    }

          //  HACK for 174078: width="n%" at the root of an MXML app is a specification of the ratio of
          //  player to browser width, not app to player width. So we pass it through to the SWF, but strip
          //  it from the MXML DOM, preventing it from showing up in the property settings for the root UIC.
          node.removeAttribute(new QName(width.getNamespace(), rootAttrWidth));
        }
        else
        {
          if (value instanceof Double)
          {
            value = new Integer(((Double) value).intValue());
          }
          swfvarmap.put(rootAttrWidth, value);
        }
      }
        }

        Attribute height = node.getAttribute(DEFAULT_NAMESPACE, rootAttrHeight);
        if (height != null && isApplication)
        {
            String heightString = height.getValue().toString();
      Object value = rootAttributeParser.parseNumberOrPercentage(heightString,
              height.getLine(),
              rootAttrHeight);

      if (value != null)
      {
        if (rootAttributeParser.wasPercentage())
        {
          if (heightString.endsWith("%"))
                    {
                        swfvarmap.put("heightPercent", heightString);
                    }
                    else
                    {
                        swfvarmap.put("heightPercent", heightString + '%');
                    }

          //  HACK for 174078: as above for width
          node.removeAttribute(new QName(height.getNamespace(), rootAttrHeight));
        }
        else
        {
          if (value instanceof Double)
          {
            value = new Integer(((Double) value).intValue());
          }
          swfvarmap.put(rootAttrHeight, value);
        }
      }
        }

        Attribute usePreloader = getSpecialAttribute(node, specialAttrUsePreloader);
    if (usePreloader != null)
    {
      Object value = rootAttributeParser.parseBoolean((String)usePreloader.getValue(),
              usePreloader.getLine(),
              specialAttrUsePreloader);

      if (value != null)
      {
        document.setUsePreloader(((Boolean)value).booleanValue());
      }
    }

    Attribute preloader = getSpecialAttribute(node, specialAttrPreloader);
    if (preloader != null)
    {
        String preloaderString = (String)preloader.getValue();
      String preloaderClassName = TextParser.parseClassName(preloaderString);
      if (preloaderClassName != null)
      {
        document.setPreloader(preloaderString);
      }
      else
      {
        log(node, new InvalidPreLoaderClassName(preloaderString));
      }
    }
   
    Attribute runtimeDPIProvider = getSpecialAttribute(node, specialAttrRuntimeDPIProvider);
    if (runtimeDPIProvider != null)
    {
        String runtimeDPIProviderString = (String)runtimeDPIProvider.getValue();
      String runtimeDPIProviderClassName = TextParser.parseClassName(runtimeDPIProviderString);
      if (runtimeDPIProviderClassName == null)
      {
        log(node, new InvalidRuntimeDPIProviderClassName(runtimeDPIProviderString));
      }
    }
   
        if (swfvarmap.size() > 0)
        {
            String metadata = buildSwfMetadata( swfvarmap );
            Script script = new Script( metadata );
            document.addMetadata( script );
        }

        Attribute theme = getSpecialAttribute(node, specialAttrTheme);
    if (theme != null)
    {
            log(new ThemeAttributeError());
    }

    Attribute rsl = getSpecialAttribute(node, specialAttrRsl);
    if (rsl != null)
    {
            log(new RslAttributeError());
    }

    Attribute lib = getSpecialAttribute(node, specialAttrLib);
    if (lib != null)
    {
            log(new LibAttributeError());                       
    }
  }
View Full Code Here

  /**
   *
   */
  private void checkInvalidRootAttributes(Node node)
  {
      Attribute idAttr = getLanguageAttribute(node, StandardDefs.PROP_ID);
    if (idAttr != null)
    {
      log(node, idAttr.getLine(), new IdNotAllowedOnRoot());
    }

    if (getLanguageAttribute(node, specialAttrInclude) != null ||
        getLanguageAttribute(node, specialAttrExclude) != null)
    {
View Full Code Here

TOP

Related Classes of flex2.compiler.mxml.Attribute

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.