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

import org.gwtbootstrap3.client.ui.Button;
import org.gwtbootstrap3.client.ui.constants.ButtonSize;
import org.sagebionetworks.web.client.widget.SynapseWidgetPresenter;

import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.IsTreeItem;
import com.google.gwt.user.client.ui.TreeItem;
import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;

public class MoreTreeItem implements IsTreeItem, SynapseWidgetPresenter {

	public Button widget;
	public TreeItem treeItem;
	public MORE_TYPE type;
	ClickHandler handler;
	
	public enum MORE_TYPE {
		FOLDER("More folders"), FILE("More files");
		
		String innerText;
		
		MORE_TYPE(String moreText) {
			innerText = moreText;
		}
	}
	
	@Inject
	public MoreTreeItem() { 
		this.widget = new Button();
		treeItem = new TreeItem(asWidget());
		widget.setSize(ButtonSize.EXTRA_SMALL);
	}
	
	public void configure(MORE_TYPE type) {
		this.type = type;
		this.widget.setText(type.innerText);
	}

	public Button asButton() {
		return widget;
	}
	
	@Override
	public Widget asWidget() {
		return widget;
	}

	@Override
	public TreeItem asTreeItem() {
		return treeItem;
	}
	
	public void setClickHandler(ClickHandler handler) {
		this.widget.addClickHandler(handler);
	}
	
	public void setVisible(boolean b) {
		treeItem.setVisible(b);
	}	
}

@@ -148,16 +148,242 @@
 onSize;%0A
+import org.gwtbootstrap3.client.ui.constants.ButtonType;%0Aimport org.gwtbootstrap3.client.ui.constants.IconPosition;%0Aimport org.gwtbootstrap3.client.ui.constants.IconSize;%0Aimport org.gwtbootstrap3.client.ui.constants.IconType;%0A
 import o
@@ -443,16 +443,16 @@
 senter;%0A
-
 %0Aimport 
@@ -881,17 +881,22 @@
 FOLDER(%22
-M
+Show m
 ore fold
@@ -908,17 +908,22 @@
 , FILE(%22
-M
+Show m
 ore file
@@ -1154,19 +1154,171 @@
 ize.
-EXTRA_SMALL
+SMALL);%0A%09%09widget.setType(ButtonType.INFO);%0A%09%09widget.setIcon(IconType.ELLIPSIS_H);%0A%09%09widget.setIconSize(IconSize.LARGE);%0A%09%09widget.setIconPosition(IconPosition.RIGHT
 );%0A%09

make more button bigger and do a better job at explaining the associated action