Webiyo

This page was generated using Webiyo. See its source code and unit tests.

org/webiyo/examples/sourceforge/ViewSourcePage.java

package org.webiyo.examples.sourceforge;

import org.webiyo.examples.viewjava.Source;
import org.webiyo.examples.viewjava.SourceFile;
import org.webiyo.examples.viewjava.SourceIndex;
import org.webiyo.examples.viewjava.SourceView;
import org.webiyo.web.HtmlWriter;
import org.webiyo.web.Location;

import java.io.IOException;

class ViewSourcePage extends Page {

    private final SourceFile file;
    private final SourceView sourceView;

    public ViewSourcePage(Project project, SourceFile file) throws IOException {
        super(project);
        this.file = file;
        SourceIndex index = project.getSourceIndex();
        Source source = new Source(file, index);
        this.sourceView = new SourceView(source, index);
    }

    public Location getLocation() {
        return SiteMap.getSourcePageLocation(file);
    }

    protected String title() {
        return super.title() + " - " + file.getPath();
    }

    protected void renderRightSide(HtmlWriter out) throws IOException {
        sourceView.render(out);
    }

}
SourceForge