package org.sagebionetworks.web.client.widget.entity.file;

import org.gwtbootstrap3.client.ui.constants.Placement;
import org.sagebionetworks.web.client.DisplayUtils;
import org.sagebionetworks.web.client.widget.CopyTextModal;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.inject.Inject;

public class Md5Link extends SimplePanel {
	CopyTextModal copyTextModal;
	@Inject
	public Md5Link(CopyTextModal modal) {
		addStyleName("inline-block font-italic");
		this.copyTextModal = modal;
		copyTextModal.setTitle("md5:");
	}
	
	public void configure(final String md5) {
		this.clear();
		Anchor md5Link = new Anchor("md5");
		md5Link.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				showMd5Dialog(md5);
			}
		});
		DisplayUtils.addTooltip(md5Link, md5, Placement.BOTTOM);
		this.add(md5Link);
		this.add(copyTextModal.asWidget());
	}
	
	private void showMd5Dialog(String md5) {
		copyTextModal.setText(md5);
		copyTextModal.show();
	}
}

@@ -408,22 +408,20 @@
 ient.ui.
-Simple
+Flow
 Panel;%0Ai
@@ -486,14 +486,12 @@
 nds 
-Simple
+Flow
 Pane
@@ -576,52 +576,8 @@
 ) %7B%0A
-%09%09addStyleName(%22inline-block font-italic%22);%0A
 %09%09th
@@ -700,16 +700,16 @@
 lear();%0A
-
 %09%09Anchor
@@ -738,16 +738,68 @@
 %22md5%22);%0A
+%09%09md5Link.addStyleName(%22inline-block font-italic%22);%0A
 %09%09md5Lin

fix md5 copy text modal