This example highlights a couple of possible bugs. First the height of the DrawLabel seems to extend indefinitely. Secondly the fill color does not work.
This code example contains a drawlabel. On mouse over it changes font color and size. And on mouse out it restores it. Notice that when you mouse over below (all the way to the end of the drawpane) the label it still gets the mouseover event. Is this a bug? Is there a way to set height, width of a drawlabel?
I tried this with nightly builds of 3.1p and 4.1. And on IE 11 and Firefox 23.
This code example contains a drawlabel. On mouse over it changes font color and size. And on mouse out it restores it. Notice that when you mouse over below (all the way to the end of the drawpane) the label it still gets the mouseover event. Is this a bug? Is there a way to set height, width of a drawlabel?
I tried this with nightly builds of 3.1p and 4.1. And on IE 11 and Firefox 23.
Code:
import com.google.gwt.core.client.EntryPoint;
import com.smartgwt.client.types.Cursor;
import com.smartgwt.client.widgets.drawing.DrawLabel;
import com.smartgwt.client.widgets.drawing.DrawPane;
import com.smartgwt.client.widgets.drawing.events.MouseOutEvent;
import com.smartgwt.client.widgets.drawing.events.MouseOutHandler;
import com.smartgwt.client.widgets.drawing.events.MouseOverEvent;
import com.smartgwt.client.widgets.drawing.events.MouseOverHandler;
public class TestDrawRect implements EntryPoint {
@Override
public void onModuleLoad() {
DrawPane dp = new DrawPane();
dp.setWidth(500);
dp.setHeight(300);
dp.setBorder("1px solid black");
dp.setCursor(Cursor.ARROW);
dp.setTop(100);
dp.setLeft(100);
final DrawLabel dl = new DrawLabel();
dl.setDrawPane(dp);
dl.setContents("this is a DrawLabel");
dl.setFillColor("#0f0"); // this has no effect
dl.setLeft(50);
dl.setTop(50);
dl.setAttribute("fontSize", "11", true);
dl.setAttribute("fontWeight", "normal", true);
dl.setLineColor("#747");
dl.addMouseOverHandler(new MouseOverHandler() {
@Override
public void onMouseOver(MouseOverEvent event) {
dl.setAttribute("fontSize", "13", true);
dl.setAttribute("fontWeight", "bold", true);
dl.setLineColor("#00f"); }
});
dl.addMouseOutHandler(new MouseOutHandler() {
@Override
public void onMouseOut(MouseOutEvent event) {
dl.setAttribute("fontSize", "11", true);
dl.setAttribute("fontWeight", "normal", true);
dl.setLineColor("#747");
}
});
dp.draw();
dl.draw();
}
}