<commit_before>/**
 * NovaForge(TM) is a web-based forge offering a Collaborative Development and
 * Project Management Environment.
 *
 * Copyright (C) 2007-2012  BULL SAS
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see http://www.gnu.org/licenses/.
 */
package org.safehaus.subutai.server.ui;

import com.github.wolfie.refresher.Refresher;
import com.vaadin.annotations.Theme;
import com.vaadin.annotations.Title;
import com.vaadin.event.ShortcutAction;
import com.vaadin.event.ShortcutListener;
import com.vaadin.navigator.Navigator;
import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener;
import com.vaadin.server.Page;
import com.vaadin.server.ThemeResource;
import com.vaadin.server.VaadinRequest;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.ui.*;
import org.safehaus.subutai.server.ui.util.HelpManager;
import org.safehaus.subutai.server.ui.util.HelpOverlay;
import org.safehaus.subutai.server.ui.views.ModulesView;
import org.safehaus.subutai.server.ui.views.MonitorView;
import org.safehaus.subutai.shared.protocol.settings.Common;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
import java.util.logging.Logger;


@Theme("dashboard")
@SuppressWarnings("serial")
@Title("Mgmt UI")

public class MainUI extends UI {

    private static final Logger LOG = Logger.getLogger(MainUI.class.getName());
    private static final ThreadLocal<MainUI> threadLocal = new ThreadLocal<MainUI>();

    private Refresher refresher;
    private CssLayout root = new CssLayout();
    private CssLayout menu = new CssLayout();
    private CssLayout content = new CssLayout();
    private VerticalLayout loginLayout;
    private HelpManager helpManager;
    private Navigator nav;

    private HashMap<String, Button> viewNameToMenuButton = new HashMap<String, Button>();
    private HashMap<String, Class<? extends View>> routes = new HashMap<String, Class<? extends View>>() {
        {
            put("/modules", ModulesView.class);
            put("/monitor", MonitorView.class);
        }
    };

    @Override
    protected void init(VaadinRequest request) {
        setInstance(this);
        helpManager = new HelpManager(this);

        setLocale(Locale.US);

        setContent(root);
        root.addStyleName("root");
        root.setSizeFull();

        // Unfortunate to use an actual widget here, but since CSS generated
        // elements can't be transitioned yet, we must
        Label bg = new Label();
        bg.setSizeUndefined();
        bg.addStyleName("login-bg");
        root.addComponent(bg);

        // For synchronization issue
       /* final ProgressIndicator indicator
                = new ProgressIndicator(new Float(0.0));
        indicator.setPollingInterval(Common.REFRESH_UI_SEC * 1000);
        indicator.setWidth("0px");
        indicator.setHeight("0px");
        root.addComponent(indicator);*/
        refresher = new Refresher();
        root.addComponent((Component) refresher);
        refresher.setRefreshInterval(Common.REFRESH_UI_SEC * 1000);<commit_msg>Vaadin 7 synchronization issue<commit_after>/**
 * NovaForge(TM) is a web-based forge offering a Collaborative Development and
 * Project Management Environment.
 *
 * Copyright (C) 2007-2012  BULL SAS
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see http://www.gnu.org/licenses/.
 */
package org.safehaus.subutai.server.ui;

import com.github.wolfie.refresher.Refresher;
import com.vaadin.annotations.Theme;
import com.vaadin.annotations.Title;
import com.vaadin.event.ShortcutAction;
import com.vaadin.event.ShortcutListener;
import com.vaadin.navigator.Navigator;
import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener;
import com.vaadin.server.Page;
import com.vaadin.server.ThemeResource;
import com.vaadin.server.VaadinRequest;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.ui.*;
import org.safehaus.subutai.server.ui.util.HelpManager;
import org.safehaus.subutai.server.ui.util.HelpOverlay;
import org.safehaus.subutai.server.ui.views.ModulesView;
import org.safehaus.subutai.server.ui.views.MonitorView;
import org.safehaus.subutai.shared.protocol.settings.Common;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
import java.util.logging.Logger;


@Theme("dashboard")
@SuppressWarnings("serial")
@Title("Mgmt UI")

public class MainUI extends UI {

    private static final Logger LOG = Logger.getLogger(MainUI.class.getName());
    private static final ThreadLocal<MainUI> threadLocal = new ThreadLocal<MainUI>();

    private Refresher refresher;
    private CssLayout root = new CssLayout();
    private CssLayout menu = new CssLayout();
    private CssLayout content = new CssLayout();
    private VerticalLayout loginLayout;
    private HelpManager helpManager;
    private Navigator nav;

    private HashMap<String, Button> viewNameToMenuButton = new HashMap<String, Button>();
    private HashMap<String, Class<? extends View>> routes = new HashMap<String, Class<? extends View>>() {
        {
            put("/modules", ModulesView.class);
            put("/monitor", MonitorView.class);
        }
    };

    @Override
    protected void init(VaadinRequest request) {
        setInstance(this);
        helpManager = new HelpManager(this);

        setLocale(Locale.US);

        setContent(root);
        root.addStyleName("root");
        root.setSizeFull();

        // Unfortunate to use an actual widget here, but since CSS generated
        // elements can't be transitioned yet, we must
        Label bg = new Label();
        bg.setSizeUndefined();
        bg.addStyleName("login-bg");
        root.addComponent(bg);

        // For synchronization issue
       /* final ProgressIndicator indicator
                = new ProgressIndicator(new Float(0.0));
        indicator.setPollingInterval(Common.REFRESH_UI_SEC * 1000);
        indicator.setWidth("0px");
        indicator.setHeight("0px");
        root.addComponent(indicator);*/
        refresher = new Refresher();
        refresher.setRefreshInterval(Common.REFRESH_UI_SEC * 1000);
{'fraction_non_alphanumeric': 0.0984235777930089, 'fraction_numerical': 0.005894448252227553, 'mean_word_length': 3.679923027581783, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3321039', 'n_tokens_mistral': 2105, 'n_tokens_neox': 2028, 'n_words': 594}