Пример #1
0
  public EditorView(ProjectFile file, Project project, User user, boolean inIde, int line) {
    super();
    this.file = file;
    this.project = project;
    this.user = user;
    layout.setSizeFull();

    HorizontalLayout ho = new HorizontalLayout();
    if (!inIde) {
      String url = "#" + project.getName() + "/" + file.getName() + "!";
      Link link = new Link("<<< " + file.getName(), new ExternalResource(url));
      link.setDescription("View project");
      layout.addComponent(link);
    }
    if (inIde) {
      String url = "#" + project.getName() + "/" + file.getName();
      Link link = new Link(file.getName() + " >>>", new ExternalResource(url));
      link.setDescription("View in standalone window");
      layout.addComponent(link);
    }

    layout.addComponent(ho);

    layout.setExpandRatio(ho, 1);
    ho.setSizeFull();

    cdoc = project.getDoc(file);

    editor = createEditor(file, project);
    editor.setSizeFull();
    editor.setEnabled(user != null);
    editor.setUser(user.getUserId(), user.getStyle());

    final int pos =
        org.vaadin.aceeditor.gwt.shared.Util.cursorPosFromLineCol(
            cdoc.getShared().getValue().getText(), line, 0, 1);
    editor.scrollToPosition(pos);
    ho.addComponent(editor);
    ho.setExpandRatio(editor, 1);

    VerticalLayout rightBar = new VerticalLayout();
    rightBar.setWidth("64px");
    rightBar.addComponent(userLayout);
    rightBar.addComponent(markerLayout);

    ho.addComponent(rightBar);

    setSizeFull();
    setCompositionRoot(layout);
  }