Пример #1
0
 /* (non-Javadoc)
  * @see parser.CBMSElement#DoSemanticAnalysis(semantic.CBaseEntityFactory)
  */
 public CBaseLanguageEntity DoSemanticAnalysis(
     CBaseLanguageEntity parent, CBaseEntityFactory factory) {
   CEntityResourceField ef;
   if (getName().equals("")) {
     ef = factory.NewEntityLabelField(getLine());
     ef.m_csInitialValue = m_Value;
   } else {
     ef = factory.NewEntityEntryField(getLine(), getName());
     if (!m_Value.equals("")) {
       ef.m_ResourceStrings = m_ResourceStrings;
       ef.m_csInitialValue = m_Value;
     }
   }
   ef.SetDisplayName(m_csDisplayName);
   ef.m_nPosCol = m_PosCol;
   ef.m_nPosLine = m_PosLine;
   ef.m_nLength = m_Length;
   if (m_HighLight != null) {
     ef.SetHighLight(m_HighLight.m_Name);
   }
   if (m_Color != null) {
     ef.SetColor(m_Color.m_Name);
   }
   for (int i = 0; i < m_arrATTRB.size(); i++) {
     String cs = m_arrATTRB.elementAt(i);
     if (cs.equals("ASKIP")) {
       ef.SetProtection("AUTOSKIP");
     } else if (cs.equals("UNPROT")) {
       ef.SetProtection("UNPROTECTED");
     } else if (cs.equals("NUM")) {
       ef.SetProtection("NUMERIC");
     } else if (cs.equals("NORM")) {
       ef.SetBrightness("NORMAL");
     } else if (cs.equals("DRK")) {
       ef.SetBrightness("DARK");
     } else if (cs.equals("BRT")) {
       ef.SetBrightness("BRIGHT");
     } else if (cs.equals("FSET")) {
       ef.SetModified();
     } else if (cs.equals("IC")) {
       ef.SetCursor();
     }
   }
   for (int i = 0; i < m_arrJustify.size(); i++) {
     String cs = m_arrJustify.elementAt(i);
     if (cs.equals("LEFT")) {
       ef.SetRightJustified(false);
     } else if (cs.equals("RIGHT")) {
       ef.SetRightJustified(true);
     } else if (cs.equals("BLANK")) {
       ef.SetFillValue("BLANK");
     } else if (cs.equals("ZERO") || cs.equals("ZEROS") || cs.equals("ZEROES")) {
       ef.SetFillValue("ZERO");
     }
   }
   return ef;
 }
Пример #2
0
  private boolean fillFromBlank(PosLineCol posLineCol, Tag tag, String csCurrentLanguage) {
    m_Color = new CReservedConstant(null, "GREEN");
    m_HighLight = new CReservedConstant(null, "OFF");
    setName("");
    setLine(ms_nNbBlank++);
    m_Length = 0; // tag.getValAsInt("length");
    m_PosLine = posLineCol.getLine();
    m_PosCol = posLineCol.getCol() + posLineCol.getLength() + 1;

    m_Value = "";

    m_arrATTRB.addElement("ASKIP");
    m_arrATTRB.addElement("NORM");

    return true;
  }
Пример #3
0
  public boolean setAsClosingHBox(PosLineCol posLineCol) {
    m_Color = new CReservedConstant(null, "GREEN");
    m_HighLight = new CReservedConstant(null, "OFF");
    setName("");
    setLine(0);
    m_Length = 0;
    m_PosLine = posLineCol.getLine();
    m_PosCol = posLineCol.getCol() + posLineCol.getLength() + 1;
    posLineCol.setLineColLength(m_PosLine + 1, 0, 0);
    if (m_PosCol > 80) return false;

    m_Value = "";

    m_arrATTRB.addElement("ASKIP");
    m_arrATTRB.addElement("NORM");
    return true;
  }
Пример #4
0
 private void manageAttrib(String cs) {
   if (cs.equalsIgnoreCase("autoskip")) m_arrATTRB.addElement("ASKIP");
   else if (cs.equalsIgnoreCase("UNPROTECTED")) m_arrATTRB.addElement("UNPROT");
   else if (cs.equalsIgnoreCase("NUMERIC")) {
     m_arrATTRB.addElement("UNPROT"); // correct ?
     m_arrATTRB.addElement("NUM");
   } else if (cs.equalsIgnoreCase("NORMAL")) m_arrATTRB.addElement("NORM");
   else if (cs.equalsIgnoreCase("DARK")) m_arrATTRB.addElement("DRK");
   else if (cs.equalsIgnoreCase("BRIGHT")) m_arrATTRB.addElement("BRT");
 }
Пример #5
0
  private boolean fillFromSwitch(
      PosLineCol posLineCol, Tag tag, String csCurrentLanguage, String csAppendColor) {
    if (tag.isValExisting("name")) setName(tag.getVal("name").toUpperCase());
    else setName("");

    m_Length = tag.getValAsInt("length");

    m_PosLine = tag.getValAsInt("line");

    m_PosCol = tag.getValAsInt("col");

    posLineCol.setLineColLength(m_PosLine, m_PosCol, m_Length);

    m_Value = "";

    Tag tagTexts = tag.getChild("texts");
    if (tagTexts != null) {
      TagCursor curText = new TagCursor();
      Tag tagText = tagTexts.getFirstChild(curText, "text");
      while (tagText != null) {
        String csLanguage = tagText.getVal("lang");
        if (csLanguage.equalsIgnoreCase(csCurrentLanguage)) {
          m_Value = tagText.getText();
          break;
        }
        tagText = tagTexts.getNextChild(curText);
      }
    }

    m_arrJustify.addElement(CBMSConstantList.LEFT.m_Name);

    m_arrJustify.addElement(CBMSConstantList.BLANK.m_Name);

    m_arrATTRB.addElement("ASKIP");
    m_arrATTRB.addElement("NORM");

    return true;
  }
Пример #6
0
  public CBMSElement loadTagParameters(Tag tagCurrent) {
    int nLine = tagCurrent.getValAsInt("Line");
    setLine(nLine);

    setName(tagCurrent.getVal("Name"));

    String csColor = tagCurrent.getVal("Color");
    m_Color = new CReservedConstant(null, csColor);

    String csHighLight = tagCurrent.getVal("HighLight");
    m_HighLight = new CReservedConstant(null, csHighLight);

    m_Length = tagCurrent.getValAsInt("Length");

    m_PosCol = tagCurrent.getValAsInt("PosCol");

    m_PosLine = tagCurrent.getValAsInt("PosLine");

    m_Value = tagCurrent.getVal("Value");

    // Enum all sub tags
    TagCursor curChild = new TagCursor();
    Tag tagChild = tagCurrent.getFirstChild(curChild);
    while (tagChild != null) {
      String csChildName = tagChild.getName();
      if (csChildName.equalsIgnoreCase("ATTRB")) {
        String csVal = tagChild.getVal("Value");
        m_arrATTRB.addElement(csVal);
      } else if (csChildName.equalsIgnoreCase("JUSTIFY")) {
        String csVal = tagChild.getVal("Value");
        m_arrJustify.addElement(csVal);
      }
      tagChild = tagCurrent.getNextChild(curChild);
    }

    return this;
  }
Пример #7
0
 public boolean loadTagParameters(PosLineCol posLineCol, Tag tag, String csCurrentLanguage) {
   String csTagName = tag.getName();
   if (csTagName.equalsIgnoreCase("edit")) {
     return fillFromEdit(posLineCol, tag, csCurrentLanguage, "");
   } else if (csTagName.equalsIgnoreCase("label")) {
     boolean b = fillFromEdit(posLineCol, tag, csCurrentLanguage, ""); // "_LABEL");
     m_arrATTRB.addElement("ASKIP");
     m_arrATTRB.addElement("NORM");
     setName("");
     return b;
   } else if (csTagName.equalsIgnoreCase("title")) {
     boolean b = fillFromEdit(posLineCol, tag, csCurrentLanguage, "");
     while (m_Value.length() < m_Length) m_Value = m_Value + " ";
     m_arrATTRB.addElement("ASKIP");
     m_arrATTRB.addElement("NORM");
     return b;
   } else if (csTagName.equalsIgnoreCase("blank")) {
     return fillFromBlank(posLineCol, tag, csCurrentLanguage);
   } else if (csTagName.equalsIgnoreCase("switch") && !tag.isValExisting("additem")) {
     boolean b = fillFromSwitch(posLineCol, tag, csCurrentLanguage, "");
     return b;
   }
   return false;
 }
Пример #8
0
  private boolean fillFromEdit(
      PosLineCol posLineCol, Tag tag, String csCurrentLanguage, String csAppendColor) {
    String csColor = tag.getVal("color");
    m_Color = new CReservedConstant(null, csColor.toUpperCase() + csAppendColor);

    String csHighLight = tag.getVal("highlighting");
    m_HighLight = new CReservedConstant(null, csHighLight.toUpperCase());

    if (tag.isValExisting("namecopy")) {
      setName(tag.getVal("namecopy").toUpperCase().replace('_', '-'));
      m_csDisplayName = tag.getVal("name").toUpperCase();
    } else if (tag.isValExisting("name")) setName(tag.getVal("name").toUpperCase());
    else setName("");

    // int nSourceLine = tag.getValAsInt("sourceline");
    // setLine(nSourceLine);

    m_Length = tag.getValAsInt("length");

    m_PosLine = tag.getValAsInt("line");

    m_PosCol = tag.getValAsInt("col");

    posLineCol.setLineColLength(m_PosLine, m_PosCol, m_Length);

    m_Value = "";

    Tag tagTexts = tag.getChild("texts");
    if (tagTexts != null) {
      TagCursor curText = new TagCursor();
      Tag tagText = tagTexts.getFirstChild(curText, "text");
      while (tagText != null) {
        String csLanguage = tagText.getVal("lang");
        if (csLanguage.equalsIgnoreCase(csCurrentLanguage)) {
          m_Value = tagText.getText();
          break;
        }
        tagText = tagTexts.getNextChild(curText);
      }
    }

    String csJustify = tag.getVal("justify");
    if (csJustify.equalsIgnoreCase("right")) m_arrJustify.addElement(CBMSConstantList.RIGHT.m_Name);
    else if (csJustify.equalsIgnoreCase("left"))
      m_arrJustify.addElement(CBMSConstantList.LEFT.m_Name);

    String csFill = tag.getVal("fill");
    if (csFill.equalsIgnoreCase("blank")) m_arrJustify.addElement(CBMSConstantList.BLANK.m_Name);
    else if (csFill.equalsIgnoreCase("zero")) m_arrJustify.addElement(CBMSConstantList.ZERO.m_Name);

    String csProtection = tag.getVal("protection");
    manageAttrib(csProtection);

    String csIntensity = tag.getVal("intensity");
    manageAttrib(csIntensity);

    boolean bModified = tag.getValAsBoolean("modified");
    if (bModified) m_arrATTRB.addElement("FSET");

    boolean bCursor = tag.getValAsBoolean("cursor");
    if (bCursor) m_arrATTRB.addElement("IC");
    return true;
  }