use of de.janrufmonitor.util.io.IImageProvider in project janrufmonitor by tbrandt77.
the class ImageHandler method getImageStream.
public InputStream getImageStream(ICaller caller) {
Object provider = null;
IAttribute cm_att = caller.getAttribute(IJAMConst.ATTRIBUTE_NAME_CALLERMANAGER);
if (cm_att != null && cm_att.getValue().length() > 0) {
provider = (IImageProvider) this.m_providers.get(cm_att.getValue());
if (provider == null)
provider = (IImageProvider) this.m_providers.get("default");
if (provider instanceof IImageStreamProvider) {
if (this.m_logger.isLoggable(Level.INFO))
this.m_logger.info("Using IImageProvider <" + ((IImageProvider) provider).getID() + "> for getting image stream.");
InputStream in = ((IImageStreamProvider) provider).getImageInputStream(caller);
boolean isForceImage = Boolean.parseBoolean(System.getProperty(IJAMConst.SYSTEM_UI_FORCEIMAGE, "false"));
if (isForceImage) {
if (in != null)
return in;
} else {
return (in != null ? in : null);
}
}
}
return this.getImageStreamFromDefault(caller);
}
use of de.janrufmonitor.util.io.IImageProvider in project janrufmonitor by tbrandt77.
the class ImageHandler method hasImage.
public boolean hasImage(ICaller caller) {
IImageProvider provider = null;
IAttribute cm_att = caller.getAttribute(IJAMConst.ATTRIBUTE_NAME_CALLERMANAGER);
if (cm_att != null && cm_att.getValue().length() > 0) {
provider = (IImageProvider) this.m_providers.get(cm_att.getValue());
if (provider != null) {
if (this.m_logger.isLoggable(Level.INFO))
this.m_logger.info("Using IImageProvider <" + provider.getID() + "> for existance check.");
boolean isForceImage = Boolean.parseBoolean(System.getProperty(IJAMConst.SYSTEM_UI_FORCEIMAGE, "false"));
if (isForceImage) {
if (provider.hasImage(caller))
return true;
} else {
return provider.hasImage(caller);
}
}
}
return this.hasImageDefault(caller);
}
use of de.janrufmonitor.util.io.IImageProvider in project janrufmonitor by tbrandt77.
the class ImageHandler method getImagePath.
public String getImagePath(ICaller caller) {
IImageProvider provider = null;
String imagePath = null;
IAttribute cm_att = caller.getAttribute(IJAMConst.ATTRIBUTE_NAME_CALLERMANAGER);
if (cm_att != null && cm_att.getValue().length() > 0) {
provider = (IImageProvider) this.m_providers.get(cm_att.getValue());
if (provider != null) {
if (this.m_logger.isLoggable(Level.INFO))
this.m_logger.info("Using IImageProvider <" + provider.getID() + "> for getting image path.");
imagePath = provider.getImagePath(caller);
boolean isForceImage = Boolean.parseBoolean(System.getProperty(IJAMConst.SYSTEM_UI_FORCEIMAGE, "false"));
if (isForceImage) {
if (imagePath != null && imagePath.length() > 0)
return imagePath;
} else {
return ((imagePath != null && imagePath.length() > 0) ? imagePath : "");
}
}
}
return getImagePathDefault(caller);
}
use of de.janrufmonitor.util.io.IImageProvider in project janrufmonitor by tbrandt77.
the class ImageHandler method getImage.
public File getImage(ICaller caller) {
IImageProvider provider = null;
File image = null;
IAttribute cm_att = caller.getAttribute(IJAMConst.ATTRIBUTE_NAME_CALLERMANAGER);
if (cm_att != null && cm_att.getValue().length() > 0) {
provider = (IImageProvider) this.m_providers.get(cm_att.getValue());
if (provider != null) {
if (this.m_logger.isLoggable(Level.INFO))
this.m_logger.info("Using IImageProvider <" + provider.getID() + "> for getting image file.");
image = provider.getImage(caller);
boolean isForceImage = Boolean.parseBoolean(System.getProperty(IJAMConst.SYSTEM_UI_FORCEIMAGE, "false"));
if (isForceImage) {
if (image != null && image.exists())
return image;
} else {
return ((image != null && image.exists()) ? image : null);
}
}
}
return this.getImageDefault(caller);
}
Aggregations