public MetadataSelectionComboBox() {
   super(
       new String[] {
         MarkdownServer.getMessages().projectMetadataWidgetMetadata(),
         MarkdownServer.getMessages().projectMetadataWidgetCover(),
         MarkdownServer.getMessages().projectMetadataWidgetStyleSheet(),
       });
 }
public class ProjectMetadataWidget extends JPanel {

  private static MarkdownMessages messages = MarkdownServer.getMessages();
  private MetadataSelectionComboBox comboBox;
  private MetadataWidget metadataWidget;
  private JScrollPane metadataScrollPane;
  private ProjectCoverPanel coverImagePanel;
  private JScrollPane coverImageScrollPane;
  private StyleSheetPanel styleSheetPanel;
  private JScrollPane styleSheetScrollPane;
  private Controller controller;

  public ProjectMetadataWidget(Controller controller) {
    this.controller = controller;

    comboBox = new MetadataSelectionComboBox();
    metadataWidget = new MetadataWidget(controller, controller.getProjectFrame().getProject());
    metadataScrollPane = new JScrollPane(metadataWidget);
    coverImagePanel = new ProjectCoverPanel(controller);
    coverImageScrollPane = new JScrollPane(coverImagePanel);
    styleSheetPanel = new StyleSheetPanel(controller);
    styleSheetScrollPane = new JScrollPane(styleSheetPanel);

    setLayout(new BorderLayout());
    add(comboBox, BorderLayout.NORTH);
    add(metadataScrollPane, BorderLayout.CENTER);

    new Listener();
  }

  public void update() {
    coverImagePanel.refresh();
    metadataWidget.refresh();
  }

  public void updateSelection() {
    remove(metadataScrollPane);
    remove(coverImageScrollPane);
    remove(styleSheetScrollPane);

    int index = comboBox.getSelectedIndex();
    if (index == 0) {
      add(metadataScrollPane);
    } else if (index == 1) {
      add(coverImageScrollPane);
    } else if (index == 2) {
      add(styleSheetScrollPane);
    }

    GuiUtils.forceRepaint(this);
  }

  private class MetadataSelectionComboBox extends JComboBox {

    public MetadataSelectionComboBox() {
      super(
          new String[] {
            MarkdownServer.getMessages().projectMetadataWidgetMetadata(),
            MarkdownServer.getMessages().projectMetadataWidgetCover(),
            MarkdownServer.getMessages().projectMetadataWidgetStyleSheet(),
          });
    }
  }

  private class Listener implements ActionListener {
    public Listener() {
      comboBox.addActionListener(this);
    }

    public void actionPerformed(ActionEvent e) {
      updateSelection();
    }
  }
}
public class EmptyProject extends ProjectTemplate {
  private MarkdownMessages messages = MarkdownServer.getMessages();

  public EmptyProject() {
    setTitle(messages.projectTemplateEmptyTitle());
    setDescription(messages.projectTemplateEmpty());
  }

  public Project getProject() {
    GregorianCalendar date = new GregorianCalendar();

    Project project = new Project();
    project.setCreatedDate(date);
    project.setModifiedDate(date);
    //        project.setTitle( messages.titleUntitledProject() );
    project.setProjectModelVersion(ProjectIo.PROJECT_MODEL_VERSION);

    Node root = new Node();
    root.setTitle(messages.titleUntitled());
    root.setNodeType(NodeTypes.PROJECT);
    root.setCreatedDate(date);
    root.setModifiedDate(date);

    Node manuscript = new Node();
    manuscript.setTitle(messages.titleManuscript());
    manuscript.setNodeType(NodeTypes.MANUSCRIPT);
    manuscript.setCreatedDate(date);
    manuscript.setModifiedDate(date);
    project.getChildNodes().add(manuscript);

    Node blankText = new Node();
    blankText.setTitle(messages.titleUntitledDocument());
    blankText.setNodeType(NodeTypes.MARKDOWN);
    blankText.setCreatedDate(date);
    blankText.setModifiedDate(date);
    manuscript.getChildNodes().add(blankText);

    Node research = new Node();
    research.setTitle(messages.titleResearch());
    research.setNodeType(NodeTypes.MARKDOWN);
    research.setCreatedDate(date);
    research.setModifiedDate(date);
    project.getChildNodes().add(research);

    Node resources = new Node();
    resources.setTitle(messages.titleResources());
    resources.setNodeType(NodeTypes.RESOURCES);
    resources.setCreatedDate(date);
    resources.setModifiedDate(date);
    project.getChildNodes().add(resources);

    Node trash = new Node();
    trash.setTitle(messages.titleTrash());
    trash.setNodeType(NodeTypes.TRASH);
    trash.setCreatedDate(date);
    trash.setModifiedDate(date);
    project.getChildNodes().add(trash);

    project.setManuscriptUuid(manuscript.getUuid());
    project.setResourcesUuid(resources.getUuid());
    project.setTrashUuid(trash.getUuid());

    String css = messages.defaultCss();
    project.setStyleSheet(css);

    return project;
  }
}