on 04-21-2006 7:14 AM
I am creating an image at run time (a bar code). How do I display this?
To test a static image I placed the bar code image in the src/mimes/components/packages directory, then compiled that application and it worked perfectly.
I then created the bar code image at run time and wrote it to the same src/mimes/components/packages directory as above. The file was succesfully placed there, but the application does not display the image. If the application is then recompiled with a a hard coded value of the previous bar code in the getImageImageSource method it works.
I'm guessing that the run time repository for images is different to the design time one; is this is the case where should I be writing the image file and what should I return from the getImageImageSource method?
Nigel
Hello
How we can increase the cache time of the image.
The images are getting disapper after 2 min of time.
regards
John
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hallo Nigel,
you can apply the Web Dynpro Binary Cache. Just store URL of the cached resource within a context attribute and bind the image url to this attribute.
Implement the following coding:
//@@begin javadoc:wdDoInit()
/** Hook method called to initialize controller. */
//@@end
public void wdDoInit()
{
//@@begin wdDoInit()
wdContext.currentContextElement().setImgVisibility(WDVisibility.NONE);
// Modify datatype, propare datatype for modifications done by the runtime
wdContext.getNodeInfo().getAttribute("File").getModifiableSimpleType();
//@@end
}
//@@begin javadoc:onActionUpload(ServerEvent)
/** Declared validating event handler. */
//@@end
public void onActionUpload(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionUpload(ServerEvent)
IWDCachedWebResource cachedResource = null;
String imgUrl = null;
WDWebResourceType type =
((IWDModifiableBinaryType) wdContext.getNodeInfo().getAttribute("File").getModifiableSimpleType())
.getMimeType();
byte[] file = wdContext.currentContextElement().getFile();
if (file != null) {
cachedResource = WDWebResource.getWebResource(file, type);
try {
imgUrl = cachedResource.getURL();
wdContext.currentContextElement().setUrl(imgUrl);
wdContext.currentContextElement().setImgVisibility(WDVisibility.VISIBLE);
} catch (WDURLException e) {
wdComponentAPI.getMessageManager().reportException(e.getLocalizedMessage(), true);
}
}
//@@end
}
Regards, Bertram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.