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:edu.nps.moves.mmowgli.modules.registrationlogin.RegistrationPageBase.java

License:Open Source License

@SuppressWarnings("serial")
@HibernateUserRead/*w  w  w  .  ja v a 2  s  .com*/
public void checkUserLimitsTL() {
    Serializable uid = Mmowgli2UI.getGlobals().getUserID();
    if (uid != NO_LOGGEDIN_USER_ID) { // can't do this check if we don't have a user yet
        MSysOut.println(DEBUG_LOGS, "User.getTL() in RegistrationPageBase.checkUserLimitsTL()");
        User u = User.getTL(uid);
        if (u != null) // why should it be?
            if (u.getUserName() != null) // why should it be?
                if (u.isGameMaster())//getUserName().toLowerCase().startsWith("gm_"))
                    return;
    }

    int maxIn = Game.getTL().getMaxUsersOnline();
    // List<User> lis = (List<User>)HibernateContainers.getSession().createCriteria(User.class).add(Restrictions.eq("online", true)).list();
    // if(lis.size()>=maxIn) {
    if (Mmowgli2UI.getGlobals().getSessionCount() >= maxIn) { // new improved
        lockedOut = true;
        VerticalLayout vl = new VerticalLayout();
        vl.setWidth("325px");
        vl.addStyleName("m-errorNotificationEquivalent");
        vl.setSpacing(false);
        vl.setMargin(true);
        Label lab = new Label("We're loaded to the max with players right now.");
        lab.setSizeUndefined();
        vl.addComponent(lab);
        lab = new Label("Idle players are timed-out after 15 minutes.");
        lab.setSizeUndefined();
        vl.addComponent(lab);
        lab = new Label("Please try again later.");
        lab.setSizeUndefined();
        vl.addComponent(lab);

        Window win = new Window("Sorry, but....");
        win.setSizeUndefined();
        win.addStyleName("m-transparent");
        win.setWidth("308px");
        win.setResizable(false);
        win.setContent(vl);

        openPopupWindowInMainWindow(win, 400);
        win.setModal(false);

        win.addCloseListener(new CloseListener() {
            @Override
            @MmowgliCodeEntry
            @HibernateOpened
            @HibernateClosed
            public void windowClose(CloseEvent e) {
                HSess.init();
                Mmowgli2UI.getAppUI().quitAndGoTo(GameLinks.getTL().getGameFullLink());
                HSess.close();
            }
        });
    }
}

From source file:fi.pss.cleanbeach.standalone.map.MapComponent.java

public void addPoint(final fi.pss.cleanbeach.data.Event e) {

    Location l = e.getLocation();

    LMarker m = new LMarker(l.getLatitude(), l.getLongitude());
    m.setData(l);//from   w ww  .  j ava2 s .c  om
    addComponent(m);

    setIcon(m, l);
    m.setIconAnchor(new Point(16, 32));

    m.addClickListener(new LeafletClickListener() {

        @Override
        public void onClick(LeafletClickEvent event) {
            details.update(e);
            Window pop = new Window(null, details);
            pop.setResizable(false);
            pop.addStyleName("detailpop");
            pop.setModal(true);
            getUI().addWindow(pop);

            setCenter(e.getLocation().getLatitude(), e.getLocation().getLongitude() + getDetailsPosOffset());
        }

    });
    markers.put(l, m);
}

From source file:module.pandabox.presentation.PandaBox.java

License:Open Source License

private void initView() {
    setCompositionRoot(root);/*from   w ww .jav  a 2 s. c o  m*/
    root.setSizeFull();
    root.setSplitPosition(15);
    root.setStyleName("small previews");

    previewArea.setWidth("100%");
    previewTabs = new VerticalLayout();
    previewTabs.setSizeFull();
    previewTabs.setHeight(null);

    compoundTabs = new VerticalLayout();
    compoundTabs.setSizeFull();
    compoundTabs.setHeight(null);

    bennuStylesTabs = new VerticalLayout();
    bennuStylesTabs.setSizeFull();
    bennuStylesTabs.setHeight(null);

    VerticalLayout menu = new VerticalLayout();
    menu.setSizeFull();
    menu.setStyleName("sidebar-menu");

    Button syncThemes = new Button("Sync Themes", new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            syncThemes();
        }
    });
    menu.addComponent(syncThemes);
    menu.addComponent(new Label("Single Components"));
    menu.addComponent(previewTabs);
    menu.addComponent(new Label("Compound Styles"));
    menu.addComponent(compoundTabs);

    menu.addComponent(new Label("Bennu Styles"));
    menu.addComponent(bennuStylesTabs);

    root.setFirstComponent(menu);

    CssLayout toolbar = new CssLayout();
    toolbar.setWidth("100%");
    toolbar.setStyleName("toolbar");
    toolbar.addComponent(editorToggle);

    final Window downloadWindow = new Window("Download Theme");
    GridLayout l = new GridLayout(3, 2);
    l.setSizeUndefined();
    l.setMargin(true);
    l.setSpacing(true);
    downloadWindow.setContent(l);
    downloadWindow.setModal(true);
    downloadWindow.setResizable(false);
    downloadWindow.setCloseShortcut(KeyCode.ESCAPE, null);
    downloadWindow.addStyleName("opaque");
    Label caption = new Label("Theme Name");
    l.addComponent(caption);
    l.setComponentAlignment(caption, Alignment.MIDDLE_CENTER);
    final TextField name = new TextField();
    name.setValue("my-chameleon");
    name.addValidator(new RegexpValidator("[a-zA-Z0-9\\-_\\.]+", "Only alpha-numeric characters allowed"));
    name.setRequired(true);
    name.setRequiredError("Please give a name for the theme");
    downloadWindow.addComponent(name);
    Label info = new Label(
            "This is the name you will use to set the theme in your application code, i.e. <code>setTheme(\"my-cameleon\")</code>.",
            Label.CONTENT_XHTML);
    info.addStyleName("tiny");
    info.setWidth("200px");
    l.addComponent(info, 1, 1, 2, 1);

    Button download = new Button(null, new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            getApplication().getMainWindow().addWindow(downloadWindow);
            name.focus();
        }
    });
    download.setDescription("Donwload the current theme");
    download.setIcon(new ThemeResource("download.png"));
    download.setStyleName("icon-only");
    toolbar.addComponent(download);

    menu.addComponent(toolbar);
    menu.setExpandRatio(toolbar, 1);
    menu.setComponentAlignment(toolbar, Alignment.BOTTOM_CENTER);

}

From source file:module.pandabox.presentation.PandaBox.java

License:Open Source License

Layout getWindowPreviews() {
    Layout grid = getPreviewLayout("Windows");

    Button win = new Button("Open normal sub-window", new Button.ClickListener() {
        @Override/*from w  w w. j  av a2 s. c o m*/
        public void buttonClick(ClickEvent event) {
            getApplication().getMainWindow().addWindow(new Window("Normal window"));
        }
    });
    grid.addComponent(win);
    win.setDescription("new Window()");

    win = new Button("Open opaque sub-window", new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            Window w = new Window("Window.addStyleName(\"opaque\")");
            w.addStyleName("opaque");
            getApplication().getMainWindow().addWindow(w);
        }
    });
    grid.addComponent(win);
    win.setDescription("Window.addStyleName(\"opaque\")");

    return grid;
}

From source file:org.eclipse.hawkbit.ui.common.builder.WindowBuilder.java

License:Open Source License

private void decorateWindow(final Window window) {
    if (id != null) {
        window.setId(id);//w w  w  .  j  ava 2  s .c o m
    }

    if (SPUIDefinitions.CONFIRMATION_WINDOW.equals(type)) {
        window.setDraggable(false);
        window.setClosable(true);
        window.addStyleName(SPUIStyleDefinitions.CONFIRMATION_WINDOW_CAPTION);

    } else if (SPUIDefinitions.CREATE_UPDATE_WINDOW.equals(type)) {
        window.setDraggable(true);
        window.setClosable(true);
    }
}

From source file:org.eclipse.hawkbit.ui.distributions.smtable.SwModuleDetails.java

License:Open Source License

private void showArtifactDetailsWindow(final SoftwareModule softwareModule) {
    final Window artifactDtlsWindow = new Window();
    artifactDtlsWindow.setCaption(HawkbitCommonUtil.getArtifactoryDetailsLabelId(
            softwareModule.getName() + "." + softwareModule.getVersion(), getI18n()));
    artifactDtlsWindow.setCaptionAsHtml(true);
    artifactDtlsWindow.setClosable(true);
    artifactDtlsWindow.setResizable(true);
    artifactDtlsWindow.setImmediate(true);
    artifactDtlsWindow.setWindowMode(WindowMode.NORMAL);
    artifactDtlsWindow.setModal(true);// w w w  .j a va2  s .  c o  m
    artifactDtlsWindow.addStyleName(SPUIStyleDefinitions.CONFIRMATION_WINDOW_CAPTION);

    artifactDetailsLayout.setFullWindowMode(false);
    artifactDetailsLayout.populateArtifactDetails(softwareModule);
    artifactDetailsLayout.getArtifactDetailsTable().setWidth(700, Unit.PIXELS);
    artifactDetailsLayout.getArtifactDetailsTable().setHeight(500, Unit.PIXELS);
    artifactDtlsWindow.setContent(artifactDetailsLayout.getArtifactDetailsTable());

    artifactDtlsWindow.addWindowModeChangeListener(event -> {
        if (event.getWindowMode() == WindowMode.MAXIMIZED) {
            artifactDtlsWindow.setSizeFull();
            artifactDetailsLayout.setFullWindowMode(true);
            artifactDetailsLayout.createMaxArtifactDetailsTable();
            artifactDetailsLayout.getMaxArtifactDetailsTable().setWidth(100, Unit.PERCENTAGE);
            artifactDetailsLayout.getMaxArtifactDetailsTable().setHeight(100, Unit.PERCENTAGE);
            artifactDtlsWindow.setContent(artifactDetailsLayout.getMaxArtifactDetailsTable());
        } else {
            artifactDtlsWindow.setSizeUndefined();
            artifactDtlsWindow.setContent(artifactDetailsLayout.getArtifactDetailsTable());
        }
    });
    UI.getCurrent().addWindow(artifactDtlsWindow);
}

From source file:org.opencms.ui.actions.CmsUserInfoDialogAction.java

License:Open Source License

/**
 * @see org.opencms.ui.actions.I_CmsWorkplaceAction#executeAction(org.opencms.ui.I_CmsDialogContext)
 *//*from   w ww .  j a va  2 s . c  om*/
public void executeAction(final I_CmsDialogContext context) {

    CmsUserInfo dialog = new CmsUserInfo(new I_UploadListener() {

        public void onUploadFinished(List<String> uploadedFiles) {

            handleUpload(uploadedFiles, context);
        }
    }, context);
    Multimap<String, String> params = A_CmsUI.get().getParameters();
    int top = 55;
    int left = 0;
    if (params.containsKey("left")) {
        String buttonLeft = params.get("left").iterator().next();
        left = Integer.parseInt(buttonLeft) - 290;
    }
    final Window window = new Window();
    window.setModal(false);
    window.setClosable(true);
    window.setResizable(false);
    window.setContent(dialog);
    context.setWindow(window);
    window.addStyleName(OpenCmsTheme.DROPDOWN);
    UI.getCurrent().addWindow(window);
    window.setPosition(left, top);
}