Show CreateStoryCardDialogBox.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.Button;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.FocusListener;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.ListBox;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TextArea;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
public class CreateStoryCardDialogBox extends DialogBox {
private WebUI2ServiceConnection con;
private TextBox name_box, best_box, actual_box, most_box, worst_box;
private TextArea desc_area;
private String name, description;
private long parent;
private float actualEffort, bestCaseEstimate, mostLikelyEstimate,
worstCaseEstimate;
public CreateStoryCardDialogBox(WebUI2ServiceConnection con) {
super(false);
this.con = con;
int rootheight, rootwidth;
rootwidth = RootPanel.get().getOffsetWidth();
rootheight = RootPanel.get().getOffsetHeight();
this.setPopupPosition(Math.round(rootwidth / 10), Math
.round(rootheight / 10));
this.setWidth("80%");
this.setHeight("80%");
this.setText("Create Storycard");
VerticalPanel v = new VerticalPanel();
Grid g = new Grid(7, 2);
//STORYCARD NAME
g.setWidget(0, 0, new Label("Name: (*)"));
name_box = new TextBox();
name_box.setText(StoryCardWeb.DEFAULT_NAME);
g.setWidget(0, 1, name_box);
//STORYCARD DESCRIPTION
g.setWidget(1, 0, new Label("Description:"));
desc_area = new TextArea();
desc_area.setText(StoryCardWeb.DEFAULT_DESC);
g.setWidget(1, 1, desc_area);
//STORYCARD BEST CASE
g.setWidget(2, 0, new Label("Best case:"));
best_box = new TextBox();
best_box.setText(String.valueOf(StoryCardWeb.DEFAULT_ESTIMATE));
g.setWidget(2, 1, best_box);
//STORYCARD MOST LIKELY
g.setWidget(3, 0, new Label("Most likely:"));
most_box = new TextBox();
most_box.setText(String.valueOf(StoryCardWeb.DEFAULT_ESTIMATE));
g.setWidget(3, 1, most_box);
//STORYCARD WORST CASE
g.setWidget(4, 0, new Label("Worst case:"));
worst_box = new TextBox();
worst_box.setText(String.valueOf(StoryCardWeb.DEFAULT_ESTIMATE));
g.setWidget(4, 1, worst_box);
//STORYCARD ACTUAL EFFORT
g.setWidget(5, 0, new Label("Actual effort:"));
actual_box = new TextBox();
actual_box.setText(String.valueOf(StoryCardWeb.DEFAULT_ESTIMATE));
g.setWidget(5, 1, actual_box);
//STORYCARD PARENT
g.setWidget(6, 0, new Label("Parent:"));
StoryCardParentListBox lb = new StoryCardParentListBox(getConnection(), getDialog());
g.setWidget(6, 1, lb);
v.add(g);
v.add(new Label("(*) Required"));
Button button = new Button("Commit");
button.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
try {
getConnection().createStoryCard(getNameText(),
getDescriptionText(), getParentId(),
getBest(), getMost(),
getWorst(), getActual(), false);
getDialog().hide();
} catch (Exception e) {
e.printStackTrace();
}
}
});
v.add(button);
this.setWidget(v);
RootPanel.get().add(this);
}
public WebUI2ServiceConnection getConnection() {
return this.con;
}
public CreateStoryCardDialogBox getDialog() {
return this;
}
public void setParentId(long id) {
this.parent = id;
}
public String getNameText() {
return this.name_box.getText();
}
public String getDescriptionText() {
return this.desc_area.getText();
}
public long getParentId() {
return this.parent;
}
public float getBest() {
return Float.valueOf(this.best_box.getText()).floatValue();
}
public float getMost() {
return Float.valueOf(this.most_box.getText()).floatValue();
}
public float getWorst() {
return Float.valueOf(this.worst_box.getText()).floatValue();
}
public float getActual() {
return Float.valueOf(this.actual_box.getText()).floatValue();
}
}
See more files for this project here