How to show more than one image using active reports, Which control I have to use. I will bind images dynamically - activereports

I need to display multiple images dynamically, Please help me which control I have to use for this, and how to bind the images dnamically

You can use Picture Box control. for displaying Images dynamically you can write the following code in code behind
public Image GetImageObject(string imagename)
{
try
{
string _imagepath = D:\reports\Source\xyz\Images\+ imagename;
if (File.Exists( _imagepath)
{
return System.Drawing.Image.FromFile(_imagepath);
}
else
{
return null;
}
}
catch (Exception ex)
{
throw ex;
}
}
and then just create a object to your report, for Example your report Name is rptExample, suppose from BLL method,
rptExample orptExample=new rptExample();
orptExample.Logo=GetImageObject("Example.png");
orptExample.Run();
Hope this helps you.

Related

I need to print anchorPane in scenebuilder javafx

I'm creating customized TableViews and then i need to print them the way they look exactly, so i thought about taking like a screenshot for the AnchorPane itself then printing it, so is that possible anyways ? or what should i do exactly ?
You can place all the structures you need to print in a node for example anchorpane and then pass the anchorPane to this code,
FileChooser exportFileChooser = new FileChooser(); //The folder selector to save the pdf
exportFileChooser.setInitialDirectory(FileSystemView.getFileSystemView().getDefaultDirectory());
exportFileChooser.setInitialFileName(fileName);
File file = new File("temp/"+fileName+".png");
exportFileChooser.showSaveDialog(owner);
file.getParentFile().mkdirs();//crete temp directory if not available
final SnapshotParameters spa = new SnapshotParameters();
spa.setTransform(javafx.scene.transform.Transform.scale(0.71, 1.1));//Scaling only if required i.e., the screenshot is unable to fit in the page
WritableImage image = node.snapshot(spa, null);//This part takes the snapshot, here node is the anchorpane you sent
BufferedImage buffImage = SwingFXUtils.fromFXImage(image, null);
try {
ImageIO.write(buffImage, "png", file);//Writes the snapshot to file
} catch (Exception e) {
e.printStackTrace();
}

How to test scroll scenario using SELENIUM IDE

I'm totally a newbie in terms of using Selenium ide or any automation testing tool. Now i'm stuck with this scenario: after testing elements 1 & 2 on top of the page, i need to scroll down a bit to test the elements just below 1 & 2.
I've read something about using while and endWhile commands but you have to insert user-extension.js file first. [Link: http://www.software-testing-tutorials-automation.com/2013/09/how-to-generate-mouse-scrolling-event.html]. Problem is, it doesn't work. Any help guys? Thanks much!!
you can use javascript scroll down the page :
public void javaScriptToScrollDownPage(WebDriver driver, String coordinatevalue) throws KDTKeywordExecException {
try {
((JavascriptExecutor) driver).executeScript("scroll(0, " + coordinatevalue + ")");
} catch (Exception e) {
throw new KDTKeywordExecException("Not able to scroll down the page", e);
}
}
I have created as a function, can use this. You have to change the coordinate value ie how much you want to scroll down
Similarly for scrolling up:
public void javaScriptToScrollUpPage(WebDriver driver, String coordinatevalue) throws KDTKeywordExecException {
try {
((JavascriptExecutor) driver).executeScript("scroll(" + coordinatevalue + ",0)");
} catch (Exception e) {
throw new KDTKeywordExecException("Not able to scroll up the page", e);
}
}

Where to call an Action when user removes an uploaded image in GWTUpload?

I am using GWTUpload , the library is in here https://code.google.com/p/gwtupload/
The Example code at client side found on that website has this structure:
// Attach an image to the pictures viewer
private OnLoadPreloadedImageHandler showImage = new OnLoadPreloadedImageHandler() {
public void onLoad(PreloadedImage image) {
//showImageFlowPanel code solution 1
image.setWidth("75px");
showImageFlowPanel.add(image);
}
};
private IUploader.OnFinishUploaderHandler onFinishUploaderHandler = new IUploader.OnFinishUploaderHandler() {
public void onFinish(IUploader uploader) {
if (uploader.getStatus() == Status.SUCCESS) {
new PreloadedImage(uploader.fileUrl(), showImage);
UploadedInfo info = uploader.getServerInfo();
String headShotImageUrl="http://"+Window.Location.getHost()+"/" +"images/uploaded/"+info.message;
//headShotImage code solution 2
if(!"".equals(headShotImageUrl) && UriUtils.isSafeUri(headShotImageUrl)){
headShotImage.setUrl(UriUtils.fromString(headShotImageUrl));
}
}
}
};
The example uses showImageFlowPanel (solution 1) to store the image but I want to store the image inside headShotImage which take the url after user uploaded image successfully, see the headShotImage (solution 2) code above.
Ok, the headShotImage code work fine but I dont know how to remove it when users remove the image. If I use showImageFlowPanel as in the solution 1 then the program remove the image automatically for me and I do not need to do anything.
So my question is "Where to call an Action when user removes an uploaded image in GWTUpload?"
You have to use setOnCancelUploaderHandler. Take a look to this code took from the demo.
// When the user clicks a cancel button we get an event
uploader.addOnCancelUploadHandler (
new IUploader.OnCancelUploaderHandler() {
public void onCancel(IUploader uploader) {
for (String iname : uploader.getServerMessage().getUploadedFieldNames()) {
// loadedImages is an temporary table where we are adding all uploaded files
// indexed by field name
Widget w = loadedImages.get(iname);
if (w != null) {
w.removeFromParent();
loadedImages.remove(uploader.getInputName());
}
}
}
});

Form background color is still blank even when applying resource

I use a theme in a resource editor file inside the src folder to set a form's background color, but in runtime the form's background color is still blank ! Here is code :
public class Saisie extends Form implements ActionListener {
...
public Resources r;
public Hashtable tTheme;
...
public Saisie(MIDlet midlet)
{
super("Saisie situation");
try {
r = Resources.open("/resources.res");
tTheme = r.getTheme("Theme");
UIManager.getInstance().setThemeProps(tTheme);
} catch (IOException ex) {
}
...
}
...
}
Check that you set the bg transparency to 255. If you are making this change after creating the form make sure to refresh it.

Ajax Modal Popup Display Issue

On the web page, there is gridview control contains product ID's. bind to a link button.
On ItemCommand event of gridview, I fetch the product information and display in the ajax modal popup extender control. The popup is programatically show on ItemCommand of gridview and also hide programatically.
Now the problem is that, when i close popup after showing first product details and try to see next 1 by clicking on other product ID.., sometimes details are displaye dand sometimes not.
The data comes from database is fetched as well for each product.
Plz help.
I do the same but i have no such problem. So i am pasting code here that may b help full to u.
CODE:
protected void GVallusers_RowEditing(object sender, GridViewEditEventArgs e)
{
try
{
GridViewRow gvRow = ((GridView)sender).Rows[e.NewEditIndex];
populatepanel(gvRow);
ModalPopupExtender1.Show();
}
catch (Exception exc)
{
lblinfo.Text = exc.Message;
}
}
public void populatepanel(GridViewRow gvrow)
{
string userid = gvrow.Cells[0].Text;
lblSite.Text=gvrow.Cells[1].Text;
lblemail.Text = gvrow.Cells[3].Text;
}