コード例 #1
0
  public IIOMetadataNode buildTableDisplay(Settings settings) {
    IIOMetadataNode tableDisplay = new IIOMetadataNode("tabledisplay");

    // font
    IIOMetadataNode font = new IIOMetadataNode("font");
    font.setAttribute("face", settings.getTableFont().getName());
    font.setAttribute("size", settings.getTableFont().getSize() + "");
    font.setAttribute("decoration", settings.getTableFont().getStyle() + "");
    tableDisplay.appendChild(font);

    // table cell size
    IIOMetadataNode cellSize = new IIOMetadataNode("cellsize");
    cellSize.setAttribute("height", ((int) settings.getCellSize().getHeight()) + "");
    cellSize.setAttribute("width", ((int) settings.getCellSize().getWidth()) + "");
    tableDisplay.appendChild(cellSize);

    // colors
    IIOMetadataNode colors = new IIOMetadataNode("colors");
    // max
    IIOMetadataNode max = new IIOMetadataNode("max");
    max.setAttribute("r", settings.getMaxColor().getRed() + "");
    max.setAttribute("g", settings.getMaxColor().getGreen() + "");
    max.setAttribute("b", settings.getMaxColor().getBlue() + "");
    colors.appendChild(max);
    // min
    IIOMetadataNode min = new IIOMetadataNode("min");
    min.setAttribute("r", settings.getMinColor().getRed() + "");
    min.setAttribute("g", settings.getMinColor().getGreen() + "");
    min.setAttribute("b", settings.getMinColor().getBlue() + "");
    colors.appendChild(min);
    // highlight
    IIOMetadataNode highlight = new IIOMetadataNode("highlight");
    highlight.setAttribute("r", settings.getHighlightColor().getRed() + "");
    highlight.setAttribute("g", settings.getHighlightColor().getGreen() + "");
    highlight.setAttribute("b", settings.getHighlightColor().getBlue() + "");
    colors.appendChild(highlight);
    // increased cell border
    IIOMetadataNode increaseBorder = new IIOMetadataNode("increaseborder");
    increaseBorder.setAttribute("r", settings.getIncreaseBorder().getRed() + "");
    increaseBorder.setAttribute("g", settings.getIncreaseBorder().getGreen() + "");
    increaseBorder.setAttribute("b", settings.getIncreaseBorder().getBlue() + "");
    colors.appendChild(increaseBorder);
    // decreased cell border
    IIOMetadataNode decreaseBorder = new IIOMetadataNode("decreaseborder");
    decreaseBorder.setAttribute("r", settings.getDecreaseBorder().getRed() + "");
    decreaseBorder.setAttribute("g", settings.getDecreaseBorder().getGreen() + "");
    decreaseBorder.setAttribute("b", settings.getDecreaseBorder().getBlue() + "");
    colors.appendChild(decreaseBorder);
    // axis cells
    IIOMetadataNode axis = new IIOMetadataNode("axis");
    axis.setAttribute("r", settings.getAxisColor().getRed() + "");
    axis.setAttribute("g", settings.getAxisColor().getGreen() + "");
    axis.setAttribute("b", settings.getAxisColor().getBlue() + "");
    colors.appendChild(axis);

    tableDisplay.appendChild(colors);

    return tableDisplay;
  }