示例#1
0
 protected Icon findUsableIcon(Device device) {
   // Needs to be certain format and size
   for (Object o : device.getIcons()) {
     Icon icon = (Icon) o;
     if (icon.getWidth() <= 64 && icon.getHeight() <= 64 && isUsableImageType(icon.getMimeType()))
       return icon;
   }
   return null;
 }
 public static String getDeviceIcon(Device d, int maxHeight) {
   URL base = getURL(d);
   Icon icon = null;
   String url = null;
   int maxH = maxHeight == 0 ? 99999 : maxHeight, height = 0;
   for (Icon i : d.getIcons()) {
     int h = i.getHeight();
     if (h < maxH && h > height) {
       icon = i;
       height = h;
     }
   }
   try {
     url = icon != null ? new URL(base, icon.getUri().toString()).toString() : null;
   } catch (Exception e) {
   }
   LOGGER.debug("Device icon: " + url);
   return url;
 }
示例#3
0
 @Override
 public int getHeight() {
   return icon.getHeight();
 }