Here is the code :
Anchor anchor =new Anchor();
final Image image = new Image("../resources/images/pdf.png");
anchor.addMouseOverHandler(new MouseOverHandler() {
@Override
public void onMouseOver(MouseOverEvent event) {
DOM.setStyleAttribute(image.getElement(), "cursor", "pointer");
}
});
anchor.addMouseOutHandler(new MouseOutHandler() {
@Override
public void onMouseOut(MouseOutEvent event) {
DOM.setStyleAttribute(image.getElement(), "cursor", "default");
}
});
anchor.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
String url="upload/" + model.get(property).toString();
Window.open(url, "_blank", "");
Info.display("Hardware", "Show Datasheet");
}
});
anchor.getElement().appendChild(image.getElement());
return anchor;
0 comments:
Post a Comment