use of de.janrufmonitor.framework.IAttribute in project janrufmonitor by tbrandt77.
the class CallActive method renderAsImage.
public Image renderAsImage() {
if (this.m_o != null) {
if (this.m_o instanceof ICall) {
ICall call = (ICall) this.m_o;
IAttribute isCallActive = call.getAttribute(IJAMConst.ATTRIBUTE_NAME_CALL_ACTIVE_INDICATOR);
if (isCallActive != null && isCallActive.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_YES)) {
IAttribute att = call.getAttribute(IJAMConst.ATTRIBUTE_NAME_CALLSTATUS);
if (att != null && att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_ACCEPTED)) {
return SWTImageManager.getInstance(PIMRuntime.getInstance()).get(IJAMConst.IMAGE_KEY_CALL_IN_ACTIVE_PNG);
}
if (att != null && att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_OUTGOING)) {
return SWTImageManager.getInstance(PIMRuntime.getInstance()).get(IJAMConst.IMAGE_KEY_CALL_OUT_ACTIVE_PNG);
}
}
if (isCallActive != null && isCallActive.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_NO)) {
IAttribute att = call.getAttribute(IJAMConst.ATTRIBUTE_NAME_CALL_DURATION);
if (att != null && att.getValue().length() > 0) {
try {
long duration_in_sec = Long.parseLong(att.getValue());
long start = call.getDate().getTime() / 1000;
long now = new java.util.Date().getTime() / 1000;
long passedTime = now - (start + duration_in_sec);
if (passedTime < 300) {
return SWTImageManager.getInstance(PIMRuntime.getInstance()).get(IJAMConst.IMAGE_KEY_CALL_END_5MIN_PNG);
}
} catch (Exception e) {
}
}
}
}
}
return null;
}
use of de.janrufmonitor.framework.IAttribute in project janrufmonitor by tbrandt77.
the class BChannel method renderAsImage.
public Image renderAsImage() {
if (this.m_o != null) {
if (this.m_o instanceof ICall) {
ICall call = (ICall) this.m_o;
IAttribute att = call.getAttribute(IJAMConst.ATTRIBUTE_NAME_BCHANNEL);
if (att != null) {
if (att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_B1))
return SWTImageManager.getInstance(PIMRuntime.getInstance()).get(IJAMConst.IMAGE_KEY_B1_JPG);
if (att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_B2))
return SWTImageManager.getInstance(PIMRuntime.getInstance()).get(IJAMConst.IMAGE_KEY_B2_JPG);
}
}
}
return null;
}
use of de.janrufmonitor.framework.IAttribute in project janrufmonitor by tbrandt77.
the class CallDuration method getDuration.
private String getDuration(ICall call) {
IAttribute ring = call.getAttribute(IJAMConst.ATTRIBUTE_NAME_CALL_DURATION);
if (ring != null) {
try {
int duration = Integer.parseInt(ring.getValue()) / 60;
StringBuffer sb = new StringBuffer(64);
if ((duration / 60) > 0) {
sb.append((duration / 60));
sb.append(" h ");
}
sb.append((duration % 60));
sb.append(" min ");
return sb.toString();
} catch (Exception e) {
}
}
return "";
}
use of de.janrufmonitor.framework.IAttribute in project janrufmonitor by tbrandt77.
the class Status method renderAsImageID.
public String renderAsImageID() {
if (this.m_o != null) {
if (this.m_o instanceof ICall) {
ICall call = (ICall) this.m_o;
IAttribute att = call.getAttribute(IJAMConst.ATTRIBUTE_NAME_CALLSTATUS);
if (att != null && att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_REJECTED)) {
return IJAMConst.IMAGE_KEY_REJECTED_GIF;
}
// att = call.getAttribute(IJAMConst.ATTRIBUTE_NAME_CALLSTATUS);
if (att != null && att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_ACCEPTED)) {
return IJAMConst.IMAGE_KEY_ACCEPTED_GIF;
}
// att = call.getAttribute(IJAMConst.ATTRIBUTE_NAME_CALLSTATUS);
if (att != null && att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_OUTGOING)) {
return IJAMConst.IMAGE_KEY_OUTGOING_GIF;
}
if (att != null && att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_MISSED)) {
return IJAMConst.IMAGE_KEY_AWAY_GIF;
}
/**
* // 2008/11/08: work-a-round for showing old status fields
* att = call.getAttribute(IJAMConst.ATTRIBUTE_NAME_REJECTED);
* if (att != null && att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_YES)) {
* return IJAMConst.IMAGE_KEY_REJECTED_GIF;
* }
* att = call.getAttribute(IJAMConst.ATTRIBUTE_NAME_ACCEPTED);
* if (att != null && att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_YES)) {
* return IJAMConst.IMAGE_KEY_ACCEPTED_GIF;
* }
* att = call.getAttribute(IJAMConst.ATTRIBUTE_NAME_OUTGOING);
* if (att != null && att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_YES)) {
* return IJAMConst.IMAGE_KEY_OUTGOING_GIF;
* }
*/
return IJAMConst.IMAGE_KEY_AWAY_GIF;
}
}
return "";
}
use of de.janrufmonitor.framework.IAttribute 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);
}
Aggregations