Show LoadProjectElement.java syntax highlighted
package ucalgary.ebe.webui.client.ui;
import java.util.Vector;
import ucalgary.ebe.webui.client.WebUI2ServiceConnection;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.ListBox;
import com.google.gwt.user.client.ui.Widget;
public class LoadProjectElement extends Grid implements ClickListener {
WebUI2ServiceConnection con;
ListBox lb;
public LoadProjectElement(WebUI2ServiceConnection con, Vector names) {
super(1, 2);
this.con = con;
this.lb = new ListBox();
for(int i = 0; i < names.size(); i++) {
lb.addItem((String)names.get(i));
}
lb.setVisibleItemCount(1);
lb.addStyleName("webui-ListBox");
this.setWidget(0, 0, lb);
ImageButton load_button = new ImageButton("images/load.gif", "Load", this);
this.setWidget(0, 1, load_button);
this.addStyleName("webui-LoadProjectElement");
this.lb.setSelectedIndex(0);
con.loadProject(lb.getItemText(0));
}
public WebUI2ServiceConnection getConnection() {
return this.con;
}
public void onClick(Widget sender) {
con.loadProject(lb.getItemText(lb.getSelectedIndex()));
}
}
See more files for this project here