Examples of ComponentBean


Examples of org.ajax4jsf.builder.config.ComponentBean

    VelocityContext context = new VelocityContext();
    Template template = getTemplate();
//    context.put("templateName",COMPONENT_FILE_TEMPLATE);
    // Put common properties
    for (Iterator iter = config.getComponents().iterator(); iter.hasNext();) {
      ComponentBean component = (ComponentBean) iter.next();
      if (null != component.getRenderer() && component.getRenderer().isGenerate()) {
        context.put("component", component);
        context.put("renderer", component.getRenderer());
        if (null == getPackage()) {
          context.put("package", component.getRenderer()
              .getPackageName());
        } else {
          context.put("package", getPackage());
        }
        Set<String> importClasses = new HashSet<String>();
//        for (Iterator it = component.getProperties().iterator(); it
//            .hasNext();) {
//          PropertyBean property = (PropertyBean) it.next();
//          // For non-primitive types, add import declaration.
//          if (!property.isSimpleType() && !property.isExist()) {
//            importClasses.add(property.getClassname());
//          }
//        }
        importClasses.add(component.getClassname());
        importClasses.add(component.getRenderer().getSuperclass());
        context.put("imports", importClasses);
        String resultPath ;
        if (null == getPackage()) {
          resultPath = component.getRenderer().getClassname().replace('.', '/') + ".java";
        } else {
          resultPath = getPackage().replace('.', '/') +"/"+component.getRenderer().getSimpleClassName()+ ".java";         
        }
           
        File javaFile = new File(getDestDir(), resultPath);
        File javaDir = javaFile.getParentFile();
        if (!javaDir.exists()) {
          javaDir.mkdirs();
        }
        try {
          if (javaFile.exists()) {
            if (component.getRenderer().isOverride()) {
              javaFile.delete();
            } else {
              continue;
            }
          }

Examples of org.ajax4jsf.builder.config.ComponentBean

    VelocityContext context = new VelocityContext();
    Template template = getTemplate();
    // Put common properties
    List<ComponentBean> components = new ArrayList<ComponentBean>();
    for (Iterator iter = config.getComponents().iterator(); iter.hasNext();) {
      ComponentBean component = (ComponentBean) iter.next();
      boolean includeComponent = true;
      // Check include patterns
      if (component.getTag() != null || component.getTaghandler() != null) {
        includeComponent = isIncludeComponent(component);
        if (includeComponent) {
          info("Component "+component.getName() +" included to taglib "+getShortname());
          components.add(component);
        } else {
          info("Component "+component.getName() +" excluded from taglib "+getShortname());           
        }
      }
    }
   
    List<ValidatorBean> validators = new ArrayList<ValidatorBean>();

Examples of org.ajax4jsf.builder.config.ComponentBean

  public void createFiles(BuilderConfig config) throws GeneratorException {
    VelocityContext context = new VelocityContext();
    Template template = getTemplate();
    // Put common properties
    for (Iterator iter = config.getComponents().iterator(); iter.hasNext();) {
      ComponentBean component = (ComponentBean) iter.next();
      TagHandlerBean tagHandler = component.getTaghandler();
      if ( null != tagHandler && tagHandler.isGenerate() && null !=tagHandler.getClassname()) {
        context.put("component", component);
        if (null != component.getRenderer()) {
          context.put("renderer", component.getRenderer());
        } else {
          context.put("renderer",Boolean.FALSE);
        }
        context.put("tag", tagHandler);
        context.put("package", tagHandler.getPackageName());
        Set<String> importClasses = new HashSet<String>();
        for (Iterator it = component.getProperties().iterator(); it
            .hasNext();) {
          PropertyBean property = (PropertyBean) it.next();
          // For non-primitive types, add import declaration.
          if (!property.isSimpleType() && !property.isHidden()) {
            importClasses.add(property.getClassname());

Examples of org.ajax4jsf.builder.config.ComponentBean

    VelocityContext context = new VelocityContext();
    Template template = getTemplate();
    context.put("generator",this);
    // Put common properties
    for (Iterator iter = config.getComponents().iterator(); iter.hasNext();) {
      ComponentBean component = (ComponentBean) iter.next();
      info("Create class file "+component.getClassname());
      if (component.isGenerate()) {
        context.put("component", component);
        context.put("renderer", component.getRenderer());
        context.put("package", component.getPackageName());
        Set<String> importClasses = new HashSet<String>();
        for (Iterator it = component.getProperties().iterator(); it
            .hasNext();) {
          PropertyBean property = (PropertyBean) it.next();
          // For non-primitive types, add import declaration.
          if (!property.isSimpleType() && !property.isExist()) {
            importClasses.add(property.getClassname());
          }
        }
        importClasses.add(component.getSuperclass());
        context.put("imports", importClasses);
        String resultPath = component.getClassname().replace('.', '/')
            + ".java";
        File javaFile = new File(getDestDir(), resultPath);
        File javaDir = javaFile.getParentFile();
        if (!javaDir.exists()) {
          javaDir.mkdirs();

Examples of org.ajax4jsf.builder.config.ComponentBean

    VelocityContext context = new VelocityContext();
    context.put("generator",this);
    Template template = getTemplate();
    // Put common properties
    for (Iterator<ComponentBean> iter = config.getComponents().iterator(); iter.hasNext();) {
      ComponentBean component = (ComponentBean) iter.next();
      TagBean tag = component.getTag();
      if ( null !=  tag && null !=tag.getClassname() && tag.isGenerate()) {
        info("Create tag class file "+component.getClassname());
        context.put("component", component);
        if (null != component.getRenderer()) {
          context.put("renderer", component.getRenderer());
        } else {
          context.put("renderer",Boolean.FALSE);
        }
        context.put("tag", component.getTag());
        context.put("package", component.getTag().getPackageName());
        Set<String> importClasses = new HashSet<String>();
        for (Iterator<PropertyBean> it = component.getProperties().iterator(); it
            .hasNext();) {
          PropertyBean property = (PropertyBean) it.next();
          // For non-primitive types, add import declaration.
          if (!property.isSimpleType() && !property.isHidden()) {
            importClasses.add(property.getClassname());
          }
        }
        importClasses.add(component.getTag().getSuperclass());
        context.put("imports", importClasses);
        String resultPath = component.getTag().getClassname().replace('.', '/')
            + ".java";
        File javaFile = new File(getDestDir(), resultPath);
        File javaDir = javaFile.getParentFile();
        if (!javaDir.exists()) {
          javaDir.mkdirs();

Examples of org.ajax4jsf.builder.config.ComponentBean

   */
  public void createFiles(BuilderConfig config) throws GeneratorException {
    // parsecomponents aganist patterns.
      List<ComponentBean> compmnents = new ArrayList<ComponentBean>();
      for (Iterator<ComponentBean> iter = config.getComponents().iterator(); iter.hasNext();) {
        ComponentBean component = iter.next();
        boolean includeComponent = true;
        // Check include patterns
        if (component.getTag() != null && (component.getTag().getTaglib() == null || component.getTag().getTaglib().equals(getShortname()))) {
          includeComponent = isIncludeComponent(component);
          if (includeComponent) {
            info("Component "+component.getName() +" included in taglib "+getShortname());
            compmnents.add(component);
          } else {
            info("Component "+component.getName() +" excluded from taglib "+getShortname());           
          }
        }
      }
         List<ValidatorBean> validators = new ArrayList<ValidatorBean>();
         for (Iterator<ValidatorBean> iter = config.getValidators().iterator(); iter.hasNext();) {

Examples of org.ajax4jsf.builder.config.ComponentBean

    context.put("testDataGenerator", new TestDataGenerator2(getClassLoader(), getLog()));

    Template template = getTemplate();
    // Put common properties
    for (Iterator iter = config.getComponents().iterator(); iter.hasNext();) {
      ComponentBean component = (ComponentBean) iter.next();
      TagBean tag = component.getTag();
      if ( null !=  tag && null !=tag.getClassname() && tag.isGenerate()
          && tag.getTest() != null) {
        info("Create test class file for tag " + component.getTag().getSimpleClassName());
        context.put("component", component);
        if (null != component.getRenderer()) {
          context.put("renderer", component.getRenderer());
        } else {
          context.put("renderer",Boolean.FALSE);
        }
        context.put("tag", component.getTag());
        context.put("package", component.getTag().getPackageName());
        Set<String> importClasses = new HashSet<String>();
        for (Iterator<PropertyBean> it = component.getProperties().iterator(); it
            .hasNext();) {
          PropertyBean property = (PropertyBean) it.next();
          // For non-primitive types, add import declaration.
          if (!property.isSimpleType() && !property.isHidden()) {
            importClasses.add(property.getClassname());
          }
        }
        importClasses.add(component.getTag().getTest().getSuperclassname());
        context.put("imports", importClasses);
        String resultPath = component.getTag().getTest().getClassname().replace('.', '/')
            + ".java";
        //System.out.println("resultPath - " + resultPath);
        //System.out.println("getDestDir() - " + getDestDir());
        File javaFile = new File(getDestDir(), resultPath);
        File javaDir = javaFile.getParentFile();

Examples of org.apache.shale.clay.config.beans.ComponentBean

        RolodexDao dao = (RolodexDao) getBean("rolodexDao");

        // return a list of tabs
        List tabs = dao.getTabs();

        ComponentBean root = (ComponentBean) displayElementRoot;
        root.setComponentType("javax.faces.HtmlPanelGroup");
        root.addChild(createVerbatimMetadata("<ul id=\"menu\">", context));

        for (int i = 0; i < tabs.size(); i++) {
            SelectItem item = (SelectItem) tabs.get(i);

            root.addChild(createVerbatimMetadata("<li id=\"", context));

            root.addChild(createVerbatimMetadata("nav-sel",
                    "#{@managed-bean-name.selectedTab == " + i + "}", context));
            root.addChild(createVerbatimMetadata("nav",
                    "#{@managed-bean-name.selectedTab != " + i + "}", context));

            root.addChild(createVerbatimMetadata("\">", context));
            root.addChild(createCommandLinkMetadata(item, context));
            root.addChild(createVerbatimMetadata("</li>", context));
        }

        root.addChild(createVerbatimMetadata("</ul>", context));

    }

Examples of org.apache.shale.clay.config.beans.ComponentBean

        //
        // <clay:clay id="tabs" jsfid="RUNTIME"
        // shapeValidator="#{rolodex.createTabs}" managedBeanName="rolodex" />

        // create a fake clay root display element bean
        ComponentBean displayElementRoot = new ComponentBean();

        // create a mock component for the validator style/signature
        // of method binding
        Clay component = new Clay();
        component.setId("RUNTIME");
        component.setManagedBeanName("rolodex");
        component.setShapeValidator("#{rolodex.createTabs}");

        // make the last tab active
        viewController.setSelectedTab(RolodexDao.TAB_INDEX.length - 1);

        // simulate the the "shapeValidator" event is fired from the
        // beginEncode method of the Clay component on the view controller.
        viewController.createTabs(facesContext, component, displayElementRoot);

        // Check the number of children. Each tab has 6 nodes multiplied times
        // the
        // number of tabs plus two for the unordered list tags.
        int n = (RolodexDao.TAB_INDEX.length * 6) + 2;

        assertEquals("#Children", n, displayElementRoot.getChildren().size());

    }

Examples of org.apache.shale.clay.config.beans.ComponentBean

                || !(component instanceof Clay)) {
            throw new RuntimeException(messages.getMessage("invalid.binding",
                    new Object[] { "clayOut" }));
        }

        ComponentBean text = (ComponentBean) displayElementRoot;
        Clay clay = (Clay) component;
        String value = (String) clay.getAttributes().get("value");
        value = tagUtils.evalString(value);
        if (value == null) {
            throw new IllegalArgumentException(messages.getMessage(
                    "missing.attribute", new Object[] { "value", "clayOut" }));
        }

        boolean escapeXml = false;
        String tmp = (String) clay.getAttributes().get("escapeXml");
        if (tmp != null) {
            escapeXml = tagUtils.evalBoolean(tmp).booleanValue();
        }

        if (!escapeXml) {
            value = decode(value);
        } else {
            value = encode(value);
        }

        text.setJsfid("outputText");
        text.setComponentType("javax.faces.HtmlOutputText");

        // add a value attribute
        AttributeBean attr = new AttributeBean();
        attr.setName("value");
        attr.setValue(value);
        text.addAttribute(attr);

        // add a escape attribute
        attr = new AttributeBean();
        attr.setName("escape");
        attr.setValue(Boolean.FALSE.toString());
        text.addAttribute(attr);

        // add a isTransient attribute
        attr = new AttributeBean();
        attr.setName("isTransient");
        attr.setValue(Boolean.TRUE.toString());
        text.addAttribute(attr);

    }
TOP
Copyright © 2018 www.massapi.com. 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.