Example usage for com.vaadin.ui VerticalLayout setExpandRatio

List of usage examples for com.vaadin.ui VerticalLayout setExpandRatio

Introduction

In this page you can find the example usage for com.vaadin.ui VerticalLayout setExpandRatio.

Prototype

public void setExpandRatio(Component component, float ratio) 

Source Link

Document

This method is used to control how excess space in layout is distributed among components.

Usage

From source file:edu.nps.moves.mmowgli.modules.registrationlogin.RegistrationPageBase.java

License:Open Source License

@Override
public void initGui() {
    setWidth("988px"); // same width as included panel
    setHeight(BIGGESTWINDOW_HEIGHT_S); // try to handle making the popup miss the video

    Instrumentation.addInstrumentation(this);

    Game game = Game.getTL();/*  w  w  w . j  a va 2s. co m*/
    MovePhase phase = game.getCurrentMove().getCurrentMovePhase();

    HorizontalLayout outerLayout = new HorizontalLayout();
    outerLayout.setSpacing(true);
    addComponent(outerLayout);
    outerLayout.setWidth("988px");
    setExpandRatio(outerLayout, 1);
    Label spacer;

    outerLayout.addComponent(baseVLayout = new VerticalLayout());
    baseVLayout.setWidth("988px");
    outerLayout.setComponentAlignment(baseVLayout, Alignment.TOP_CENTER);
    baseVLayout.setSpacing(true);

    // This is just to give us a hidden widget to update to keep push channel alive through Akamai
    outerLayout.addComponent(pushPingLab = new HtmlLabel(""));
    pushPingLab.setWidth("5px");

    String headingStr = phase.getOrientationCallToActionText();
    String summaryStr = phase.getOrientationHeadline();
    String textStr = phase.getOrientationSummary();
    Media vid = phase.getOrientationVideo();

    vidPan = new VideoWithRightTextPanel(vid, headingStr, summaryStr, textStr, null);
    vidPan.setLargeText(true);
    baseVLayout.addComponent(vidPan);
    vidPan.initGui();

    HorizontalLayout bottomHLayout = new HorizontalLayout();
    bottomHLayout.addComponent(spacer = new Label()); // special spacer
    bottomHLayout.setExpandRatio(spacer, 1.0f);

    Label[] spacers = new Label[5];

    Label lab;
    int numButts = 0;

    // Email signup button
    //-----------------------
    if (phase.isSignupButtonShow()) {
        VerticalLayout signupVL = new VerticalLayout();
        signupVL.setHeight("50px");
        signupVL.setMargin(false);

        if (mockupOnly)
            signupVL.addComponent(signupButt = new NativeButton(null)); // no handler
        else
            signupVL.addComponent(signupButt = new NativeButton(null, this));
        signupButt.addStyleName("signupbutton");
        signupButt.setEnabled(phase.isSignupButtonEnabled());
        Mmowgli2UI.getGlobals().mediaLocator().decorateImageButton(signupButt, phase.getSignupButtonIcon());
        signupVL.setComponentAlignment(signupButt, Alignment.MIDDLE_CENTER);

        signupVL.addComponent(lab = new Label());
        lab.setHeight("1px");
        signupVL.setExpandRatio(lab, 1.0f);

        signupVL.addComponent(lab = new HtmlLabel(phase.getSignupButtonSubText()));
        lab.addStyleName("m-text-align-center");
        signupButt.setDescription(phase.getSignupButtonToolTip());
        lab.setDescription(phase.getSignupButtonToolTip());
        lab.setEnabled(phase.isSignupButtonEnabled());
        signupVL.setComponentAlignment(lab, Alignment.MIDDLE_CENTER);

        bottomHLayout.addComponent(signupVL);
        numButts++;
    }

    // New player reg button
    //----------------------
    if (phase.isNewButtonShow()) {
        if (numButts > 0)
            bottomHLayout.addComponent(spacers[numButts] = new Label());

        VerticalLayout newButtVL = new VerticalLayout();
        newButtVL.setHeight("50px");
        newButtVL.setMargin(false);

        if (mockupOnly)
            newButtVL.addComponent(imNewButt = new NativeButton(null)); // no handler
        else
            newButtVL.addComponent(imNewButt = new NativeButton(null, this));
        imNewButt.setEnabled(phase.isNewButtonEnabled());
        imNewButt.addStyleName("newuserbutton");
        Mmowgli2UI.getGlobals().mediaLocator().decorateImageButton(imNewButt, phase.getNewButtonIcon());
        newButtVL.setComponentAlignment(imNewButt, Alignment.MIDDLE_CENTER);

        newButtVL.addComponent(lab = new Label());
        lab.setHeight("1px");
        newButtVL.setExpandRatio(lab, 1.0f);

        /*
              boolean gameRO = game.isReadonly();
              boolean gameClamped = game.isRegisteredLogonsOnly();
              imNewButt.setEnabled(!gameRO & !gameClamped);
                
              // Label lab;
              if (gameRO) {
                newButtVL.addComponent(lab = new Label("No new player accounts, for now")); // "Player registration is currently closed"));
                                                                            // //"Sorry, no more new players"));
                String s;
                lab.setDescription(s = "New player accounts will open when game play starts");
                imNewButt.setDescription(s);
              }
              else if (gameClamped)
                newButtVL.addComponent(lab = new Label("The game is full, please retry later")); // "Sorry, no more new players"));
              else
                newButtVL.addComponent(lab = new Label("You can get started in 2 minutes..."));
        */
        newButtVL.addComponent(lab = new HtmlLabel(phase.getNewButtonSubText()));
        newButtVL.setComponentAlignment(lab, Alignment.MIDDLE_CENTER);
        lab.addStyleName("m-text-align-center");
        lab.setEnabled(phase.isNewButtonEnabled());
        imNewButt.setDescription(phase.getNewButtonToolTip());
        lab.setDescription(phase.getNewButtonToolTip());

        newButtVL.setComponentAlignment(lab, Alignment.MIDDLE_CENTER);

        bottomHLayout.addComponent(newButtVL);
        numButts++;
    }

    // Existing player button
    //-----------------------
    if (phase.isLoginButtonShow()) {
        if (numButts > 0)
            bottomHLayout.addComponent(spacers[numButts] = new Label());

        VerticalLayout rightButtVL = new VerticalLayout();
        rightButtVL.setHeight("50px");
        rightButtVL.setMargin(false);

        if (mockupOnly)
            rightButtVL.addComponent(imRegisteredButt = new NativeButton(null)); // no handler
        else
            rightButtVL.addComponent(imRegisteredButt = new NativeButton(null, this));
        imRegisteredButt.addStyleName("loginbutton");
        imRegisteredButt.setEnabled(phase.isLoginButtonEnabled());

        Mmowgli2UI.getGlobals().mediaLocator().decorateImageButton(imRegisteredButt,
                phase.getLoginButtonIcon());
        rightButtVL.setComponentAlignment(imRegisteredButt, Alignment.MIDDLE_CENTER);

        rightButtVL.addComponent(lab = new Label());
        lab.setHeight("1px");
        rightButtVL.setExpandRatio(lab, 1.0f);

        rightButtVL.addComponent(lab = new HtmlLabel(phase.getLoginButtonSubText()));
        lab.addStyleName("m-text-align-center");
        lab.setEnabled(phase.isLoginButtonEnabled());
        rightButtVL.setComponentAlignment(lab, Alignment.MIDDLE_CENTER);

        imRegisteredButt.setDescription(phase.getLoginButtonToolTip());
        lab.setDescription(phase.getLoginButtonToolTip());

        bottomHLayout.addComponent(rightButtVL);
        numButts++;

        checkQuickCACLoginTL();
    }

    // Guest signup button
    //-----------------------
    if (phase.isGuestButtonShow()) {
        if (numButts > 0)
            bottomHLayout.addComponent(spacers[numButts] = new Label());

        VerticalLayout guestButtVL = new VerticalLayout();
        guestButtVL.setHeight("50px");
        guestButtVL.setMargin(false);

        if (mockupOnly)
            guestButtVL.addComponent(guestButt = new NativeButton(null));
        else
            guestButtVL.addComponent(guestButt = new NativeButton(null, this));
        guestButt.addStyleName("guestbutton");
        guestButt.setEnabled(phase.isGuestButtonEnabled());

        Mmowgli2UI.getGlobals().mediaLocator().decorateImageButton(guestButt, phase.getGuestButtonIcon());
        guestButtVL.setComponentAlignment(guestButt, Alignment.MIDDLE_CENTER);

        guestButtVL.addComponent(lab = new Label());
        lab.setHeight("1px");
        guestButtVL.setExpandRatio(lab, 1.0f);

        guestButtVL.addComponent(lab = new HtmlLabel(phase.getGuestButtonSubText()));
        lab.addStyleName("m-text-align-center");
        guestButtVL.setComponentAlignment(lab, Alignment.MIDDLE_CENTER);

        guestButt.setDescription(phase.getGuestButtonToolTip());
        lab.setDescription(phase.getGuestButtonToolTip());
        lab.setEnabled(phase.isGuestButtonEnabled());
        bottomHLayout.addComponent(guestButtVL);
        numButts++;
    }

    for (int i = 0; i < numButts; i++)
        if (spacers[i] != null)
            spacers[i].setWidth(BUTTON_SPACING[numButts]);

    bottomHLayout.addComponent(spacer = new Label()); // special spacer
    bottomHLayout.setExpandRatio(spacer, 1.0f);

    baseVLayout.addComponent(bottomHLayout);
    baseVLayout.setComponentAlignment(bottomHLayout, Alignment.TOP_CENTER);

    lab = new HtmlLabel(
            "<center>Each MMOWGLI game is independent.<br>&nbsp;You need a new account for every game.&nbsp;</center>");
    lab.setSizeUndefined();
    lab.addStyleName("m-margintop-20");
    lab.addStyleName("m-greyborder");
    lab.addStyleName("m-background-white");
    lab.addStyleName("m-opacity-75");
    baseVLayout.addComponent(lab);
    baseVLayout.setComponentAlignment(lab, Alignment.MIDDLE_CENTER);

    String troubleUrl = GameLinks.getTL().getTroubleLink();
    Link lnk = new Link("Trouble signing in?", new ExternalResource(troubleUrl));
    baseVLayout.addComponent(lnk);
    lnk.setTargetName(PORTALTARGETWINDOWNAME);
    lnk.setTargetBorder(BorderStyle.DEFAULT);
    lnk.addStyleName("m-margin-top-20");
    baseVLayout.setComponentAlignment(lnk, Alignment.MIDDLE_CENTER);

    //checkUserLimits();  done from app entry point
}

From source file:edu.nps.moves.mmowgli.modules.userprofile.DefineAwardsDialog.java

License:Open Source License

@HibernateSessionThreadLocalConstructor
public DefineAwardsDialog() {
    setCaption("Define Player Award Types");
    setModal(true);/*  w w  w. j  av a 2s  . com*/
    setSizeUndefined();
    setWidth("700px");
    setHeight("400px");

    VerticalLayout vLay = new VerticalLayout();
    vLay.setMargin(true);
    vLay.setSpacing(true);
    vLay.setSizeFull();
    setContent(vLay);

    vLay.addComponent(new HtmlLabel("<b>This dialog is not yet functional</b>"));

    Panel p = new Panel();
    p.setWidth("99%");
    p.setHeight("100%");
    vLay.addComponent(p);
    vLay.setExpandRatio(p, 1.0f);

    gridLayout = new GridLayout();
    gridLayout.addStyleName("m-headgrid");
    gridLayout.setWidth("100%");
    p.setContent(gridLayout);
    fillPanelTL();

    HorizontalLayout buttPan = new HorizontalLayout();
    buttPan.setWidth("100%");
    buttPan.setSpacing(true);
    NativeButton addButt = new NativeButton("Add new type", new AddListener());
    NativeButton delButt = new NativeButton("Delete type", new DelListener());
    NativeButton saveButt = new NativeButton("Save", new SaveListener());
    NativeButton cancelButt = new NativeButton("Cancel", new CancelListener());
    buttPan.addComponent(addButt);
    buttPan.addComponent(delButt);

    Label lab;
    buttPan.addComponent(lab = new Label());
    buttPan.setExpandRatio(lab, 1.0f);
    buttPan.addComponent(cancelButt);
    buttPan.addComponent(saveButt);
    vLay.addComponent(buttPan);

    //temp
    saveButt.setEnabled(false);
    delButt.setEnabled(false);
}

From source file:edu.nps.moves.mmowgli.modules.userprofile.ManageAwardsDialog.java

License:Open Source License

@HibernateSessionThreadLocalConstructor
public ManageAwardsDialog(Object uId) {
    this.uId = uId;
    User u = User.getTL(uId);//from  w  ww.j a va2  s. c o m

    setCaption("Manage Awards for " + u.getUserName());
    setModal(true);
    setSizeUndefined();
    setWidth("625px");
    setHeight("400px");

    VerticalLayout vLay = new VerticalLayout();
    vLay.setMargin(true);
    vLay.setSpacing(true);
    vLay.setSizeFull();
    setContent(vLay);

    Panel p = new Panel("Award Assignments -- a check applies the award to player " + u.getUserName());
    p.setWidth("99%");
    p.setHeight("99%");
    vLay.addComponent(p);
    vLay.setExpandRatio(p, 1.0f);

    gridLayout = new GridLayout();
    gridLayout.addStyleName("m-headgrid");
    gridLayout.setWidth("100%");
    p.setContent(gridLayout);
    fillPanelTL(u); //@HibernateUserRead

    HorizontalLayout buttPan = new HorizontalLayout();
    buttPan.setWidth("100%");
    buttPan.setSpacing(true);
    NativeButton defineButt = new NativeButton("Define Award Types", new DefineListener());
    NativeButton saveButt = new NativeButton("Save", new SaveListener());
    NativeButton cancelButt = new NativeButton("Cancel", new CancelListener());

    buttPan.addComponent(defineButt);
    Label lab;
    buttPan.addComponent(lab = new Label());
    buttPan.setExpandRatio(lab, 1.0f);
    buttPan.addComponent(cancelButt);
    buttPan.addComponent(saveButt);
    vLay.addComponent(buttPan);
}

From source file:edu.nps.moves.mmowgli.modules.userprofile.UserProfileMyIdeasPanel2.java

License:Open Source License

@SuppressWarnings("unchecked")
private Component createProfileTL() {
    VerticalLayout lay = new VerticalLayout();
    lay.setWidth("670px");
    Label lab;/*from  ww  w. ja va 2 s .c  o m*/
    lay.addComponent(lab = new Label());
    lab.setHeight("10px");

    VerticalLayout innerVL = new VerticalLayout();
    innerVL.setSpacing(true);
    innerVL.setMargin(true);
    innerVL.setWidth("100%"); //"90%");   
    innerVL.addStyleName("m-myideaprofile-table");
    lay.addComponent(innerVL);

    GridLayout gridL = new GridLayout();
    gridL.setColumns(2);
    gridL.addStyleName("m-userprofile-text");
    gridL.setSpacing(true);

    CardType ct;
    int count = 0;
    int largest = -1;

    List<Card> lisPos = commonCriteria()
            .add(Restrictions.eq("cardType",
                    ct = CardType
                            .getCurrentPositiveIdeaCardTypeTL()/*CardTypeManager.getPositiveIdeaCardTypeTL()*/))
            .list();
    count += lisPos.size();
    largest = Math.max(largest, lisPos.size());

    List<Card> lisNeg = commonCriteria()
            .add(Restrictions.eq("cardType", ct = CardType.getCurrentNegativeIdeaCardTypeTL())).list(); //CardTypeManager.getNegativeIdeaCardTypeTL())).list();
    count += lisNeg.size();
    largest = Math.max(largest, lisNeg.size());

    List<Card> lisExpand = commonCriteria().add(Restrictions.eq("cardType", ct = CardType.getExpandTypeTL()))
            .list();//CardTypeManager.getExpandTypeTL())).list();
    count += lisExpand.size();
    largest = Math.max(largest, lisExpand.size());

    List<Card> lisAdapt = commonCriteria().add(Restrictions.eq("cardType", ct = CardType.getAdaptTypeTL()))
            .list();//CardTypeManager.getAdaptTypeTL())).list();
    count += lisAdapt.size();
    largest = Math.max(largest, lisAdapt.size());

    List<Card> lisCounter = commonCriteria().add(Restrictions.eq("cardType", ct = CardType.getCounterTypeTL()))
            .list();//CardTypeManager.getCounterTypeTL())).list();
    count += lisCounter.size();
    largest = Math.max(largest, lisCounter.size());

    List<Card> lisExplore = commonCriteria().add(Restrictions.eq("cardType", ct = CardType.getExploreTypeTL()))
            .list();//CardTypeManager.getExploreTypeTL())).list();
    count += lisExplore.size();
    largest = Math.max(largest, lisExplore.size());

    ct = CardType.getCurrentPositiveIdeaCardTypeTL(); //CardTypeManager.getPositiveIdeaCardTypeTL();
    row(ct.getSummaryHeader(), largest, lisPos.size(), ct, gridL);
    ct = CardType.getCurrentNegativeIdeaCardTypeTL(); //CardTypeManager.getNegativeIdeaCardTypeTL();
    row(ct.getSummaryHeader(), largest, lisNeg.size(), ct, gridL);
    ct = CardType.getExpandTypeTL(); //CardTypeManager.getExpandTypeTL();
    row(ct.getSummaryHeader(), largest, lisExpand.size(), ct, gridL);
    ct = CardType.getAdaptTypeTL(); //CardTypeManager.getAdaptTypeTL();
    row(ct.getSummaryHeader(), largest, lisAdapt.size(), ct, gridL);
    ct = CardType.getCounterTypeTL(); //CardTypeManager.getCounterTypeTL();
    row(ct.getSummaryHeader(), largest, lisCounter.size(), ct, gridL);
    ct = CardType.getExploreTypeTL(); //CardTypeManager.getExploreTypeTL();
    row(ct.getSummaryHeader(), largest, lisExplore.size(), ct, gridL);

    gridL.addComponent(new Label(""));
    gridL.addComponent(new Label(""));
    gridL.addComponent(new Label("TOTAL"));
    gridL.addComponent(new Label("" + count));

    innerVL.addComponent(gridL);

    lay.addComponent(lab = new Label());
    lab.setHeight("1px");
    lay.setExpandRatio(lab, 1.0f);
    return lay;
}

From source file:edu.nps.moves.mmowgli.modules.userprofile.UserProfileMyIdeasPanel2.java

License:Open Source License

private Component createTable(HbnContainer<Card> cntnr, Object nullComponent) {
    Collection<?> ids = cntnr.getItemIds();
    if (ids.size() <= 0) {
        if (nullComponent instanceof String) {
            VerticalLayout vl = new VerticalLayout();
            vl.setWidth("670px");
            Label lab;//from   w w w . ja va  2 s  .  co  m
            vl.addComponent(lab = new Label((String) nullComponent));
            lab.addStyleName("m-userprofile-tabpanel-font");
            lab.setSizeUndefined(); // prevents 100% w
            vl.setComponentAlignment(lab, Alignment.TOP_CENTER);
            vl.addComponent(lab = new Label());
            vl.setExpandRatio(lab, 1.0f);
            return vl;
        }
        return buildNoIdeasYet();
    }
    Table tab = new CardTableSimple(null, cntnr);
    tab.setPageLength(40);
    tab.addStyleName("m-greyborder");
    return tab;
}

From source file:edu.nps.moves.mmowgli.modules.userprofile.UserProfileMyMailPanel.java

License:Open Source License

@Override
public void initGui() {
    super.initGui();

    String left = "Players can choose to receive messages in-game or externally (or both or neither).<br/><br/>Player messages are private and"
            + " actual email identities are hidden.<br/><br/>You can find another player's profile by clicking on their name or using the search"
            + " feature. Then you may send a message to that player by clicking on the "
            + "<i>Send player private email</i> link.<br/><br/>If this link is not present or is disabled, then the player has opted "
            + "to receive neither email nor in-game messages.<br/><br/>";
    getLeftLabel().setValue(left);//from   w w w .j a  v a 2s  .  co  m

    if (!userIsMe) {
        User u = User.getTL(uid);
        if (u.isOkEmail() || u.isOkGameMessages()) {
            final NativeButton sendEmailButt = new NativeButton("Send private mail to this user");
            sendEmailButt.addStyleName(BaseTheme.BUTTON_LINK);
            sendEmailButt.addStyleName("m-userProfile3-sendmail-button");
            Label sp;
            VerticalLayout vl = getRightLayout();

            vl.setSizeUndefined();
            vl.setWidth("100%");
            vl.addComponent(sp = new Label());
            sp.setHeight("50px");
            vl.addComponent(sendEmailButt);
            vl.setComponentAlignment(sendEmailButt, Alignment.MIDDLE_CENTER);
            vl.addComponent(sp = new Label());
            sp.setHeight("1px");
            vl.setExpandRatio(sp, 1.0f);

            sendEmailButt.addClickListener(new ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                @MmowgliCodeEntry
                @HibernateOpened
                @HibernateClosed
                public void buttonClick(ClickEvent event) {
                    HSess.init();

                    User u = User.getTL(uid);
                    if (u.isOkEmail() || u.isOkGameMessages()) // redundant here
                        new SendMessageWindow(u, imAdminOrGameMaster);
                    else
                        Notification.show("Sorry", "Player " + u.getUserName() + " does not receive mail.",
                                Notification.Type.WARNING_MESSAGE);

                    HSess.close();
                }
            });
        }
        return;
    }
    VerticalLayout rightVL = getRightLayout();
    rightVL.setSizeUndefined();
    rightVL.setWidth("100%");

    getLeftAddedVerticalLayout()
            .addComponent(showButt = new ToggleLinkButton("View all", "View unhidden only", null)); //,ttArray));
    showButt.addOnListener(new ViewAllListener());
    showButt.addOffListener(new ViewUnhiddenOnlyListener());
    showButt.setToolTips("Temporarily show all messages, including those marked \"hidden\"",
            "Temporarily hide messages marked \"hidden\"");
    Label sp;
    rightVL.addComponent(sp = new Label());
    sp.setHeight("10px");
    rightVL.addComponent(mailPanel);

    User me = Mmowgli2UI.getGlobals().getUserTL();
    Set<Message> msgs = me.getGameMessages();
    if (msgs.size() > 0) {
        Message[] msgsAr = new Message[msgs.size()];
        msgsAr = msgs.toArray(msgsAr); // avoid concurrent mod
        int num = msgsAr.length;// .size();
        int n = num;
        for (Message m : msgsAr) {
            addOneMessage(m, n--, num, null);
        }
    }
}

From source file:edu.nps.moves.mmowgli.utility.HistoryDialog.java

License:Open Source License

public HistoryDialog(SortedSet<Edits> set, String windowTitle, String tableTitle, String columnTitle,
        DoneListener dLis) {//  ww  w .j  ava  2s . c o m
    this.set = set;
    this.doneListener = dLis;

    setCaption(windowTitle);
    setModal(true);
    setWidth("500px");
    setHeight("400px");

    VerticalLayout vLay = new VerticalLayout();
    setContent(vLay);
    vLay.setSizeFull();
    table = new Table(tableTitle);
    table.setSelectable(true);
    table.setContainerDataSource(makeContainer());
    table.addValueChangeListener(new TableListener());
    table.setVisibleColumns(new Object[] { "label", "string" });
    table.setColumnHeaders(new String[] { "", columnTitle });
    table.setImmediate(true);

    table.setSizeFull();
    table.setItemDescriptionGenerator(new ItemDescriptionGenerator() {
        private static final long serialVersionUID = 1L;

        public String generateDescription(Component source, Object itemId, Object propertyId) {
            return ((StringBean) itemId).string;
        }
    });

    vLay.addComponent(table);
    vLay.setExpandRatio(table, 1.0f);
    MediaLocator mLoc = Mmowgli2UI.getGlobals().getMediaLocator();
    HorizontalLayout buttLay = new HorizontalLayout();
    vLay.addComponent(buttLay);
    vLay.setComponentAlignment(buttLay, Alignment.TOP_RIGHT);
    cancelButt = new NativeButton();
    mLoc.decorateCancelButton(cancelButt);
    buttLay.addComponent(cancelButt);
    buttLay.setComponentAlignment(cancelButt, Alignment.BOTTOM_RIGHT);

    okButt = new NativeButton();
    mLoc.decorateOkButton(okButt);
    buttLay.addComponent(okButt);
    buttLay.setComponentAlignment(okButt, Alignment.BOTTOM_RIGHT);
    okButt.setEnabled(false);

    cancelButt.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        @MmowgliCodeEntry
        @HibernateOpened
        @HibernateClosed
        public void buttonClick(ClickEvent event) {
            HSess.init();
            UI.getCurrent().removeWindow(HistoryDialog.this);
            if (doneListener != null)
                doneListener.doneTL(null, -1);
            HSess.close();
        }
    });
    okButt.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        @MmowgliCodeEntry
        @HibernateOpened
        @HibernateClosed
        public void buttonClick(ClickEvent event) {
            HSess.init();
            UI.getCurrent().removeWindow(HistoryDialog.this);
            StringBean obj = (StringBean) table.getValue();
            if (doneListener != null) {
                if (obj != null) {
                    int idx = obj.getOrder();
                    doneListener.doneTL(obj.getString(), idx);
                } else
                    doneListener.doneTL(null, -1);
            }
            HSess.close();
        }
    });
}

From source file:edu.nps.moves.mmowgliMobile.ui.NotAllowedPopover.java

License:Open Source License

@SuppressWarnings("serial")
public NotAllowedPopover() {
    setWidth("75%");

    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);//from ww w .j  a va 2s  .  c om
    layout.setSpacing(true);
    setHeight("150px");

    Label lbl;
    layout.addComponent(
            lbl = new Label("This mmowgli game does not allow guest access.  Thank you for your interest."));

    layout.setExpandRatio(lbl, 1.0f);
    Button closeButt;
    layout.addComponent(closeButt = new Button("Close"));

    NavigationView nv = new NavigationView(layout);
    nv.setCaption("Access Not Allowed");
    setContent(nv);
    this.center();

    closeButt.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            HSess.init();
            GameLinks links = GameLinks.getTL();
            HSess.close();

            UI.getCurrent().getPage().setLocation(links.getThanksForInterestLink());
            getSession().close();
        }
    });
}

From source file:edu.vcu.csbc.vahmpexplorer.main.VaHMPExplorer.java

private void buildMainLayout() {
    main = new Window("VaHMP Explorer");
    setMainWindow(main);//from  w  ww.java2s .  c om
    setMainComponent(getListView());
    VerticalLayout v = new VerticalLayout();
    v.addComponent(createToolBar(showLogin));
    v.addComponent(horiztonalSplit);
    v.setSizeFull();

    v.setExpandRatio(horiztonalSplit, 1);
    horiztonalSplit.setSplitPosition(250, HorizontalSplitPanel.UNITS_PIXELS);

    horiztonalSplit.setFirstComponent(getRunViewer());
    getMainWindow().setContent(v);
    getMainWindow().addListener((Window.CloseListener) this);
    if (login != null) {
        getMainWindow().removeWindow(login);

        String newURL = getURL().toString().replace(":8080", "");
        newURL = getURL().toString();
        login.open(new ExternalResource(newURL));
    }

}

From source file:eu.eco2clouds.portal.component.PictureWindow.java

License:Apache License

private void render() {

    VerticalLayout content = new VerticalLayout();
    content.setSpacing(true);/*from   w ww .  j  a v  a  2s .c om*/
    content.setMargin(true);
    content.setSizeFull();

    Image image = new Image();
    //image.setSource(new ThemeResource("img/applicationsample.png"));
    image.setSource(new FileResource(
            new File(Configuration.propertiesDir + File.separator + "sample_applicationprofile.png")));
    //image.setHeight("300px");
    content.addComponent(image);

    Button btnClose = new Button("Close");
    btnClose.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {

            close();
        }
    });

    content.addComponent(btnClose);
    content.setExpandRatio(image, 1.0f);
    content.setComponentAlignment(btnClose, Alignment.BOTTOM_CENTER);
    this.setContent(content);

    this.setHeight("450px");
    this.setWidth("900px");

    this.center();
    this.setModal(true);
}