Show MoveStoryCardElement.java syntax highlighted
package ucalgary.ebe.webui.client.ui;
import java.util.Vector;
import ucalgary.ebe.webui.client.WebUI2ServiceConnection;
import ucalgary.ebe.webui.client.data.StoryCardWeb;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.Widget;
public class MoveStoryCardElement extends Grid {
private WebUI2ServiceConnection con;
private StoryCardParentListBox lb;
private ImageButton ib;
private ProjectWhiteBoard whiteboard;
public MoveStoryCardElement(WebUI2ServiceConnection con, ProjectWhiteBoard whiteboard) {
super(1,2);
this.con = con;
this.whiteboard = whiteboard;
this.lb = new StoryCardParentListBox(con);
this.setWidget(0, 0, this.lb);
//TODO give it a proper icon
this.ib = new ImageButton("images/movetoparent.gif", "Move", new ClickListener() {
public void onClick(Widget sender) {
Vector sc_ids = getWhiteBoard().getCheckedStoryCardIDs();
if(!sc_ids.isEmpty()) {
for(int i = 0; i < sc_ids.size(); i++) {
StoryCardWeb storycard = getConnection().findStoryCardById(((Long)sc_ids.get(i)).longValue());
getConnection().moveStoryCardToNewParent(storycard.getId(), storycard.getParent(), getNewParentId());
}
}
}
});
this.setWidget(0, 1, this.ib);
this.addStyleName("webui-MoveStoryCardElement");
}
public ProjectWhiteBoard getWhiteBoard() {
return this.whiteboard;
}
public WebUI2ServiceConnection getConnection() {
return this.con;
}
public long getNewParentId() {
if(this.lb.getSelectedIndex() == -1) {
return (new Long(this.lb.getValue(0))).longValue();
} else {
return (new Long(this.lb.getValue(this.lb.getSelectedIndex()))).longValue();
}
}
}
See more files for this project here