package org.bbop.apollo.gwt.client;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.*;

/**
 * Created by ndunn on 4/8/15.
 */
public class UrlDialogBox extends DialogBox{

    private VerticalPanel panel = new VerticalPanel();
    private HorizontalPanel buttonPanel = new HorizontalPanel();
    private Anchor urlView = new Anchor();
    private Button closeButton = new Button("OK");

    public UrlDialogBox(String url){

        buttonPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        buttonPanel.setCellHorizontalAlignment(closeButton,HasHorizontalAlignment.ALIGN_CENTER);
        buttonPanel.setWidth("100%");

        urlView.setHref(url);
        urlView.setHTML(url);

        panel.add(urlView);
        panel.add(buttonPanel);
        buttonPanel.add(closeButton);
        panel.add(buttonPanel);

        closeButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                hide();
            }
        });

        setWidget(panel);
    }
}

@@ -392,22 +392,24 @@
 private 
-Anchor
+TextArea
  urlView
@@ -419,14 +419,16 @@
 new 
-Anchor
+TextArea
 ();%0A
@@ -757,16 +757,61 @@
 .set
-Href(url
+CharacterWidth(100);%0A        urlView.setEnabled(false
 );%0A 
@@ -832,12 +832,12 @@
 .set
-HTML
+Text
 (url

set the proper width of the dialog box