Examples of FuzzyXMLElement


Examples of jp.aonir.fuzzyxml.FuzzyXMLElement

   */
  protected List getTagList(){
    ArrayList list = new ArrayList();
    list.addAll(this.tagList);
    // get namespace
    FuzzyXMLElement element = getOffsetElement();
    HashMap nsPrefixMap = new HashMap();
    getNamespace(nsPrefixMap,element);
    // add prefix to tag names
    Iterator ite = this.nsTagListMap.keySet().iterator();
    while(ite.hasNext()){
View Full Code Here

Examples of jp.aonir.fuzzyxml.FuzzyXMLElement

      try {
        FuzzyXMLDocument doc = new FuzzyXMLParser().parse(new FileInputStream(webXML));
        FuzzyXMLNode[] nodes = XPath.selectNodes(doc.getDocumentElement(),"/web-app/taglib|/web-app/jsp-config/taglib");
       
        for(int i=0;i<nodes.length;i++){
          FuzzyXMLElement element = (FuzzyXMLElement)nodes[i];
          String taglibUri = HTMLUtil.getXPathValue(element,"/taglib-uri/child::text()");
          String taglibLoc = HTMLUtil.getXPathValue(element,"/taglib-location/child::text()");
          if(uri.equals(taglibUri)){
            if(taglibLoc!=null && taglibLoc.endsWith(".tld")){
              File file = new File(basedir,taglibLoc);
View Full Code Here

Examples of jp.aonir.fuzzyxml.FuzzyXMLElement

    text.setCursor(cursor);
  }
 
  private IRegion selectWord(IDocument doc,int offset){
    FuzzyXMLDocument document = new FuzzyXMLParser().parse(editor.getHTMLSource());
    FuzzyXMLElement element = document.getElementByOffset(offset);
    if(element==null){
      return null;
    }
    FuzzyXMLAttribute[] attrs = element.getAttributes();
    for(int i=0;i<attrs.length;i++){
      if(attrs[i].getOffset() < offset && offset < attrs[i].getOffset()+attrs[i].getLength()){
        int attrOffset = getAttributeValueOffset(doc.get(),attrs[i]);
        int attrLength = attrs[i].getValue().length();
        if(attrOffset >= 0 && attrLength >= 0 && attrOffset <= offset){
View Full Code Here

Examples of jp.aonir.fuzzyxml.FuzzyXMLElement

    if(xml!=null){
      FuzzyXMLDocument doc = new FuzzyXMLParser().parse(xml);
      // apply visible
      FuzzyXMLNode[] groups = HTMLUtil.selectXPathNodes(doc.getDocumentElement(),"/palette/groups/group");
      for(int i=0;i<groups.length;i++){
        FuzzyXMLElement group = (FuzzyXMLElement)groups[i];
       
        String name = group.getAttributeNode("name").getValue();
        boolean visible = new Boolean(group.getAttributeNode("visible").getValue()).booleanValue();
       
        List entries = viewer.getPaletteRoot().getChildren();
        PaletteDrawer drawer = null;
       
        for(int j=0;j<entries.size();j++){
          drawer = (PaletteDrawer)entries.get(j);
          if(drawer.getLabel().equals(name)){
            drawer.setVisible(visible);
            break;
          } else {
            drawer =null;
          }
        }
        if(drawer==null){
          drawer = new PaletteDrawer(name);
          drawer.setVisible(visible);
          viewer.getPaletteRoot().add(drawer);
        }
      }
      // add user items
      FuzzyXMLNode[] items = HTMLUtil.selectXPathNodes(doc.getDocumentElement(),"/palette/items/item");
      String[] categories = getCategories();
      for(int i=0;i<items.length;i++){
        FuzzyXMLElement item = (FuzzyXMLElement)items[i];
        String name  = item.getAttributeNode("name").getValue();
        String group = item.getAttributeNode("group").getValue();
        String text  = item.getValue();
        if(Arrays.binarySearch(categories,group)<0){
          addPaletteItem(group,new DefaultPaletteItem(name,
              HTMLPlugin.getDefault().getImageRegistry().getDescriptor(HTMLPlugin.ICON_TAG),
              text));
        }
View Full Code Here

Examples of jp.aonir.fuzzyxml.FuzzyXMLElement

    }
  }
 
  protected Image getNodeImage(FuzzyXMLNode element){
    if(element instanceof FuzzyXMLElement){
      FuzzyXMLElement e = (FuzzyXMLElement)element;
      if(e.getName().equalsIgnoreCase("html")){
        return HTMLPlugin.getDefault().getImageRegistry().get(HTMLPlugin.ICON_TAG_HTML);
      } else if(e.getName().equalsIgnoreCase("title")){
        return HTMLPlugin.getDefault().getImageRegistry().get(HTMLPlugin.ICON_TITLE);
      } else if(e.getName().equalsIgnoreCase("body")){
        return HTMLPlugin.getDefault().getImageRegistry().get(HTMLPlugin.ICON_BODY);
      } else if(e.getName().equalsIgnoreCase("form")){
        return HTMLPlugin.getDefault().getImageRegistry().get(HTMLPlugin.ICON_FORM);
      } else if(e.getName().equalsIgnoreCase("img")){
        return HTMLPlugin.getDefault().getImageRegistry().get(HTMLPlugin.ICON_IMAGE);
      } else if(e.getName().equalsIgnoreCase("a")){
        return HTMLPlugin.getDefault().getImageRegistry().get(HTMLPlugin.ICON_LINK);
      } else if(e.getName().equalsIgnoreCase("table")){
        return HTMLPlugin.getDefault().getImageRegistry().get(HTMLPlugin.ICON_TABLE);
      } else if(e.getName().equalsIgnoreCase("input")){
        String type = e.getAttributeValue("type");
        if(type!=null){
          if(type.equalsIgnoreCase("button") || type.equalsIgnoreCase("reset") || type.equalsIgnoreCase("submit")){
            return HTMLPlugin.getDefault().getImageRegistry().get(HTMLPlugin.ICON_BUTTON);
          } else if(type.equalsIgnoreCase("radio")){
            return HTMLPlugin.getDefault().getImageRegistry().get(HTMLPlugin.ICON_RADIO);
          } else if(type.equalsIgnoreCase("checkbox")){
            return HTMLPlugin.getDefault().getImageRegistry().get(HTMLPlugin.ICON_CHECK);
          } else if(type.equalsIgnoreCase("text")){
            return HTMLPlugin.getDefault().getImageRegistry().get(HTMLPlugin.ICON_TEXT);
          } else if(type.equalsIgnoreCase("password")){
            return HTMLPlugin.getDefault().getImageRegistry().get(HTMLPlugin.ICON_PASS);
          } else if(type.equalsIgnoreCase("hidden")){
            return HTMLPlugin.getDefault().getImageRegistry().get(HTMLPlugin.ICON_HIDDEN);
          }
        }
      } else if(e.getName().equalsIgnoreCase("select")){
        return HTMLPlugin.getDefault().getImageRegistry().get(HTMLPlugin.ICON_SELECT);
      } else if(e.getName().equalsIgnoreCase("textarea")){
        return HTMLPlugin.getDefault().getImageRegistry().get(HTMLPlugin.ICON_TEXTAREA);
      }
      return HTMLPlugin.getDefault().getImageRegistry().get(HTMLPlugin.ICON_TAG);
    } else if(element instanceof FuzzyXMLDocType){
      return HTMLPlugin.getDefault().getImageRegistry().get(HTMLPlugin.ICON_DOCTYPE);
View Full Code Here

Examples of jp.aonir.fuzzyxml.FuzzyXMLElement

      }
     
      // getting TLDs from xmlns
      try {
        this.doc = new FuzzyXMLParser().parse(HTMLUtil.scriptlet2space(source,false));
        FuzzyXMLElement root = (FuzzyXMLElement)XPath.selectSingleNode(doc.getDocumentElement(),"*");
        if(root!=null){
          FuzzyXMLAttribute[] attrs = root.getAttributes();
          for(int i=0;i<attrs.length;i++){
            if(attrs[i].getName().startsWith("xmlns:")){
              String[] dim = attrs[i].getName().split(":");
              if(dim.length > 1){
                TLDInfo info = TLDInfo.getTLDInfo(file,dim[1],attrs[i].getValue());
View Full Code Here

Examples of jp.aonir.fuzzyxml.FuzzyXMLElement

    this.name = name;
  }
 
  public boolean filter(FuzzyXMLNode node) {
    if(node instanceof FuzzyXMLElement){
      FuzzyXMLElement element = (FuzzyXMLElement)node;
      if(name!=null && !name.equals(element.getName())){
        return false;
      }
      return true;
    }
    return false;
View Full Code Here

Examples of jp.aonir.fuzzyxml.FuzzyXMLElement

    _nodeToIDMap = new HashMap<FuzzyXMLNode, String>();

    try {
      WodParserCache cache = _editor.getParserCache();
      RenderContext renderContext = new RenderContext(true);
      FuzzyXMLElement documentElement = _doc.getDocumentElement();
      StringBuffer documentContentsBuffer = new StringBuffer();
      renderHeader(documentContentsBuffer);
      renderElement(documentElement, renderContext, documentContentsBuffer, cache);
      renderFooter(documentContentsBuffer);
View Full Code Here

Examples of jp.aonir.fuzzyxml.FuzzyXMLElement

  protected void renderElement(FuzzyXMLNode node, RenderContext renderContext, StringBuffer renderBuffer, WodParserCache cache) {
    String nodeID = "node" + (_counter++);
    _idToNodeMap.put(nodeID, node);
    _nodeToIDMap.put(node, nodeID);
    if (node instanceof FuzzyXMLElement) {
      FuzzyXMLElement element = (FuzzyXMLElement) node;
      boolean empty = element.isEmpty();
      String nodeName = element.getName();
      String className = "element";

      boolean woTag = WodHtmlUtils.isWOTag(nodeName);
      boolean woSimpleString = false;

      IWodElement wodElement = null;
      if (woTag) {
        className = className + " wo";
        try {
          BuildProperties buildProperties = (BuildProperties)_editor.getParserCache().getProject().getAdapter(BuildProperties.class);
          wodElement = WodHtmlUtils.getWodElement(element, buildProperties, true, cache);
        }
        catch (Throwable t) {
          // IGNORE
          t.printStackTrace();
        }
        if (wodElement != null) {
          className = className + " " + wodElement.getElementType();

          if ("WOString".equals(wodElement.getElementType()) || "ERXLocalizedString".equals(wodElement.getElementType())) {
            if (wodElement.getBindingNamed("value") != null) {
              if (wodElement.getBindingNamed("escapeHTML") != null && wodElement.getBindings().size() == 2) {
                woSimpleString = true;
              }
              else if (wodElement.getBindings().size() == 1) {
                woSimpleString = true;
              }
            }

            // MS: FORCE OFF FOR NOW
            //woSimpleString = false;

            if (woSimpleString) {
              className = className + " simple";
            }
          }
        }
      }
      else {
        className = className + " " + nodeName.toLowerCase();
      }

      boolean showExpandCollapse = !empty;
      if ("script".equalsIgnoreCase(nodeName)) {
        // don't show script
        showExpandCollapse = false;
      }
      else if ("style".equalsIgnoreCase(nodeName)) {
        // don't show style
        showExpandCollapse = false;
      }

      if (!showExpandCollapse) {
        className += " empty";
      }

      //renderBuffer.append("<div id = \"" + nodeID + "\" class = \"" + className + "\" onmouseover = \"window.status = 'over:" + nodeID + "';\" onmouseout = \"window.status = 'out:" + nodeID + "';\" >");
      renderBuffer.append("<div id = \"" + nodeID + "\" class = \"" + className + "\">");

      if (showExpandCollapse) {
        renderBuffer.append("<div id = \"" + nodeID + "_toggle\" class = \"expandcollapse\" onclick = \"expandCollapse('" + nodeID + "')\">");
        if (_collapsedIDs.contains(nodeID)) {
          renderBuffer.append(TemplateOutlinePage.EXPAND_STRING);
        }
        else {
          renderBuffer.append(TemplateOutlinePage.COLLAPSE_STRING);
        }
        renderBuffer.append("</div>");
      }

      renderBuffer.append("<div class = \"summary\" onclick = \"window.status = 'select:" + nodeID + "'\">");

      // ... a simple string tag
      if (woSimpleString) {
        IWodBinding valueBinding = wodElement.getBindingNamed("value");
        String text = valueBinding.getValue();
        String textClassName;
        if (valueBinding.isLiteral()) {
          //text = text.replaceAll("^\"([^\"]+)\"", "$1");
          textClassName = "text literal";
        }
        else if (valueBinding.isOGNL()) {
          textClassName = "text ognl";
        }
        else {
          textClassName = "text keypath";
        }
        renderBuffer.append("<div class = \"title\"></div> <div class = \"" + textClassName + "\">[" + text + "]</div>");
      }
      // ... a WO tag
      else if (woTag) {
        if (wodElement != null) {
          if (WodHtmlUtils.isInline(nodeName)) {

            String summaryName = wodElement.getElementType();
            renderBuffer.append("<div class = \"title\"><span class = \"nodeName verbose\">" + summaryName + "</span></div>");

            // Special case for the compact display of a conditional
            if ("WOConditional".equals(summaryName)) {
              String conditionValue = wodElement.getBindingValue("condition");
              if (conditionValue != null) {
                summaryName = conditionValue;
                boolean negated = false;
                IWodBinding negateBinding = wodElement.getBindingNamed("negate");
                if (negateBinding != null) {
                  if (negateBinding.isTrueValue()) {
                    negated = true;
                  }
                }
                else if (nodeName.equals("wo:not")) {
                  negated = true;
                }

                if (negated) {
                  summaryName = "<span class = \"negate\">not</span> " + summaryName;
                }
                else if (negateBinding != null) {
                  summaryName = summaryName + " <span class = \"negate\">not = " + negateBinding.getValue() + "</span>";
                }
              }
            }
            // Special case for the compact display of a string
            else if ("WOString".equals(summaryName)) {
              String value = wodElement.getBindingValue("value");
              if (value != null) {
                summaryName = "WOString: " + value;
              }
            }
            // Special case for the compact display of a localized string
            else if ("ERXLocalizedString".equals(summaryName)) {
              String value = wodElement.getBindingValue("value");
              if (value != null) {
                summaryName = "ERXLocalizedString: " + value;
              }
            }
            // Special case for the compact display of links, buttons, etc
            else if (wodElement.getBindingNamed("action") != null) {
              String action = wodElement.getBindingValue("action");
              summaryName = wodElement.getElementType() + ": " + action;
            }
            // Special case for the compact display of form fields
            else if (wodElement.getBindingNamed("value") != null) {
              String value = wodElement.getBindingValue("value");
              summaryName = wodElement.getElementType() + ": " + value;
            }
            // Special case for the compact display of checkboxes
            else if (wodElement.getBindingNamed("checked") != null) {
              String checked = wodElement.getBindingValue("checked");
              summaryName = wodElement.getElementType() + ": " + checked;
            }
            // Special case for the compact display of repetitions and popup buttons
            else if (wodElement.getBindingNamed("list") != null) {
              String list = wodElement.getBindingValue("list");
              summaryName = wodElement.getElementType() + ": " + list;
            }
            renderBuffer.append("<div class = \"title\"><span class = \"nodeName compact\">" + summaryName + "</span></div>");
          }
          else {
            renderBuffer.append("<div class = \"title\"><span class = \"nodeName\">" + wodElement.getElementName() + "</span> <span class = \"type\">: " + wodElement.getElementType() + "</span></div>");
          }

          // WO bindings
          List<IWodBinding> wodBindings = wodElement.getBindings();
          if (wodBindings.size() > 0) {
            renderBuffer.append("<table class = \"bindings\">");
            for (IWodBinding wodBinding : wodBindings) {
              renderBuffer.append("<tr>");
              renderBuffer.append("<th>" + wodBinding.getName() + "</th>");
              String bindingClass;
              if (wodBinding.isLiteral()) {
                bindingClass = "literal";
              }
              else if (wodBinding.isOGNL()) {
                bindingClass = "ognl";
              }
              else {
                bindingClass = "keypath";
              }
              renderBuffer.append("<td class = \"" + bindingClass + "\">" + wodBinding.getValue() + "</td>");
              renderBuffer.append("</tr>");
            }
            renderBuffer.append("</table>");
          }
        }
        // ... if the WO tag doesn't have a WOD entry, show it as "missing"
        else {
          String missingName = element.getAttributeValue("name");
          if (missingName == null) {
            missingName = nodeName;
          }
          renderBuffer.append("<div class = \"title missing\">" + missingName + "</div>");
        }
      }
      // ... an html node
      else {
        renderBuffer.append("<div class = \"title nonwo\"><span class = \"nodeName\">");
        renderBuffer.append(nodeName);
        renderBuffer.append("</span>");

        String elementID = element.getAttributeValue("id");
        if (elementID != null) {
          renderBuffer.append("<span class = \"idName\">#" + elementID + "</span>");
        }

        String elementClass = element.getAttributeValue("class");
        if (elementClass != null) {
          elementClass = elementClass.replace(' ', '.');
          renderBuffer.append("<span class = \"className\">." + elementClass + "</span>");
        }
        renderBuffer.append("</div>");
      }

      renderBuffer.append("</div>");

      // ... if there are children, show the contents
      if (showExpandCollapse) {
        renderBuffer.append("<div id = \"" + nodeID + "_contents\" class = \"contents\"");
        if (_collapsedIDs.contains(nodeID)) {
          renderBuffer.append(" style = \"display: none\"");
        }
        renderBuffer.append(">");
        FuzzyXMLNode[] children = element.getChildren();
        for (FuzzyXMLNode child : children) {
          renderElement(child, renderContext, renderBuffer, cache);
        }
        renderBuffer.append("</div>");
      }
View Full Code Here

Examples of jp.aonir.fuzzyxml.FuzzyXMLElement

    }
  }

  public boolean renderNode(FuzzyXMLNode node, RenderContext renderContext, StringBuffer xmlBuffer) {
    if (node instanceof FuzzyXMLElement) {
      FuzzyXMLElement element = (FuzzyXMLElement) node;
      String tagName = element.getName();
      if (WodHtmlUtils.isWOTag(tagName)) {
        try {
          WodParserCache cache = _caches.peek();
          BuildProperties buildProperties = (BuildProperties)cache.getProject().getAdapter(BuildProperties.class);
          IWodElement wodElement = WodHtmlUtils.getWodElement(element, buildProperties, true, cache);
View Full Code Here
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.