Example usage for com.vaadin.ui Window addStyleName

List of usage examples for com.vaadin.ui Window addStyleName

Introduction

In this page you can find the example usage for com.vaadin.ui Window addStyleName.

Prototype

@Override
    public void addStyleName(String style) 

Source Link

Usage

From source file:com.compomics.sigpep.webapp.MyVaadinApplication.java

License:Apache License

@Override
public void init() {
    iApplication = this;
    iSigPepSessionFactory = ApplicationLocator.getInstance().getApplication().getSigPepSessionFactory();

    //add theme//from   w w  w . j a v a  2s  .c o  m
    setTheme("sigpep");

    //add main window
    Window lMainwindow = new Window("Sigpep Application");
    setMainWindow(lMainwindow);
    lMainwindow.addStyleName("v-app-my");

    //add notification component
    iNotifique = new Notifique(Boolean.FALSE);
    CustomOverlay lCustomOverlay = new CustomOverlay(iNotifique, getMainWindow());
    getMainWindow().addComponent(lCustomOverlay);

    //add form help
    iFormHelp = new FormHelp();
    iFormHelp.setFollowFocus(Boolean.TRUE);
    this.getMainWindow().getContent().addComponent(iFormHelp);

    //add panels
    iCenterLeft = new Panel();
    iCenterLeft.addStyleName(Reindeer.PANEL_LIGHT);
    iCenterLeft.setHeight("400px");
    iCenterLeft.setWidth("100%");

    iCenterRight = new Panel();
    iCenterRight.addStyleName(Reindeer.PANEL_LIGHT);
    iCenterRight.setHeight("400px");
    iCenterRight.setWidth("75%");

    //add form tabs
    iFormTabSheet = new FormTabSheet(this);
    iCenterLeft.addComponent(iFormTabSheet);

    iBottomLayoutResults = new VerticalLayout();

    if (PropertiesConfigurationHolder.showTestDemoFolder()) {
        Button lButton = new Button("load test data");
        lButton.addListener(new Button.ClickListener() {
            public void buttonClick(Button.ClickEvent event) {
                new BackgroundThread().run();
            }
        });
        iBottomLayoutResults.addComponent(lButton);
    }

    // Add the selector component
    iSelectionComponent = new TransitionSelectionComponent(MyVaadinApplication.this);
    iCenterRight.addComponent(iSelectionComponent);

    iHeaderLayout = new HorizontalLayout();
    iHeaderLayout.setSizeFull();
    iHeaderLayout.setHeight("100px");
    iHeaderLayout.addStyleName("v-header");

    VerticalLayout lVerticalLayout = new VerticalLayout();

    GridLayout lGridLayout = new GridLayout(2, 1);
    lGridLayout.setSpacing(true);
    lGridLayout.setSizeFull();

    lGridLayout.addComponent(iCenterLeft, 0, 0);
    lGridLayout.setComponentAlignment(iCenterLeft, Alignment.TOP_LEFT);

    lGridLayout.addComponent(iCenterRight, 1, 0);
    lGridLayout.setComponentAlignment(iCenterRight, Alignment.TOP_CENTER);

    lVerticalLayout.addComponent(iHeaderLayout);
    lVerticalLayout.addComponent(lGridLayout);
    lVerticalLayout.addComponent(iBottomLayoutResults);

    lVerticalLayout.setComponentAlignment(iHeaderLayout, Alignment.MIDDLE_CENTER);
    lVerticalLayout.setComponentAlignment(lGridLayout, Alignment.MIDDLE_CENTER);
    lVerticalLayout.setComponentAlignment(iBottomLayoutResults, Alignment.MIDDLE_CENTER);

    lMainwindow.addComponent(lVerticalLayout);
    lMainwindow.addComponent(pusher);

    // Create a tracker for vaadin.com domain.
    String lDomainName = PropertiesConfigurationHolder.getInstance().getString("analytics.domain");
    String lPageId = PropertiesConfigurationHolder.getInstance().getString("analytics.page");

    GoogleAnalyticsTracker tracker = new GoogleAnalyticsTracker("UA-26252212-1", lDomainName);
    lMainwindow.addComponent(tracker);
    tracker.trackPageview(lPageId);

    /**
     * Sets an UncaughtExceptionHandler and executes the thread by the ExecutorsService
     */
    Thread.setDefaultUncaughtExceptionHandler(new MyUncaughtExceptionHandler());

    parseSessionId();
}

From source file:com.expressui.core.MainApplication.java

License:Open Source License

@Override
public void init() {
    currentInstance.set(this);

    setTheme(getCustomTheme());/*from   w w  w  .  ja  v  a 2 s .  c  o  m*/
    customizeConfirmDialogStyle();

    Window mainWindow = new Window();
    setMainWindow(mainWindow);
    mainWindow.addStyleName("e-main-window");
    mainWindow.setCaption(getTypeCaption());

    VerticalLayout mainLayout = new VerticalLayout();
    String id = StringUtil.generateDebugId("e", this, mainLayout, "mainLayout");
    mainLayout.setDebugId(id);

    mainWindow.setSizeFull();
    mainLayout.setSizeFull();
    mainWindow.setContent(mainLayout);

    setLogoutURL(getApplicationProperties().getRestartApplicationUrl());

    configureLeftMenuBar(mainMenuBar.getLeftMenuBarRoot());
    configureRightMenuBar(mainMenuBar.getRightMenuBarRoot());
    mainLayout.addComponent(mainMenuBar);

    pageLayoutTabSheet = new TabSheet();
    id = StringUtil.generateDebugId("e", this, pageLayoutTabSheet, "pageLayoutTabSheet");
    pageLayoutTabSheet.setDebugId(id);

    pageLayoutTabSheet.addStyleName("e-main-page-layout");
    pageLayoutTabSheet.setSizeFull();
    mainLayout.addComponent(pageLayoutTabSheet);
    mainLayout.setExpandRatio(pageLayoutTabSheet, 1.0f);

    Link expressUILink = new Link(uiMessageSource.getMessage("mainApplication.footerMessage"),
            new ExternalResource(uiMessageSource.getMessage("mainApplication.footerLink")));
    expressUILink.setTargetName("_blank");
    expressUILink.setIcon(new ThemeResource("../expressui/favicon.png"));
    expressUILink.setSizeUndefined();
    mainLayout.addComponent(expressUILink);
    mainLayout.setComponentAlignment(expressUILink, Alignment.TOP_CENTER);

    configureSessionTimeout(mainWindow);
    postWire();
    onDisplay();
}

From source file:com.expressui.core.MainApplication.java

License:Open Source License

/**
 * Opens a separate error Window with the full stack trace of a throwable
 * and error box highlighting the root cause message.
 *
 * @param throwable full stack trace of this throwable is displayed in error Window
 *///  w ww. j av  a  2s .co  m
public void openErrorWindow(Throwable throwable) {
    showError(ExceptionUtils.getRootCauseMessage(throwable));

    String message = ExceptionUtils.getFullStackTrace(throwable);
    Window errorWindow = new Window(uiMessageSource.getMessage("mainApplication.errorWindowCaption"));
    errorWindow.addStyleName("opaque");
    VerticalLayout layout = (VerticalLayout) errorWindow.getContent();
    layout.setSpacing(true);
    layout.setWidth("100%");
    errorWindow.setWidth("100%");
    errorWindow.setModal(true);
    Label label = new Label(message);
    label.setContentMode(Label.CONTENT_PREFORMATTED);
    layout.addComponent(label);
    errorWindow.setClosable(true);
    errorWindow.setScrollable(true);
    getMainWindow().addWindow(errorWindow);
}

From source file:com.expressui.core.view.util.CodePopup.java

License:Open Source License

/**
 * Opens popup for given classes.//from  w w  w. j a v a2  s .  c  om
 *
 * @param classes classes for displaying related source code and Javadoc. If
 *                class is within com.expressui.core or com.expressui.domain,
 *                then Javadoc is displayed, otherwise source code.
 */
public void open(Class... classes) {

    Window codeWindow = new Window();
    codeWindow.addStyleName("code-popup");
    codeWindow.setPositionX(20);
    codeWindow.setPositionY(40);
    codeWindow.setWidth("90%");
    codeWindow.setHeight("90%");

    TabSheet codePopupTabSheet = new TabSheet();
    String id = StringUtil.generateDebugId("e", this, codePopupTabSheet, "codePopupTabSheet");
    codePopupTabSheet.setDebugId(id);

    codePopupTabSheet.setSizeFull();
    codeWindow.addComponent(codePopupTabSheet);

    String windowCaption = "";
    Set<String> shownUrls = new HashSet<String>();
    for (Class clazz : classes) {
        String tabCaption;
        String url;
        if (clazz.getName().startsWith("com.expressui.core")
                || clazz.getName().startsWith("com.expressui.domain")) {
            url = applicationProperties.getDocUrl(clazz);
            if (shownUrls.contains(url))
                continue;
            tabCaption = clazz.getSimpleName() + " API";
            Embedded embedded = getEmbeddedDoc(url);
            codePopupTabSheet.addTab(embedded, tabCaption);
        } else {
            url = applicationProperties.getCodeUrl(clazz);
            if (shownUrls.contains(url))
                continue;
            tabCaption = clazz.getSimpleName() + ".java";
            String code = getCodeContents(url);
            Label label = new CodeLabel(code);
            codePopupTabSheet.addTab(label, tabCaption);
        }
        shownUrls.add(url);
        if (windowCaption.length() > 0)
            windowCaption += ", ";

        windowCaption += tabCaption;
    }

    codeWindow.setCaption(windowCaption);
    MainApplication.getInstance().getMainWindow().addWindow(codeWindow);
}

From source file:com.hivesys.dashboard.view.repository.DragAndDropBox.java

private void showComponent(final Component c, final String name) {
    final VerticalLayout layout = new VerticalLayout();
    layout.setSizeUndefined();/*from   ww  w  .  ja  v a 2  s. c om*/
    layout.setMargin(true);
    final Window w = new Window(name, layout);
    w.addStyleName("dropdisplaywindow");
    w.setSizeUndefined();
    w.setResizable(false);
    c.setSizeUndefined();
    layout.addComponent(c);
    UI.getCurrent().addWindow(w);

}

From source file:com.naoset.framework.frontend.component.profile.CustomerEditWindowView.java

private void openWindow() {
    Window myWindow = new Window("Cliente");
    myWindow.addStyleName("profile-window");
    myWindow.setId(ID);/*w  w w.  j a v  a 2 s  . co m*/
    Responsive.makeResponsive(this);

    myWindow.setModal(true);
    myWindow.setCloseShortcut(ShortcutAction.KeyCode.ESCAPE, null);
    myWindow.setResizable(false);
    myWindow.setClosable(false);
    myWindow.setHeight(90.0f, Unit.PERCENTAGE);
    VerticalLayout layout = new VerticalLayout();
    CustomerPanelView customerPanelView = new CustomerPanelView();

    layout.addComponent(customerPanelView.buildCustomerPanel(null));
    layout.addComponent(builtButton());

    myWindow.setContent(layout);
    myWindow.setVisible(true);
    UI.getCurrent().addWindow(myWindow);
    myWindow.focus();
}

From source file:com.purebred.core.MainApplication.java

License:Open Source License

@Override
public void init() {
    setInstance(this);

    setTheme(mainEntryPoints.getTheme());
    customizeConfirmDialogStyle();/* www  .j  a va2s .  c o m*/

    Window mainWindow = new Window(messageSource.getMessage("mainApplication.caption"));
    mainWindow.addStyleName("p-main-window");
    mainWindow.getContent().setSizeUndefined();
    setMainWindow(mainWindow);

    mainEntryPoints.addStyleName("p-main-entry-points");
    mainWindow.addComponent(mainEntryPoints);

    mainEntryPoints.postWire();
}

From source file:com.purebred.core.MainApplication.java

License:Open Source License

/**
 * Open separate error Window, useful for showing stacktraces.
 *
 * @param message/*  w  ww.j a v a  2s  .c o m*/
 */
public void openErrorWindow(String message) {
    Window errorWindow = new Window("Error");
    errorWindow.addStyleName("opaque");
    VerticalLayout layout = (VerticalLayout) errorWindow.getContent();
    layout.setSpacing(true);
    layout.setWidth("100%");
    errorWindow.setWidth("100%");
    errorWindow.setModal(true);
    Label label = new Label(message);
    label.setContentMode(Label.CONTENT_PREFORMATTED);
    layout.addComponent(label);
    errorWindow.setClosable(true);
    errorWindow.setScrollable(true);
    MainApplication.getInstance().getMainWindow().addWindow(errorWindow);
}

From source file:de.catma.CatmaApplication.java

License:Open Source License

@Override
public void init() {

    Properties properties = loadProperties();
    backgroundService = new BackgroundService(this);

    final Window mainWindow = new Window("CATMA 4.1 - CLA " + VERSION);
    mainWindow.addParameterHandler(this);
    HorizontalLayout mainLayout = new HorizontalLayout();
    mainLayout.setSizeUndefined();//from w w w  . ja  va  2 s. co  m
    mainLayout.setMargin(true);
    mainLayout.setSpacing(true);
    mainWindow.addStyleName("catma-mainwindow");

    mainWindow.setContent(mainLayout);
    MenuFactory menuFactory = new MenuFactory();
    try {
        initTempDirectory(properties);
        tagManager = new TagManager();

        repositoryManagerView = new RepositoryManagerView(new RepositoryManager(this, tagManager, properties));

        tagManagerView = new TagManagerView(tagManager);

        taggerManagerView = new TaggerManagerView();

        analyzerManagerView = new AnalyzerManagerView();

        visualizationManagerView = new VisualizationManagerView();

        defaultProgressIndicator = new ProgressIndicator();
        defaultProgressIndicator.setIndeterminate(true);
        defaultProgressIndicator.setEnabled(false);
        defaultProgressIndicator.setPollingInterval(500);
        progressWindow = new ProgressWindow(defaultProgressIndicator);

        menu = menuFactory.createMenu(mainLayout,
                new MenuFactory.MenuEntryDefinition("Repository Manager",
                        new RepositoryManagerWindow(repositoryManagerView)),
                new MenuFactory.MenuEntryDefinition("Tag Manager", new TagManagerWindow(tagManagerView)),
                new MenuFactory.MenuEntryDefinition("Tagger", new TaggerManagerWindow(taggerManagerView)),
                new MenuFactory.MenuEntryDefinition("Analyzer", new AnalyzerManagerWindow(analyzerManagerView)),
                new MenuFactory.MenuEntryDefinition("Visualizer",
                        new VisualizationManagerWindow(visualizationManagerView)));
        Link aboutLink = new Link("About", new ExternalResource("http://www.catma.de"));
        aboutLink.setTargetName("_blank");
        mainLayout.addComponent(aboutLink);
        mainLayout.setComponentAlignment(aboutLink, Alignment.TOP_RIGHT);
        mainLayout.setExpandRatio(aboutLink, 1.0f);

        Link helpLink = new Link("Help", new ExternalResource(getURL() + "manual/"));
        helpLink.setTargetName("_blank");
        mainLayout.addComponent(helpLink);
        mainLayout.setComponentAlignment(helpLink, Alignment.TOP_RIGHT);

        Label helpLabel = new Label();
        helpLabel.setIcon(new ClassResource("ui/resources/icon-help.gif", this));
        helpLabel.setWidth("20px");
        helpLabel.setDescription(
                "<h3>Hints</h3>" + "<p>Watch out for these little question mark icons while navigating "
                        + "through CATMA. They provide useful hints for managing the first "
                        + "steps within a CATMA component.</p>" + "<h4>Login</h4>"
                        + "Once you're logged in, you will see the Repository Manager, "
                        + "which will explain the first steps to you. "
                        + "Just hover your mouse over the question mark icons!");
        VerticalLayout helpWrapper = new VerticalLayout();
        helpWrapper.addComponent(helpLabel);
        helpWrapper.setComponentAlignment(helpLabel, Alignment.TOP_RIGHT);

        Animator helpAnimator = new Animator(helpWrapper);

        helpAnimator.setFadedOut(true);

        mainLayout.addComponent(helpAnimator);
        mainLayout.setComponentAlignment(helpAnimator, Alignment.TOP_RIGHT);
        helpAnimator.fadeIn(2000, 300);

        MenuBar loginLogoutMenu = new MenuBar();
        LoginLogoutCommand loginLogoutCommand = new LoginLogoutCommand(menu, repositoryManagerView, this);
        MenuItem loginLogoutitem = loginLogoutMenu.addItem("Login", loginLogoutCommand);
        loginLogoutCommand.setLoginLogoutItem(loginLogoutitem);

        mainLayout.addComponent(loginLogoutMenu);
        mainLayout.setComponentAlignment(loginLogoutMenu, Alignment.TOP_RIGHT);
        mainLayout.setWidth("100%");
    } catch (Exception e) {
        showAndLogError("The system could not be initialized!", e);
    }

    setMainWindow(mainWindow);

    setTheme("cleatheme");
}

From source file:edu.nps.moves.mmowgli.components.MmowgliDialogContent.java

License:Open Source License

public static void throwUpDialog2() {
    Window w = new Window();
    w.setClosable(false);/*from   ww w .  j ava 2s . c om*/
    w.setResizable(true);
    w.setStyleName("m-mmowglidialog2");
    w.addStyleName("m-transparent"); // don't know why I need this, .mmowglidialog sets it too
    w.setWidth("600px");
    w.setHeight("400px");
    MmowgliDialogContent con = new MmowgliDialogContent();
    w.setContent(con);
    con.setSizeFull();
    con.initGui();
    con.setTitleString("Yippee ki awol!");

    UI.getCurrent().addWindow(w);
    w.center();

}