Example usage for com.vaadin.ui Panel setContent

List of usage examples for com.vaadin.ui Panel setContent

Introduction

In this page you can find the example usage for com.vaadin.ui Panel setContent.

Prototype

@Override
public void setContent(Component content) 

Source Link

Document

Sets the content of this container.

Usage

From source file:edu.nps.moves.mmowgli.modules.cards.IdeaDashboardTabPanel.java

License:Open Source License

protected void buildCardTable() {
    VerticalLayout vLay = new VerticalLayout();
    vLay.setWidth("95%");
    vLay.setHeight("100%");
    getRightLayout().addComponent(vLay);

    vLay.addComponent(makeTableHeaders());

    Panel pan = new Panel();
    pan.setWidth("99%");
    pan.setHeight("99%");
    pan.setStyleName(Reindeer.PANEL_LIGHT);
    vLay.addComponent(pan);// w w w .ja v a2s  .  c  om
    vLay.setExpandRatio(pan, 1.0f); // all of it

    VerticalLayout tableLay;
    pan.setContent(tableLay = new VerticalLayout());
    pan.addStyleName("m-greyborder");
    tableLay.setWidth("99%");

    List<Card> cards = getCardList();

    for (Card c : cards) {
        if (confirmCard(c)) {
            CardSummaryLine csl;
            tableLay.addComponent(csl = new CardSummaryLine(c.getId()));
            csl.initGui();
            csl.setWidth("98%");
        }
    }
}

From source file:edu.nps.moves.mmowgli.modules.cards.IdeaDashboardTabSuperActive.java

License:Open Source License

@Override
public void initGui() {
    Label leftLabel = new Label("Super-active chains are sets of cards that have two or more authors "
            + "and four or more follow-on cards at two levels.");
    this.getLeftLayout().addComponent(leftLabel, "top:0px;left:0px");

    Panel pan = new Panel();
    getRightLayout().addComponent(pan, "top:0px;left:0px");
    pan.setSizeUndefined();/*ww  w .j  a v a2  s  .c om*/
    pan.setStyleName(Reindeer.PANEL_LIGHT);

    VerticalLayout tableLay = new VerticalLayout();
    pan.setContent(tableLay);
    tableLay.setMargin(false); // default comes back from panel w/ margins
    tableLay.setSizeUndefined();

    tree = new CardChainTree(null, true); // no cards at first
    tree.setWidth("680px");
    tree.setHeight("730px");
    tree.addStyleName("m-greyborder");
    tableLay.addComponent(tree);
}

From source file:edu.nps.moves.mmowgli.modules.gamemaster.SetBlogHeadlineWindow.java

License:Open Source License

@Override
public void attach() {
    Panel p = new Panel();
    setContent(p);//from  w ww  . j  a v a2 s.c om
    p.setSizeFull();

    VerticalLayout layout = new VerticalLayout();
    layout.addStyleName("m-blogheadline");
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setSizeFull();
    p.setContent(layout);

    layout.addComponent(infoLab = new Label(
            "Game masters can communicate with players throughout the game.  Add a new headling, tooltip and link here."));

    layout.addComponent(textLab = new Label("Enter headline:"));
    textTF = new TextField();
    textTF.setInputPrompt("Enter new headline or choose from previous ones below");
    textTF.setWidth("100%");
    textTF.addStyleName("m-blogtextfield");
    layout.addComponent(textTF);

    layout.addComponent(toolTipLab = new Label("Enter headline tooltip:"));
    toolTipTF = new TextField();
    toolTipTF.setWidth("100%");
    layout.addComponent(toolTipTF);

    layout.addComponent(urlLab = new Label("Enter blog entry url:"));
    urlTF = new TextField();
    urlTF.setWidth("100%");
    layout.addComponent(urlTF);

    table = new Table("Previous headlines");
    table.setSizeFull();
    table.setImmediate(true);
    table.setColumnExpandRatio("date", 1);
    table.setColumnExpandRatio("text", 1);
    table.setColumnExpandRatio("tooltip", 1);
    table.setColumnExpandRatio("url", 1);
    table.setSelectable(true);
    table.setMultiSelect(true); // return whole pojo
    table.addItemClickListener(this);
    table.setContainerDataSource(MessageUrl.getContainer());
    layout.addComponent(table);

    layout.addComponent(nullCheckBox);
    nullCheckBox.addValueChangeListener(new CBListener());
    HorizontalLayout buttHl = new HorizontalLayout();
    buttHl.setSpacing(true);
    buttHl.addComponent(cancelButt);
    buttHl.addComponent(okButt);
    layout.addComponent(buttHl);
    layout.setComponentAlignment(buttHl, Alignment.TOP_RIGHT);
    layout.setExpandRatio(table, 1.0f); // gets all
    setWidth("675px");
    setHeight("455px");
}

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);/*from www.  java 2  s . c  o m*/
    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  w  w.ja  v a  2s  . 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.vserver.exercises.videoMcq.QuestionForm.java

License:Apache License

/**
 * Builds UI components and the layout for them.
 *///from w w w  .j a va 2  s . c o m
private void doLayout() {

    VerticalLayout questionUI = new VerticalLayout();

    HorizontalLayout mainButtons = new HorizontalLayout();
    //mainButtons.setMargin(true);
    mainButtons.setSpacing(true);
    this.newQuestionBtn.setWidth(100, Unit.PIXELS);
    this.cancelButton.setWidth(100, Unit.PIXELS);
    this.saveButton.setWidth(100, Unit.PIXELS);
    mainButtons.addComponents(this.newQuestionBtn, this.cancelButton, this.saveButton);
    questionUI.addComponent(mainButtons);
    this.initTextFields();
    this.inputLayout.setSpacing(true);
    this.inputLayout.setDefaultComponentAlignment(Alignment.TOP_LEFT);
    VerticalLayout questionLayout = new VerticalLayout();

    this.timeLayout.setMargin(new MarginInfo(true, false, true, false));
    this.timeLayout.addComponents(new Label("<strong>Time:</strong>", ContentMode.HTML), this.timeLabel,
            new Label("<strong> / </strong>", ContentMode.HTML), this.durationLabel);
    this.timeLayout.setSpacing(true);
    questionLayout.addComponents(this.timeLayout, this.questionField);

    VerticalLayout correctAnswers = new VerticalLayout();
    correctAnswers.addComponents(this.answerField, this.answerDescriptionField);

    VerticalLayout wrongAnswers = new VerticalLayout();
    wrongAnswers.setCaption("Incorrect answer choices");
    HorizontalLayout wrongAnswerButtons = new HorizontalLayout();
    wrongAnswerButtons.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    wrongAnswerButtons.setSpacing(true);
    wrongAnswerButtons.setMargin(true);
    wrongAnswerButtons.addComponents(this.addIncorrectAnswer, this.clearIncorrectAnswers);

    Panel wrongAswersScroller = new Panel();
    wrongAswersScroller.setSizeUndefined();
    wrongAswersScroller.setHeight(100, Unit.PIXELS);
    wrongAswersScroller.setWidth(215, Unit.PIXELS);
    wrongAswersScroller.addStyleName("borderless");

    wrongAswersScroller.setContent(this.wrongAnswersLayout);
    wrongAnswers.addComponents(wrongAnswerButtons, wrongAswersScroller);

    this.inputLayout.addComponents(questionLayout, correctAnswers, wrongAnswers);
    questionUI.addComponent(this.inputLayout);
    this.setCompositionRoot(questionUI);
}

From source file:eu.eco2clouds.portal.page.SubmissionLayout.java

License:Apache License

public SubmissionLayout() {

    Panel apPanel = new Panel();
    //apPanel.setStyleName("e2c");
    apPanel.setWidth("100%");
    apPanel.setHeight("400px");

    apPanel.setContent(new ApplicationProfileLayout());

    this.addComponent(apPanel);

    //Panel notificationPanel = new Panel();
    //notificationPanel.setStyleName("e2c");
    //notificationPanel.setWidth("100%");
    //notificationPanel.setHeight("100%");
    //notificationPanel.setContent(notificationTable);

    //this.addComponent(notificationPanel);
    //this.setExpandRatio(apPanel, 1.0f);
    //this.setExpandRatio(notificationPanel, 1.5f);

}

From source file:eu.hurion.hello.vaadin.shiro.application.HelloScreen.java

License:Apache License

public HelloScreen(final HerokuShiroApplication app) {
    setSizeFull();//from w ww .j  a v  a 2s.c o  m
    final Subject currentUser = SecurityUtils.getSubject();

    final Panel welcomePanel = new Panel();
    final FormLayout content = new FormLayout();
    final Label label = new Label("Logged in as " + currentUser.getPrincipal().toString());
    logout = new Button("logout");
    logout.addClickListener(new HerokuShiroApplication.LogoutListener(app));

    content.addComponent(label);
    content.addComponent(logout);
    welcomePanel.setContent(content);
    welcomePanel.setWidth("400px");
    welcomePanel.setHeight("200px");
    addComponent(welcomePanel);
    setComponentAlignment(welcomePanel, Alignment.MIDDLE_CENTER);

    final HorizontalLayout footer = new HorizontalLayout();
    footer.setHeight("50px");
    addComponent(footer);

    final Button adminButton = new Button("For admin only");
    adminButton.setEnabled(currentUser.hasRole("admin"));
    adminButton.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(final Button.ClickEvent event) {
            Notification.show("you're an admin");
        }
    });
    content.addComponent(adminButton);

    final Button userButton = new Button("For users with permission 1");
    userButton.setEnabled(currentUser.isPermitted("permission_1"));
    userButton.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(final Button.ClickEvent event) {
            Notification.show("you've got permission 1");
        }
    });
    content.addComponent(userButton);

}

From source file:eu.hurion.hello.vaadin.shiro.application.LoginScreen.java

License:Apache License

public LoginScreen(final HerokuShiroApplication app) {
    setSizeFull();/*from  w w  w.j  a v  a 2s.  co m*/

    final Panel loginPanel = new Panel("Login");
    loginPanel.setWidth("300px");
    final FormLayout content = new FormLayout();
    content.setSizeFull();
    user = new TextField("User");
    content.addComponent(user);
    password = new PasswordField("Password");
    content.addComponent(password);
    final Button loginButton = new Button("Log in");
    content.setHeight("150px");
    loginButton.addClickListener(new ShiroLoginListener(app));
    content.addComponent(loginButton);
    loginPanel.setContent(content);

    addComponent(loginPanel);
    setComponentAlignment(loginPanel, Alignment.MIDDLE_CENTER);

    final HorizontalLayout footer = new HorizontalLayout();
    footer.setHeight("50px");
    addComponent(footer);
}

From source file:eu.lod2.AuthoringTab.java

License:Apache License

public AuthoringTab(LOD2DemoState st) {

    // The internal state and 
    state = st;/*from  w w w  . j  a v a  2s. c o  m*/

    VerticalLayout authoringTab = new VerticalLayout();

    // Activate a graph in Virtuoso be editable in OntoWiki.
    // Remark: the accessrightsnull in Virtuoso have be set correct [check this]
    Form activateform = new Form();
    activateform.setDebugId(this.getClass().getSimpleName() + "_activateform");
    activateform.setCaption("Activate graph in OntoWiki");

    // the localhost ip-address
    activategraph = new TextField("graphname:", state.getCurrentGraph());
    activategraph.setColumns(50);
    activateform.getLayout().addComponent(activategraph);

    Button activateButton = new Button("Activate graph", new ClickListener() {
        public void buttonClick(ClickEvent event) {
            activateGraph(event);
        }
    });
    activateButton.setDebugId(this.getClass().getSimpleName() + "_activateButton");
    activateButton.setDescription("Activate the graph in Virtuoso to become editable in OntoWiki.");
    activateform.getFooter().addComponent(activateButton);

    authoringTab.addComponent(activateform);

    // add a form widget to edit with OntoWiki (or other editor) a specific resource
    Form t2f = new Form();
    t2f.setCaption("Edit resource content");

    TextField resToEdit = new TextField("Resource:");
    resToEdit.setDebugId(this.getClass().getSimpleName() + "_resToEdit");
    resToEdit.setImmediate(false);
    resToEdit.addListener(this);
    resToEdit.setColumns(50);
    t2f.getLayout().addComponent(resToEdit);

    // initialize the footer area of the form
    HorizontalLayout t2ffooterlayout = new HorizontalLayout();
    t2f.setFooter(t2ffooterlayout);

    ontowikil = new Link("Edit with Ontowiki",
            new ExternalResource(state.getHostName() + "/ontowiki/view/?r=&m=http://mytest.com"));
    ontowikil.setTargetName("_blank");
    ontowikil.setTargetBorder(Link.TARGET_BORDER_NONE);
    ThemeResource ontoWikiIconl = new ThemeResource("app_images/OntoWiki.logo.png");
    ontowikil.setIcon(ontoWikiIconl);
    ontowikil.setEnabled(false);

    t2f.getFooter().addComponent(ontowikil);
    t2ffooterlayout.setComponentAlignment(ontowikil, Alignment.TOP_RIGHT);

    authoringTab.addComponent(t2f);

    final Panel panel = new Panel("LOD2 components interfaces");

    VerticalLayout panelContent = new VerticalLayout();

    Link l = new Link("Ontowiki",
            new ExternalResource(state.getHostName() + "/ontowiki/view/?r=&m=http://mytest.com"));
    l.setTargetName("_blank");
    l.setTargetBorder(Link.TARGET_BORDER_NONE);
    ThemeResource ontoWikiIcon = new ThemeResource("app_images/OntoWiki.logo.png");
    l.setIcon(ontoWikiIcon);
    panelContent.addComponent(l);

    panel.setContent(panelContent);
    authoringTab.addComponent(panel);

    // The composition root MUST be set
    setCompositionRoot(authoringTab);
}