Package com.sun.java.help.impl

Examples of com.sun.java.help.impl.LangElement


  }

  public void tagFound(ParserEvent e) {
            debug("tagFound " + e.getTag().name);
      Locale locale = null;
      LangElement le;
      Tag tag = e.getTag();
      String name = tag.name;
      int x=0, y=0, width=0, height=0;
      TagProperties attr = tag.atts;
      Hashtable ht = (attr == null) ? null : attr.getHashtable();

      if (attr != null) {
    String lang = attr.getProperty("xml:lang");
    locale = HelpUtilities.localeFromLang(lang);
                viewMergeType = attr.getProperty("mergetype");
    helpActionImage = attr.getProperty("image");
    String value = null;
    value = attr.getProperty("width");
    if (value != null) {
        width = Integer.parseInt(value);
    }
    value = null;
    value = attr.getProperty("height");
    if (value != null) {
        height = Integer.parseInt(value);
    }
    value = null;
    value = attr.getProperty("x");
    if (value != null) {
        x = Integer.parseInt(value);
    }
    value = null;
    value = attr.getProperty("y");
    if (value != null) {
        y = Integer.parseInt(value);
    }
    value = null;
    value = attr.getProperty("default");
    if (value != null && value.equals("true")) {
        defaultPresentation = true;
    }
    value = null;
    value = attr.getProperty("displayviews");
    if (value != null && value.equals("false")) {
        displayViews = false;
    }
    value = null;
    value = attr.getProperty("displayviewimages");
    if (value != null && value.equals("false")) {
        displayViewImages = false;
    }
      }
      if (locale == null) {
    locale = lastLocale;
      }
           
      if (name.equals("helpset")) {
    if (tag.isEnd) {
        removeTag(tag);
    } else {
        // Check and see if the locale is different from the
        // defaultLocale. If it is then reset the locale.
         if (! locale.equals(defaultLocale) &&
      ! locale.equals(myHSLocale)) {
      if (locale != null) {
          myHS.setLocale(locale);
          defaultLocale = locale;
      }
        }
        if (attr != null) {
            String version = attr.getProperty("version");
      if (version != null &&
          (version.compareTo("1.0") != 0 &&
           version.compareTo("2.0") != 0)) {
          parsingError("helpset.unknownVersion", version);
      }
        }
        addTag(tag, locale);
    }
    return;
      }

      if (tagStack.empty()) {
    parsingError("helpset.wrongTopLevel", name);
      }

      // Get the parents name
      le = (LangElement) tagStack.peek();
      String pname = ((Tag) le.getTag()).name; // the parent

      if (name.equals("title")) {
    // TITLE tag
    if (tag.isEnd) {
        removeTag(tag);    // processing was done in textFound()
View Full Code Here


      debug("  text: "+e.getText());

      if (tagStack.empty()) {
    return;    // ignore
      }
      LangElement le = (LangElement) tagStack.peek();
      Tag tag = le.getTag();
      TagProperties attr = tag.atts;
      Hashtable ht = (attr == null) ? null : attr.getHashtable();
      String text = e.getText().trim();
      String name = tag.name;

      if (name.equals("helpset")) {
    // HELPSET tag
    checkNull("helpset", text);
    return;
      }
      int depth = tagStack.size();
      String pname = "";
      if (depth >= 2) {
    le = (LangElement) tagStack.elementAt(depth-2);
    pname = ((Tag) le.getTag()).name; // the parent
      }

      if (name.equals("title")) {
    // TITLE tag
    if (pname.equals("helpset")) {
View Full Code Here

   
      /**
   * addTag keeps track of tags and their locale attributes.
   */
  protected void addTag(Tag tag, Locale locale) {
      LangElement el = new LangElement(tag, locale);
      tagStack.push(el);
      // It's possible for lastLocale not be specified ergo null.
      // If it is then set lastLocale to null even if locale is null.
      // It is impossible for locale to be null
      if (lastLocale == null) {
View Full Code Here

  /**
   * removeTag removes a tag from the tagStack. The tagStack is
   * used to keep track of tags and locales.
   */
  protected void removeTag(Tag tag) {
      LangElement el;
      String name = tag.name;
      Locale newLocale = null;

      for (;;) {
    if (tagStack.empty())
        unbalanced(name);
    el = (LangElement) tagStack.pop();
    if (el.getTag().name.equals(name)) {
        if (tagStack.empty()) {
      newLocale = defaultLocale;
        } else {
      el = (LangElement) tagStack.peek();
      newLocale = el.getLocale();
        }
        break;
    }
      }
      // It's possible for lastLocale not be specified ergo null.
View Full Code Here

TOP

Related Classes of com.sun.java.help.impl.LangElement

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.