Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

Drawing API: Double to Int casting warning

$
0
0
Hi There,

I'm just cleaning up some code and I've noticed a large number of warning log entries as shown:
[WARN] [app] - Something other than an int was returned from JSNI method '@com.smartgwt.client.util.JSOHelper::getIntArrayV alue(Lcom/google/gwt/core/client/JavaScriptObject;I)': Rounding double (130.28333282470703) to int for int

This appears to be an issue with DrawItem.getBoundingBox, and DrawLabel. It also appears to be a long-standing problem with SmartGWT.

The following simplified code reproduces the issue:
Code:

public class TestDrawingIssues extends Window { 
 
    public TestDrawingIssues() { 
           
            setTitle("Test");
            setWidth100();
            setHeight100();
                       
        final DrawPane drawPane = new DrawPane(); 
        drawPane.setHeight(200); 
        drawPane.setWidth(200); 
        drawPane.setLeft(25); 
        drawPane.setShowEdges(true); 
        drawPane.setEdgeSize(4); 
        drawPane.setBackgroundColor("papayawhip"); 
        drawPane.setOverflow(Overflow.HIDDEN); 
        drawPane.setCursor(Cursor.AUTO); 
                 
        Button redrawButton = new Button();
        redrawButton.setTitle("Draw Label");
        redrawButton.addClickHandler(new ClickHandler() {
                        @Override
                        public void onClick(ClickEvent event) {
                                drawPane.destroyItems();
                               
                                // Add another Label.
                                DrawLabel testLabel = new DrawLabel(); 
                        testLabel.setDrawPane(drawPane); 
                        testLabel.setLeft(50); 
                        testLabel.setTop(50); 
                        testLabel.setContents("My Label"); 
                                testLabel.draw();
                               
                                System.out.println(
                                        testLabel.getBoundingBox()[0] + "," +
                                testLabel.getBoundingBox()[1] + "," +
                                testLabel.getBoundingBox()[2] + "," +
                                testLabel.getBoundingBox()[3]
                        );
                       
                                drawPane.markForRedraw();
                        }
        });
         
        addItem(drawPane);
        addItem(redrawButton);
        show();
    } 
 
}

Re-verified with the latest nightly of SmartGWT Pro 4.0.

Thanks for your assistance,

Nick

Viewing all articles
Browse latest Browse all 4756

Trending Articles