Fix for #131899: change to bindMarkupBeans first to look into tag lib uri
authordeva@netbeans.org
Sun, 06 Apr 2008 18:21:29 -0700
changeset 302557d5c6b3522b
parent 3024 f80896cbd497
child 3026 c2525170412f
Fix for #131899: change to bindMarkupBeans first to look into tag lib uri
visualweb.insync/src/org/netbeans/modules/visualweb/insync/faces/FacesPageUnit.java
     1.1 --- a/visualweb.insync/src/org/netbeans/modules/visualweb/insync/faces/FacesPageUnit.java	Sun Apr 06 18:16:16 2008 -0700
     1.2 +++ b/visualweb.insync/src/org/netbeans/modules/visualweb/insync/faces/FacesPageUnit.java	Sun Apr 06 18:21:29 2008 -0700
     1.3 @@ -376,40 +376,40 @@
     1.4       * Bind all markup beans to their element and take care of parenting. Creates the HtmlBean
     1.5       * instances for HTML and other fake beans on the fly
     1.6       */
     1.7 -    
     1.8 -    // This is a horrible O(N2) algorithm, need to change it - Winston
     1.9      protected void bindMarkupBeans(Element e) {
    1.10          MarkupBean mbean = getMarkupBean(e);
    1.11          if (mbean == null) {
    1.12 -            String type = HtmlBean.getBeanClassname(e);
    1.13 +            String type = null;
    1.14 +            String tagName = e.getLocalName();
    1.15 +            String name = e.getAttribute(FacesBean.ID_ATTR);
    1.16 +            String tagLibUri = pgunit.findTaglibUri(e.getPrefix());
    1.17 +            try {
    1.18 +                type = container.findComponentClass(tagName, tagLibUri);
    1.19 +                assert Trace.trace("insync.faces", "FU.bindMarkupBeans type:" + type +
    1.20 +                        " tag:" + tagName + " tagLibUri:" + tagLibUri);
    1.21 +            } catch (JsfTagSupportException ex) {
    1.22 +                ErrorManager.getDefault().log(ex.getLocalizedMessage());
    1.23 +            }
    1.24 +
    1.25              if (type != null) {
    1.26                  BeanInfo bi = getBeanInfo(type);
    1.27 -                if (bi != null) {
    1.28 -                    mbean = new HtmlBean(this, bi, e.getTagName(), e);
    1.29 -                    beans.add(mbean);
    1.30 +                mbean = new FacesBean(this, bi, name, e);
    1.31 +                // snag the form bean as it goes by for later use as the default parent
    1.32 +                if (defaultParent == null && tagName.equals(HtmlTag.FORM.name)) {
    1.33 +                    defaultParent = mbean;
    1.34                  }
    1.35              } else {
    1.36 -                // OK, there are no bindings in the Java, create designbean from tag
    1.37 -                String tagName = e.getLocalName();
    1.38 -                String name = e.getAttribute(FacesBean.ID_ATTR);
    1.39 -                String tagLibUri = pgunit.findTaglibUri(e.getPrefix());
    1.40 -                try {
    1.41 -                    type = container.findComponentClass(tagName, tagLibUri);
    1.42 -                    assert Trace.trace("insync.faces", "FU.bindMarkupBeans type:" + type +
    1.43 -                            " tag:" + tagName + " tagLibUri:" + tagLibUri);
    1.44 +                type = HtmlBean.getBeanClassname(e);
    1.45 +                if (type != null) {
    1.46                      BeanInfo bi = getBeanInfo(type);
    1.47 -                    mbean = new FacesBean(this, bi, name, e);
    1.48 -                    // snag the form bean as it goes by for later use as the default parent
    1.49 -                    if (defaultParent == null && tagName.equals(HtmlTag.FORM.name)) {
    1.50 -                        defaultParent = mbean;
    1.51 +                    if (bi != null) {
    1.52 +                        mbean = new HtmlBean(this, bi, e.getTagName(), e);
    1.53                      }
    1.54 -                    beans.add(mbean);
    1.55 -                } catch (JsfTagSupportException ex) {
    1.56 -                    ErrorManager.getDefault().log(ex.getLocalizedMessage());
    1.57                  }
    1.58              }
    1.59          }
    1.60          if (mbean != null) {
    1.61 +            beans.add(mbean);
    1.62              Bean parent = mbean.bindParent();
    1.63              if (parent != null)
    1.64                  parent.addChild(mbean, null);  // append is right since we are walking the DOM here