<commit_before>package org.smarti18n.editor.uis;

import com.vaadin.annotations.StyleSheet;
import com.vaadin.annotations.Theme;
import com.vaadin.annotations.Viewport;
import com.vaadin.icons.VaadinIcons;
import com.vaadin.navigator.Navigator;
import com.vaadin.server.VaadinRequest;
import com.vaadin.spring.annotation.SpringUI;
import com.vaadin.spring.navigator.SpringViewProvider;
import com.vaadin.ui.UI;

import org.smarti18n.api.ProjectsApi;
import org.smarti18n.vaadin.utils.I18N;
import org.smarti18n.editor.views.ProjectCreateWindow;
import org.smarti18n.editor.views.ProjectMessagesView;
import org.smarti18n.editor.views.ProfileView;
import org.smarti18n.editor.views.StartView;

import org.vaadin.spring.security.VaadinSecurity;
import org.vaadin.teemusa.sidemenu.SideMenu;

/**
 * @author <NAME> &lt;<EMAIL>&gt;
 */
@SpringUI(path = "/")
@Theme("smarti18n")
@StyleSheet({
        "http://fonts.googleapis.com/css?family=Questrial"
})
@Viewport("initial-scale=1, maximum-scale=1")
public class EditorUI extends UI {

    private final SpringViewProvider viewProvider;
    private final VaadinSecurity vaadinSecurity;

    private final ProjectsApi projectsApi;


    public EditorUI(
            final SpringViewProvider viewProvider,
            final VaadinSecurity vaadinSecurity,
            final ProjectsApi projectsApi) {

        this.viewProvider = viewProvider;
        this.vaadinSecurity = vaadinSecurity;
        this.projectsApi = projectsApi;

        getPage().setTitle(I18N.translate("smarti18n.editor.title"));
    }

    @Override
    protected void init(final VaadinRequest vaadinRequest) {
        final SideMenu sideMenu = new SideMenu();
        sideMenu.setMenuCaption(I18N.translate("smarti18n.editor.title"));

        sideMenu.setUserName("<NAME>");
        sideMenu.setUserMenuVisible(false);
        sideMenu.setIcon(null);

        sideMenu.addNavigation(I18N.translate("smarti18n.editor.menu.start"), VaadinIcons.HOME, StartView.VIEW_NAME);

        projectsApi.findAll().forEach(project -> sideMenu.addNavigation(
                project.getDisplayName(),
                VaadinIcons.LIST,
                ProjectMessagesView.VIEW_NAME + "/" + project.getId()
        ));

        sideMenu.addMenuItem(I18N.translate("smarti18n.editor.menu.new-project"), VaadinIcons.FOLDER_ADD, () -> addWindow(new ProjectCreateWindow(this.projectsApi)));<commit_msg>Projekt Menü sortiert und mit Folder Icon<commit_after>package org.smarti18n.editor.uis;

import com.vaadin.annotations.StyleSheet;
import com.vaadin.annotations.Theme;
import com.vaadin.annotations.Viewport;
import com.vaadin.icons.VaadinIcons;
import com.vaadin.navigator.Navigator;
import com.vaadin.server.VaadinRequest;
import com.vaadin.spring.annotation.SpringUI;
import com.vaadin.spring.navigator.SpringViewProvider;
import com.vaadin.ui.UI;

import org.smarti18n.api.Project;
import org.smarti18n.api.ProjectsApi;
import org.smarti18n.vaadin.utils.I18N;
import org.smarti18n.editor.views.ProjectCreateWindow;
import org.smarti18n.editor.views.ProjectMessagesView;
import org.smarti18n.editor.views.ProfileView;
import org.smarti18n.editor.views.StartView;

import org.vaadin.spring.security.VaadinSecurity;
import org.vaadin.teemusa.sidemenu.SideMenu;

import java.util.Comparator;

/**
 * @author <NAME> &lt;<EMAIL>&gt;
 */
@SpringUI(path = "/")
@Theme("smarti18n")
@StyleSheet({
        "http://fonts.googleapis.com/css?family=Questrial"
})
@Viewport("initial-scale=1, maximum-scale=1")
public class EditorUI extends UI {

    private final SpringViewProvider viewProvider;
    private final VaadinSecurity vaadinSecurity;

    private final ProjectsApi projectsApi;


    public EditorUI(
            final SpringViewProvider viewProvider,
            final VaadinSecurity vaadinSecurity,
            final ProjectsApi projectsApi) {

        this.viewProvider = viewProvider;
        this.vaadinSecurity = vaadinSecurity;
        this.projectsApi = projectsApi;

        getPage().setTitle(I18N.translate("smarti18n.editor.title"));
    }

    @Override
    protected void init(final VaadinRequest vaadinRequest) {
        final SideMenu sideMenu = new SideMenu();
        sideMenu.setMenuCaption(I18N.translate("smarti18n.editor.title"));

        sideMenu.setUserName("<NAME>");
        sideMenu.setUserMenuVisible(false);
        sideMenu.setIcon(null);

        sideMenu.addNavigation(I18N.translate("smarti18n.editor.menu.start"), VaadinIcons.HOME, StartView.VIEW_NAME);

        projectsApi.findAll().stream()
                .sorted(Comparator.comparing(Project::getDisplayName))
                .forEach(project -> sideMenu.addNavigation(
                        project.getDisplayName(),
                        VaadinIcons.FOLDER,
                        ProjectMessagesView.VIEW_NAME + "/" + project.getId()
                ));

        sideMenu.addMenuItem(I18N.translate("smarti18n.editor.menu.new-project"), VaadinIcons.FOLDER_ADD, () -> addWindow(new ProjectCreateWindow(this.projectsApi)));
{'fraction_non_alphanumeric': 0.11162049033286825, 'fraction_numerical': 0.014749850508271876, 'mean_word_length': 3.7881679389312977, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6964081', 'n_tokens_mistral': 1626, 'n_tokens_neox': 1497, 'n_words': 227}