    public void displayNewThreadFormFor(final Category category) {
        layout.removeAllComponents();
        final HeadingLabel heading = new HeadingLabel("Start a New Thread",
                HeadingLevel.H2);
        layout.addComponent(heading);
        getRoot().scrollIntoView(heading);
        final HorizontalLayout topicLayout = new HorizontalLayout();
        topicLayout.setSpacing(true);
        topicLayout.setMargin(true, false, true, false);
        topicLayout.setWidth("50em");
        topicLayout.setStyleName("newthread");
        layout.addComponent(topicLayout);
        final HeadingLabel topicLabel = new HeadingLabel("Topic",
                HeadingLevel.H3);
        topicLabel.addStyleName("topiclabel");
        topicLabel.setWidth("153px");
        topicLayout.addComponent(topicLabel);
        final TextField topicField = new TextField();
        topicField.setStyleName("topicfield");
        topicField.setWidth("100%");
        topicLayout.addComponent(topicField);
        topicLayout.setExpandRatio(topicField, 1.0f);
        topicField.focus();
        newThreadComponent = new NewThreadComponent(new NewThreadListener() {
            @Override
            public void submit(final String rawBody) {
                String errorMessages = "";
                final String topic = topicField.getValue();
                if (topic.isEmpty()) {
                    errorMessages += "You need a topic<br/>";
                }
                if (rawBody.isEmpty()) {
                    errorMessages += "You need a thread body<br/>";
                }
                if (errorMessages.isEmpty()) {
                    try {
                        final DiscussionThread createdThread = getPresenter()
                                .createNewThread(category, topic, rawBody);
                        getNavigator().navigateTo(
                                ToriNavigator.ApplicationView.THREADS.getUrl()
                                        + "/" + createdThread.getId());
                    } catch (final DataSourceException e) {
                        getRoot()
                                .showNotification(
                                        DataSourceException.BORING_GENERIC_ERROR_MESSAGE);
                    }
                } else {
                    getRoot().showNotification(errorMessages,
                            Notification.TYPE_HUMANIZED_MESSAGE);
                }
            }
            @Override
            public void addAttachment(final String attachmentFileName,
                    final byte[] data) {
                getPresenter().addAttachment(attachmentFileName, data);
            }
            @Override
            public void resetInput() {
                getPresenter().resetInput();
            }
            @Override
            public void removeAttachment(final String fileName) {
                getPresenter().removeAttachment(fileName);
            }
        }, ToriApplication.getCurrent().getPostFormatter()
                .getFormattingSyntaxXhtml());
        newThreadComponent.setUserMayAddFiles(getPresenter().userMayAddFiles());
        newThreadComponent.setMaxFileSize(getPresenter().getMaxFileSize());
        layout.addComponent(newThreadComponent);
    }

    public void displayNewThreadFormFor(final Category category) {
        layout.removeAllComponents();
        final HeadingLabel heading = new HeadingLabel("Start a New Thread",
                HeadingLevel.H2);
        layout.addComponent(heading);
        getRoot().scrollIntoView(heading);
        final HorizontalLayout topicLayout = new HorizontalLayout();
        topicLayout.setSpacing(true);
        topicLayout.setMargin(true, false, false, false);
        topicLayout.setWidth("50em");
        topicLayout.setStyleName("newthread");
        layout.addComponent(topicLayout);
        final HeadingLabel topicLabel = new HeadingLabel("Topic",
                HeadingLevel.H3);
        topicLabel.addStyleName("topiclabel");
        topicLabel.setWidth("153px");
        topicLayout.addComponent(topicLabel);
        final TextField topicField = new TextField();
        topicField.setStyleName("topicfield");
        topicField.setWidth("100%");
        topicLayout.addComponent(topicField);
        topicLayout.setExpandRatio(topicField, 1.0f);
        topicField.focus();
        newThreadComponent = new NewThreadComponent(new NewThreadListener() {
            @Override
            public void submit(final String rawBody) {
                String errorMessages = "";
                final String topic = topicField.getValue();
                if (topic.isEmpty()) {
                    errorMessages += "You need a topic<br/>";
                }
                if (rawBody.isEmpty()) {
                    errorMessages += "You need a thread body<br/>";
                }
                if (errorMessages.isEmpty()) {
                    try {
                        final DiscussionThread createdThread = getPresenter()
                                .createNewThread(category, topic, rawBody);
                        getNavigator().navigateTo(
                                ToriNavigator.ApplicationView.THREADS.getUrl()
                                        + "/" + createdThread.getId());
                    } catch (final DataSourceException e) {
                        getRoot()
                                .showNotification(
                                        DataSourceException.BORING_GENERIC_ERROR_MESSAGE);
                    }
                } else {
                    getRoot().showNotification(errorMessages,
                            Notification.TYPE_HUMANIZED_MESSAGE);
                }
            }
            @Override
            public void addAttachment(final String attachmentFileName,
                    final byte[] data) {
                getPresenter().addAttachment(attachmentFileName, data);
            }
            @Override
            public void resetInput() {
                getPresenter().resetInput();
            }
            @Override
            public void removeAttachment(final String fileName) {
                getPresenter().removeAttachment(fileName);
            }
        }, ToriApplication.getCurrent().getPostFormatter()
                .getFormattingSyntaxXhtml());
        newThreadComponent.setUserMayAddFiles(getPresenter().userMayAddFiles());
        newThreadComponent.setMaxFileSize(getPresenter().getMaxFileSize());
        layout.addComponent(newThreadComponent);
    }
