import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.Window;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.DragAppearance;
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.Img;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.VLayout;

public class TestCase implements EntryPoint {
    public void onModuleLoad() {
	final String url = "file://///Ahmad_Igbariya/SharedDocs/err.JPG";
        final Canvas popUp = new Canvas();
        popUp.setOverflow(Overflow.HIDDEN);
        popUp.setBorder("1px solid #6a6a6a");
        popUp.setBackgroundColor("#C3D9FF");
        popUp.setCanDragReposition(true);
        popUp.setCanDragResize(false);
        popUp.setDragAppearance(DragAppearance.TARGET);
        popUp.setSmoothFade(true);
        Img errImg = new Img(url);
        errImg.setWidth(590);
        errImg.setLeft(5);
        errImg.setTop(5);
        errImg.setHeight(500);

        IButton enlarge = new IButton("Open in a new window");
        enlarge.setAutoFit(true);
        enlarge.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                popUp.destroy();
                Window.open(url, "", "");
            }
        });
        IButton close = new IButton("Close");
        close.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                popUp.destroy();
            }
        });

        VLayout l1 = new VLayout(5);
        l1.setHeight100();
        l1.setWidth100();
        l1.setAlign(Alignment.CENTER);
        HLayout l2 = new HLayout(10);
        l2.setHeight100();
        l2.setWidth100();
        l2.setAlign(Alignment.CENTER);
        l2.addMember(enlarge);
        l2.addMember(close);
        l1.addMember(errImg);
        l1.addMember(l2);
        popUp.addChild(l1);

        popUp.setLeft(Window.getClientWidth() / 2);
        popUp.setTop(Window.getClientHeight() / 2);
        popUp.setWidth(50);
        popUp.setHeight(50);
        popUp.animateRect(Window.getClientWidth() / 2 - 300, Window.getClientHeight() / 2 - 300, 600, 530, null, 1000);
        popUp.draw();
    }
}