Example usage for com.vaadin.ui Panel setWidth

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

Introduction

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

Prototype

@Override
    public void setWidth(String width) 

Source Link

Usage

From source file:uk.q3c.krail.testapp.view.ViewBaseGrid.java

License:Apache License

@Override
public void doBuild() {
    GridLayout grid = new GridLayout(3, 4);
    Panel topMarginPanel = new Panel();
    topMarginPanel.setHeight(topMargin + "px");
    topMarginPanel.setWidth("100%");

    grid.setSizeFull();//from   w w  w  . j a v a2  s .  com
    grid.setColumnExpandRatio(0, 0.400f);
    grid.setColumnExpandRatio(1, 0.20f);
    grid.setColumnExpandRatio(2, 0.40f);

    grid.setRowExpandRatio(1, 0.40f);
    grid.setRowExpandRatio(2, 0.20f);
    grid.setRowExpandRatio(3, 0.40f);
    setRootComponent(grid);
}

From source file:v7cr.ReviewTab.java

License:Open Source License

private Panel getBasicInfo(V7CR v7, Review r, Project proj, String linkUrl) {

    Panel p = new Panel(v7.getMessage("reviewTab.review"));
    p.setWidth("600px");
    GridLayout grid = new GridLayout(3, 4);
    grid.setSizeFull();//from   www.  ja  v a 2  s.com
    p.setContent(grid);
    grid.setSpacing(true);
    Locale l = v7.getLocale();
    SchemaDefinition sd = r.getSchemaDefinition();
    grid.addComponent(new Label(sd.getFieldCaption("s", l)), 0, 0, 1, 0);
    p.addComponent(new Label("<b>" + LocalizedString
            .get(sd.getFieldDefinition("s").getPossibleValueMetaData(r.getStatus()), "caption", l) + "</b>",
            Label.CONTENT_XHTML));
    p.addComponent(new Label(sd.getFieldCaption("p", l)));
    p.addComponent(new Label("[" + proj.getId() + "]"));
    grid.addComponent(new Label(proj.getName()));
    p.addComponent(new Label(sd.getFieldCaption("reviewee", l)));
    p.addComponent(new Label(r.getReviewee().getId()));
    grid.addComponent(new Label(r.getReviewee().getName()));
    p.addComponent(new Label(sd.getFieldCaption("t", l)));
    grid.addComponent(new Label(r.getTitle()), 1, 3, 2, 3);
    p.addComponent(new Label(v7.getMessage("reviewTab.directLink")));
    Link link = new Link(linkUrl, new ExternalResource(linkUrl));
    link.setTargetName("_blank");
    link.setIcon(new ThemeResource("../runo/icons/16/arrow-right.png"));
    grid.addComponent(link);
    return p;

}

From source file:v7cr.ReviewTab.java

License:Open Source License

private Panel getNotesPanel(BSONBackedObject note) {
    Panel p = new Panel(note.getStringField("t"));
    p.setWidth("600px");
    Label c = new Label(note.getStringField("c"));
    p.addComponent(c);//from   w w w .j  a  v  a 2  s. co m

    String v = note.getStringField("v");
    if ("+".equals(v)) {
        c.setIcon(new ThemeResource("../runo/icons/16/ok.png"));
    }
    if ("-".equals(v)) {
        c.setIcon(new ThemeResource("../runo/icons/16/attention.png"));
    }
    return p;
}

From source file:v7cr.ReviewTab.java

License:Open Source License

private Panel getSVNPanel(V7CR v7, SchemaDefinition sd, SVNLogEntry svn, Project proj) {
    if (svn == null)
        return null;
    Locale l = v7.getLocale();//from   w  w w.  j a v  a  2  s .c  o m
    Panel p = new Panel(v7.getMessage("reviewTab.subversion"));
    p.setWidth("600px");
    GridLayout grid = new GridLayout(4, 4);
    grid.setSizeFull();
    p.setContent(grid);
    grid.setSpacing(true);
    p.addComponent(new Label(sd.getFieldCaption("svn.rev", l)));
    p.addComponent(new Label("" + svn.getRevision()));
    p.addComponent(new Label(DateFormat.getDateTimeInstance().format(svn.getDate())));
    p.addComponent(new Label(svn.getAuthor()));
    Link link = new Link(v7.getMessage("reviewTab.viewChanges"),
            new ExternalResource(proj.getChangesetViewUrl(svn.getRevision())));
    link.setTargetName("_blank");
    link.setIcon(new ThemeResource("../runo/icons/16/arrow-right.png"));
    p.addComponent(link);
    grid.addComponent(new Label(svn.getMessage()), 1, 1, 3, 1);

    Map<String, SVNLogEntryPath> changed = svn.getChangedPaths();

    if (changed != null) {
        Tree changeTree = new Tree(sd.getFieldCaption("svn.changed", l) + "(" + changed.size() + ")");
        Set<String> paths = changed.keySet();
        for (String s : changed.keySet()) {
            changeTree.addItem(s);
            changeTree.setChildrenAllowed(s, false);
            changeTree.setItemCaption(s, changed.get(s).getType() + " " + s);
        }
        if (paths.size() > 5) {
            compressTree(changeTree, paths);
        }

        grid.addComponent(changeTree, 0, 2, 3, 2);
    }
    return p;
}

From source file:v7cr.RoleEditor.java

License:Open Source License

RoleEditor(V7CR v7) {
    setCaption(v7.getMessage("roleEditor.name"));
    setIcon(new ThemeResource("../runo/icons/16/users.png"));

    this.roles.setBeanIdProperty("id");
    for (BSONBackedObject b : v7.find("roles")) {
        roles.addBean(new Role(b));
    }/*from w w  w .jav  a 2s. c o  m*/
    SchemaDefinition sd = Role.getRoleSchemaDefinition();
    Locale l = v7.getLocale();

    rolesTab.setContainerDataSource(this.roles);
    rolesTab.addGeneratedColumn("name", new LocalizedStringColumnGenerator(l));

    rolesTab.setVisibleColumns(new Object[] { "id", "name" });
    rolesTab.setColumnHeaders(new String[] { sd.getFieldCaption("_id", l), sd.getFieldCaption("name", l) });
    rolesTab.setSelectable(true);
    rolesTab.setImmediate(true);
    rolesTab.addListener(this);

    Panel rightSide = new Panel();

    memberSelect.setRightColumnCaption(sd.getFieldCaption("member", l));
    memberSelect.setLeftColumnCaption(v7.getMessage("roleEditor.nonMembers"));
    rightSide.addComponent(memberSelect);

    Button commitButton = new Button(v7.getMessage("button.submit"));
    commitButton.addListener(this);
    rightSide.addComponent(commitButton);

    rightSide.setWidth("500");

    HorizontalLayout hl = new HorizontalLayout();
    hl.addComponent(rolesTab);
    hl.addComponent(rightSide);

    setCompositionRoot(hl);
}