コード例 #1
0
  /**
   * Creates a single Style from the passed in styles. The passed in List is reverse sorted, that is
   * the most recently added style found to match will be first.
   */
  private SynthStyle mergeStyles(java.util.List styles) {
    int size = styles.size();

    if (size == 0) {
      return null;
    } else if (size == 1) {
      return (SynthStyle) ((DefaultSynthStyle) styles.get(0)).clone();
    }
    // NOTE: merging is done backwards as DefaultSynthStyleFactory reverses
    // order, that is, the most specific style is first.
    DefaultSynthStyle style = (DefaultSynthStyle) styles.get(size - 1);

    style = (DefaultSynthStyle) style.clone();
    for (int counter = size - 2; counter >= 0; counter--) {
      style = ((DefaultSynthStyle) styles.get(counter)).addTo(style);
    }
    return style;
  }
コード例 #2
0
 /** Returns the cached style from the passed in arguments. */
 private SynthStyle getCachedStyle(java.util.List styles) {
   if (styles.size() == 0) {
     return null;
   }
   return (SynthStyle) _resolvedStyles.get(styles);
 }