コード例 #1
0
ファイル: CPNColor.java プロジェクト: code-d/oryx-editor
  private void addList(JSONObject modelElement) throws JSONException {
    // An entry like the following is expected:
    // list Name (Name is previously defined Colorsets)
    String[] declarationDataTypeSegments = modelElement.getString("type").split(" ");

    // When this method is called, we know that the first word is list.
    // But if there is only element in declarationDataTypeSegments, then it must be the word list.
    if (declarationDataTypeSegments.length < 2) return;

    CPNList tempList = new CPNList();

    String listType = declarationDataTypeSegments[1];
    tempList.setId(listType);

    setListtag(tempList);

    String layoutText = tempList.getLayoutText(modelElement);
    setLayout(layoutText);
  }
コード例 #2
0
ファイル: CPNColor.java プロジェクト: code-d/oryx-editor
  public static void registerMapping(XStream xstream) {
    xstream.alias("color", CPNColor.class);

    xstream.aliasField("ml", CPNColor.class, "mltag");
    xstream.aliasField("alias", CPNColor.class, "alias");
    xstream.aliasField("id", CPNColor.class, "idattri");
    xstream.aliasField("id", CPNColor.class, "idtag");
    xstream.aliasField("bool", CPNColor.class, "booleantag");
    xstream.aliasField("string", CPNColor.class, "stringtag");
    xstream.aliasField("int", CPNColor.class, "integertag");
    xstream.aliasField("product", CPNColor.class, "producttag");
    xstream.aliasField("list", CPNColor.class, "listtag");
    xstream.aliasField("unit", CPNColor.class, "unittag");

    xstream.useAttributeFor(CPNColor.class, "idattri");

    CPNString.registerMapping(xstream);
    CPNProduct.registerMapping(xstream);
    CPNBoolean.registerMapping(xstream);
    CPNInteger.registerMapping(xstream);
    CPNList.registerMapping(xstream);
    CPNUnit.registerMapping(xstream);
  }