Example usage for com.vaadin.ui Panel Panel

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

Introduction

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

Prototype

public Panel() 

Source Link

Document

Creates a new empty panel.

Usage

From source file:edu.kit.dama.ui.admin.AbstractConfigurationTab.java

License:Apache License

/**
 * Get the properties panel. The properties panel contains the configuration
 * part of the tab. There are two representations for each element: the
 * BASIC and the SPECIFIC one. Their look and their content depend on their
 * specific implementation./*www  . j a  v a 2s  . c o  m*/
 *
 * @return The panel holding the configuration part.
 */
public Panel getPropertiesPanel() {
    if (propertiesPanel == null) {
        String id = "propertiesPanel";
        LOGGER.debug("Building " + DEBUG_ID_PREFIX + id + " ...");

        propertiesPanel = new Panel();
        propertiesPanel.setId(DEBUG_ID_PREFIX + id);
        propertiesPanel.setSizeFull();
        propertiesPanel.setStyleName(LiferayTheme.PANEL_LIGHT);
        propertiesPanel.setImmediate(true);

        setPropertiesLayout(PropertiesLayoutType.BASIC);
    }
    return propertiesPanel;
}

From source file:edu.kit.dama.ui.commons.util.PaginationLayout.java

License:Apache License

/**
 * Fill the pagination listing based on a specific query to obtain valid
 * objects.//from   w ww .  ja va 2s . c  o  m
 */
private void renderPage() {
    //obtain the objects of this page (5 entries per page are shown)
    int start = currentPage * entriesPerPage;
    //initialize page panel and layout
    page = new Panel();
    page.setCaption(caption);
    page.setImmediate(true);
    page.setIcon(icon);
    VerticalLayout pageLayout = new VerticalLayout();
    pageLayout.setMargin(true);
    pageLayout.setImmediate(true);
    pageLayout.setSizeUndefined();
    page.setSizeFull();
    List<C> entries;

    if (overallEntries > 0) {
        AbstractComponent header = callback.renderHeader();
        if (header != null) {
            pageLayout.addComponent(header);
            pageLayout.setComponentAlignment(header, Alignment.TOP_LEFT);
        }
        entries = callback.getEntries(this, start);
        //add all objects of this page
        int objectIdx = 1;
        for (C entry : entries) {
            AbstractComponent renderedEntry = callback.renderEntry(entry, start + objectIdx);

            pageLayout.addComponent(renderedEntry);
            pageLayout.setComponentAlignment(renderedEntry, Alignment.TOP_CENTER);
            Label spacer = new Label("<hr/>", Label.CONTENT_XHTML);
            spacer.setHeight("3px");
            spacer.setWidth("100%");
            pageLayout.addComponent(spacer);
            pageLayout.setComponentAlignment(spacer, Alignment.TOP_CENTER);
            objectIdx++;
        }

        //if there are less than 'entriesPerPage' entries, add a 'filler' to keep the actual items on top of the layout
        if (objectIdx < entriesPerPage) {
            Label filler = new Label();
            pageLayout.addComponent(filler);
            pageLayout.setExpandRatio(filler, 1.0f);
        }
    } else {
        //nothing visible
        Label filler = new Label("No entries available");
        pageLayout.addComponent(filler);
        pageLayout.setExpandRatio(filler, 1.0f);
    }

    page.setContent(pageLayout);
}

From source file:edu.kit.dama.ui.simon.panel.SimonMainPanel.java

License:Apache License

/**
 * Build the overview tab including the list of all categories and der
 * overall status.//from  www .  j  a  va  2  s.  co  m
 *
 * @param pCategories A list of all categories.
 *
 * @return The tab component.
 */
private Component buildOverviewTab(String[] pCategories) {
    AbsoluteLayout abLay = new AbsoluteLayout();
    UIUtils7.GridLayoutBuilder layoutBuilder = new UIUtils7.GridLayoutBuilder(4, pCategories.length + 1);

    updateButton = new Button("Update Status");
    updateButton.addClickListener(this);
    Embedded logo = new Embedded(null, new ThemeResource("img/simon.png"));
    abLay.addComponent(logo, "top:30px;left:30px;");

    Label simonSaysLabel = new Label("", ContentMode.HTML);
    simonSaysLabel.setHeight("150px");
    setSimonSaysContent(simonSaysLabel, "Everything is fine.");
    abLay.addComponent(simonSaysLabel, "top:30px;left:250px;");

    int row = 0;
    for (String category : pCategories) {
        HorizontalLayout rowLayout = new HorizontalLayout();
        Label name = new Label(category);
        name.setWidth("200px");
        name.setHeight("24px");
        List<AbstractProbe> probes = probesByCategory.get(category);
        Collections.sort(probes, new Comparator<AbstractProbe>() {
            @Override
            public int compare(AbstractProbe o1, AbstractProbe o2) {
                return o1.getCurrentStatus().compareTo(o2.getCurrentStatus());
            }
        });

        int failed = 0;
        int unknown = 0;
        int unavailable = 0;
        int charactersPerProbe = 100;
        if (probes.size() > 0) {
            charactersPerProbe = (int) Math.rint((700.0 / probes.size()) / 8.0);
        }

        for (AbstractProbe probe : probes) {
            Label probeLabel = new Label(StringUtils.abbreviate(probe.getName(), charactersPerProbe));
            probeLabel.setHeight("24px");
            switch (probe.getCurrentStatus()) {
            case UNKNOWN:
                probeLabel.setDescription(probe.getName() + ": UNKNOWN");
                probeLabel.addStyleName("probe-unknown");
                unknown++;
                break;
            case UPDATING:
                probeLabel.setDescription(probe.getName() + ": UPDATING");
                probeLabel.addStyleName("probe-updating");
                break;
            case UNAVAILABLE:
                probeLabel.setDescription(probe.getName() + ": UNAVAILABLE");
                probeLabel.addStyleName("probe-unavailable");
                unavailable++;
                break;
            case FAILED:
                probeLabel.setDescription(probe.getName() + ": FAILED");
                probeLabel.addStyleName("probe-failed");
                failed++;
                break;
            default:
                probeLabel.setDescription(probe.getName() + ": SUCCESS");
                probeLabel.addStyleName("probe-success");
            }

            probeLabel.addStyleName("probe");
            rowLayout.addComponent(probeLabel);
        }

        if (failed != 0) {
            setSimonSaysContent(simonSaysLabel, "There are errors!");
        } else {
            if (unknown != 0) {
                setSimonSaysContent(simonSaysLabel, "There are unknown states. Please select 'Update Status'.");
            } else {
                if (unavailable != 0) {
                    setSimonSaysContent(simonSaysLabel,
                            "Some probes are unavailable. Please check their configuration.");
                }
            }
        }

        rowLayout.setWidth("700px");
        layoutBuilder.addComponent(name, Alignment.TOP_LEFT, 0, row, 1, 1).addComponent(rowLayout,
                Alignment.TOP_LEFT, 1, row, 3, 1);
        row++;
    }

    layoutBuilder.addComponent(updateButton, Alignment.BOTTOM_RIGHT, 3, row, 1, 1);

    GridLayout tabLayout = layoutBuilder.getLayout();
    tabLayout.setSpacing(true);
    tabLayout.setMargin(true);
    Panel p = new Panel();
    p.setContent(tabLayout);
    p.setWidth("1024px");
    p.setHeight("400px");
    abLay.addComponent(p, "top:160px;left:30px;");
    abLay.setSizeFull();
    return abLay;
}

From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionPlanPageTabImages.java

License:Open Source License

@Override
public void initGui() {
    setSizeUndefined();/*from   ww w  . j  av  a2 s . c  o m*/
    VerticalLayout leftLay = getLeftLayout();
    leftLay.setSpacing(false);
    leftLay.setMargin(false);

    VerticalLayout flowLay = new VerticalLayout();
    flowLay.setWidth("100%");
    leftLay.addComponent(flowLay);
    flowLay.setSpacing(true);

    Label missionLab = new Label("Authors, add some images!");
    flowLay.addComponent(missionLab);
    flowLay.setComponentAlignment(missionLab, Alignment.TOP_LEFT);
    missionLab.addStyleName("m-actionplan-mission-title-text");

    ActionPlan ap = ActionPlan.getTL(apId);

    Label missionContentLab;
    if (!isMockup)
        missionContentLab = new HtmlLabel(ap.getImagesInstructions());
    else {
        Game g = Game.getTL();
        missionContentLab = new HtmlLabel(g.getDefaultActionPlanImagesText());
    }
    flowLay.addComponent(missionContentLab);
    flowLay.setComponentAlignment(missionContentLab, Alignment.TOP_LEFT);
    flowLay.addStyleName("m-actionplan-mission-content-text");

    MmowgliSessionGlobals globs = Mmowgli2UI.getGlobals();
    flowLay.addComponent(addImageButt);
    addImageButt.addStyleName("m-actionplan-addimage-butt");
    addImageButt.addStyleName("borderless");
    addImageButt.setIcon(globs.getMediaLocator().getActionPlanAddImageButt());
    addImageButt.addClickListener(new ImageAdder());
    addImageButt.setEnabled(!isReadOnly);

    flowLay.addComponent(nonAuthorLabel = new Label("Authors may add images when editing the plan."));
    nonAuthorLabel.setVisible(false);

    VerticalLayout rightLay = getRightLayout();
    rightLay.setSpacing(false);
    rightLay.setMargin(false);

    imageScroller = new Panel();
    GridLayout gridL = new GridLayout();
    gridL.setColumns(2);
    gridL.setSpacing(true);
    gridL.setMargin(new MarginInfo(true));
    imageScroller.setContent(gridL);
    imageScroller.setStyleName(Reindeer.PANEL_LIGHT); // make a transparent scroller
    imageScroller.setWidth("100%");
    imageScroller.setHeight("99%");
    setUpIndexListener(imageScroller);

    rightLay.addComponent(imageScroller);
    fillWithImagesTL();
}

From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionPlanPageTabTalk.java

License:Open Source License

private Component createChatScroller(VerticalLayout cont) {
    chatScroller = new Panel();
    cont.addComponent(chatScroller);// w w w.  j  a  va  2 s.co  m
    VerticalLayout vl = new VerticalLayout();
    chatScroller.setContent(vl);
    vl.addStyleName("m-padding2");
    vl.setWidth("99%"); // the padding screws up the panel's width calc
    return chatScroller;
}

From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionPlanPageTabVideos.java

License:Open Source License

@Override
public void initGui() {
    setSizeUndefined();//  w  w  w . j ava  2  s .  co  m
    VerticalLayout leftLay = getLeftLayout();
    leftLay.setSpacing(false);
    leftLay.setMargin(false);

    VerticalLayout flowLay = new VerticalLayout();
    flowLay.setWidth("100%");
    leftLay.addComponent(flowLay);
    flowLay.setSpacing(true);

    Label missionLab = new Label("Authors, add some videos!");
    flowLay.addComponent(missionLab);
    flowLay.setComponentAlignment(missionLab, Alignment.TOP_LEFT);
    missionLab.addStyleName("m-actionplan-mission-title-text");

    ActionPlan ap = ActionPlan.getTL(apId);

    Label missionContentLab;
    if (!isMockup)
        missionContentLab = new HtmlLabel(ap.getVideosInstructions());
    else {
        Game g = Game.getTL();
        missionContentLab = new HtmlLabel(g.getDefaultActionPlanVideosText());
    }
    flowLay.addComponent(missionContentLab);
    flowLay.setComponentAlignment(missionContentLab, Alignment.TOP_LEFT);
    flowLay.addStyleName("m-actionplan-mission-content-text");

    MmowgliSessionGlobals globs = Mmowgli2UI.getGlobals();
    flowLay.addComponent(addVideoButt);
    addVideoButt.addStyleName("m-actionplan-addimage-butt");
    addVideoButt.addStyleName("borderless");
    addVideoButt.setIcon(globs.getMediaLocator().getActionPlanAddVideoButt());
    addVideoButt.addClickListener(new VideoAdder());
    addVideoButt.setEnabled(!isReadOnly);

    flowLay.addComponent(nonAuthorLabel = new Label("Authors may add videos when editing the plan."));
    nonAuthorLabel.setVisible(false);

    VerticalLayout rightLay = getRightLayout();
    rightLay.setSpacing(false);
    rightLay.setMargin(false);

    rightScroller = new Panel();
    GridLayout gridL = new GridLayout();
    gridL.setColumns(2);
    gridL.setSpacing(true);
    gridL.setMargin(new MarginInfo(true));
    rightScroller.setContent(gridL);
    rightScroller.setStyleName(Reindeer.PANEL_LIGHT); // make a transparent scroller
    rightScroller.setWidth("100%");
    rightScroller.setHeight("99%");
    setUpIndexListener(rightScroller);

    rightLay.addComponent(rightScroller);
    ;
    fillWithVideosTL();
}

From source file:edu.nps.moves.mmowgli.modules.actionplans.MediaSubWindow.java

License:Open Source License

public MediaSubWindow(Resource res) {
    setCaption("Action Plan Image");
    setModal(true);//from  ww w .j a  v  a 2s.  co  m
    setWidth("640px");
    setHeight("480px");

    TabSheet tabs = new TabSheet();
    tabs.setSizeFull();
    setContent(tabs);

    Panel pan = new Panel();
    tabs.addTab(pan, "Fit Window");
    pan.setSizeFull();

    VerticalLayout layout = new VerticalLayout();
    pan.setContent(layout);
    layout.setSizeFull();
    layout.addStyleName("m-background-lightgrey");
    layout.setMargin(false);

    image = new ScaleImage();
    image.setSizeFull();
    image.setSource(res);

    layout.addComponent(image);
    layout.setComponentAlignment(image, Alignment.MIDDLE_CENTER);
    layout.setExpandRatio(image, 1.0f);

    tabs.addTab(buildNestedImage(res), "Actual Size");
}

From source file:edu.nps.moves.mmowgli.modules.actionplans.TextAreaLabelUnion.java

License:Open Source License

public void initGui() {
    addComponent(ta, "top:0px;left:0px");
    ta.setWidth(getWidth(), getWidthUnits());
    ta.setHeight(getHeight(), getHeightUnits());

    labPan = new Panel();
    labPan.setStyleName(Reindeer.PANEL_LIGHT);
    labPan.setContent(vl);/*from  w ww  .ja  v a  2s .co  m*/
    vl.setMargin(false);
    vl.addComponent(lab);
    vl.addLayoutClickListener(this);
    addComponent(labPan, "top:0px;left:0px");
    labPan.setWidth(getWidth(), getWidthUnits());
    labPan.setHeight(getHeight(), getHeightUnits());
}

From source file:edu.nps.moves.mmowgli.modules.administration.VipListManager.java

License:Open Source License

@SuppressWarnings({ "unchecked", "serial" })
private void showViewOrDelete(final DeleteListener lis) {
    dialog = new Window("View / Delete VIPs");
    dialog.setModal(true);/*from  w  w w  . j  a v  a 2s  . c  o m*/

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

    List<VipPii> vLis = VHibPii.getAllVips();

    vipListSelect = new ListSelect("Select items to delete");
    StringBuffer sb = new StringBuffer(); // for popup
    vipListSelect.addStyleName("m-greyborder");
    String lf = System.getProperty("line.separator");
    for (int i = 0; i < vLis.size(); i++) {
        VipPii v;
        vipListSelect.addItem(v = vLis.get(i));
        sb.append(v.getEntry());
        sb.append(lf);
    }
    if (sb.length() > 0)
        sb.setLength(sb.length() - 1); // last space

    vipListSelect.setNullSelectionAllowed(true);
    vipListSelect.setMultiSelect(true);
    vipListSelect.setImmediate(true);
    vipListSelect.addValueChangeListener(new VipSelectListener());

    layout.addComponent(vipListSelect);

    Label copyPopupList = new HtmlLabel("<pre>" + sb.toString() + "</pre>");
    Panel p = new Panel();
    VerticalLayout lay = new VerticalLayout();
    p.setContent(lay);
    lay.addComponent(copyPopupList);
    p.setWidth("400px");
    p.setHeight("300px");
    PopupView popup = new PopupView("Display list as copyable text", p);
    popup.setHideOnMouseOut(false);
    if (sb.length() <= 0)
        popup.setEnabled(false);

    layout.addComponent(popup);
    layout.setComponentAlignment(popup, Alignment.MIDDLE_CENTER);

    HorizontalLayout hl = new HorizontalLayout();
    hl.setSpacing(true);
    Button cancelButt = new Button("Cancel", new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            dialog.close();
            lis.continueOrCancel(null);
        }
    });

    deleteButt = new Button("Delete & Close", new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            Set<VipPii> set = (Set<VipPii>) vipListSelect.getValue();
            if (set.size() <= 0)
                set = null;
            dialog.close();
            lis.continueOrCancel(set);
        }
    });
    deleteButt.setEnabled(false);
    hl.addComponent(cancelButt);
    hl.addComponent(deleteButt);
    hl.setComponentAlignment(cancelButt, Alignment.MIDDLE_RIGHT);
    hl.setExpandRatio(cancelButt, 1.0f);

    // The components added to the window are actually added to the window's
    // layout; you can use either. Alignments are set using the layout
    layout.addComponent(hl);
    dialog.setWidth("300px");
    dialog.setHeight("350px");
    hl.setWidth("100%");
    vipListSelect.setWidth("99%");
    vipListSelect.setHeight("99%");
    layout.setExpandRatio(vipListSelect, 1.0f);

    UI.getCurrent().addWindow(dialog);
    dialog.center();
}

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);// ww  w. j  a  va 2  s.c  o m
    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%");
        }
    }
}