@Override
 public MultiDouble getSplittedValue(IRow row) {
   if (cacheMulti.containsKey(row.getIndex())) return (MultiDouble) cacheMulti.get(row.getIndex());
   double[] s = new double[this.size()];
   for (int i = 0; i < s.length; ++i) {
     s[i] = ((IDoubleRankableColumnMixin) get(i)).applyPrimitive(row);
   }
   MultiDouble f = new MultiDouble(-1, s);
   cacheMulti.put(row.getIndex(), f);
   return f;
 }
Exemple #2
0
 private Font abspathImpl(final String fname, final int family, final int style)
     throws IOException {
   final InputStream stream;
   if (useTempJARCache) {
     final Exception[] privErr = {null};
     stream =
         AccessController.doPrivileged(
             new PrivilegedAction<InputStream>() {
               @Override
               public InputStream run() {
                 try {
                   final Uri uri = TempJarCache.getResourceUri(fname);
                   return null != uri ? uri.toURL().openConnection().getInputStream() : null;
                 } catch (final Exception e) {
                   privErr[0] = e;
                   return null;
                 }
               }
             });
     if (null != privErr[0]) {
       throw new IOException(privErr[0]);
     }
   } else {
     final URLConnection urlConn = IOUtil.getResource(UbuntuFontLoader.class, fname);
     stream = null != urlConn ? urlConn.getInputStream() : null;
   }
   if (null != stream) {
     final Font f = FontFactory.get(stream, true);
     if (null != f) {
       fontMap.put((family << 8) | style, f);
       return f;
     }
   }
   return null;
 }
 /** sorts the children decreasing by their weight */
 public void sortByWeights() {
   cacheMulti.clear();
   sortBy(
       new Comparator<ARankColumnModel>() {
         @Override
         public int compare(ARankColumnModel o1, ARankColumnModel o2) {
           // return -Float.compare((float) o1.getParentData(), (float) o2.getParentData());
           return Float.compare((float) o2.getParentData(), (float) o1.getParentData());
         }
       });
 }
 @Override
 protected void init(ARankColumnModel model) {
   super.init(model);
   model.addPropertyChangeListener(PROP_WIDTH, listener);
   model.addPropertyChangeListener(IFilterColumnMixin.PROP_FILTER, listener);
   model.addPropertyChangeListener(IMappedColumnMixin.PROP_MAPPING, listener);
   // addDirectWeight(model.getWeight());
   cacheMulti.clear();
   float oldWidth = size() == 1 ? (getSpaces() - RenderStyle.COLUMN_SPACE) : width;
   super.setWidth(oldWidth + model.getWidth() + RenderStyle.COLUMN_SPACE);
   model.setParentData(model.getWidth());
 }
 @Override
 protected void takeDown(ARankColumnModel model) {
   super.takeDown(model);
   model.removePropertyChangeListener(PROP_WIDTH, listener);
   model.removePropertyChangeListener(IFilterColumnMixin.PROP_FILTER, listener);
   model.removePropertyChangeListener(IMappedColumnMixin.PROP_MAPPING, listener);
   // addDirectWeight(-model.getWeight());
   if (alignmentDetails > size() - 2) {
     setAlignment(alignmentDetails - 1);
   }
   super.setWidth(width - model.getWidth() - RenderStyle.COLUMN_SPACE);
   model.setParentData(null);
   cacheMulti.clear();
 }
Exemple #6
0
  @Override
  public Font get(final int family, final int style) throws IOException {
    Font font = (Font) fontMap.get((family << 8) | style);
    if (font != null) {
      return font;
    }

    switch (family) {
      case FAMILY_MONOSPACED:
      case FAMILY_CONDENSED:
      case FAMILY_REGULAR:
        if (is(style, STYLE_BOLD)) {
          if (is(style, STYLE_ITALIC)) {
            font = abspath(availableFontFileNames[3], family, style);
          } else {
            font = abspath(availableFontFileNames[2], family, style);
          }
        } else if (is(style, STYLE_ITALIC)) {
          font = abspath(availableFontFileNames[1], family, style);
        } else {
          font = abspath(availableFontFileNames[0], family, style);
        }
        break;

      case FAMILY_LIGHT:
        if (is(style, STYLE_ITALIC)) {
          font = abspath(availableFontFileNames[5], family, style);
        } else {
          font = abspath(availableFontFileNames[4], family, style);
        }
        break;

      case FAMILY_MEDIUM:
        if (is(style, STYLE_ITALIC)) {
          font = abspath(availableFontFileNames[6], family, style);
        } else {
          font = abspath(availableFontFileNames[7], family, style);
        }
        break;
    }

    return font;
  }
 @Override
 protected void moved(int from, int to) {
   cacheMulti.clear();
   super.moved(from, to);
 }