public CreatePostWidget(final ForumApp app, boolean isReply,
final CreatePostDialog createPostDialog, final User author,
String selection) {
VerticalPanel mainP = new VerticalPanel();
titleBox = new TextBox();
textArea = new RichTextArea();
textArea.setSize("35em", "15em");
RichTextToolbar toolbar = new RichTextToolbar(textArea);
HorizontalPanel hp = new HorizontalPanel();
hp.add(new Label("Title:"));
hp.add(titleBox);
mainP.add(hp);
mainP.add(toolbar);
mainP.add(textArea);
Button cancelB = new Button("Cancel");
Button submitB = new Button("Create Thread");
if (isReply) {
submitB.setText("Post Reply");
}
submitB.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
app
.create(author, titleBox.getText(), textArea
.getHTML());
createPostDialog.hide();
}
});
cancelB.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
createPostDialog.hide();
}
});
mainP.add(cancelB);
mainP.add(submitB);
initWidget(mainP);
setHTML(makeReplyFromString(selection));
}