Example usage for com.vaadin.ui Window setWidth

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

Introduction

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

Prototype

@Override
    public void setWidth(String width) 

Source Link

Usage

From source file:edu.nps.moves.mmowgli.MmowgliMessageBroadcaster.java

License:Open Source License

private static void _postGameEvent(String title, final GameEvent.EventType typ, String buttName,
        boolean doWarning) {
    // Create the window...
    final Window bcastWindow = new Window(title);
    bcastWindow.setModal(true);//  w  ww.  j a v a  2 s.c  o m

    VerticalLayout layout = new VerticalLayout();
    bcastWindow.setContent(layout);
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setWidth("99%");

    layout.addComponent(new Label("Compose message (255 char limit):"));
    final TextArea ta = new TextArea();
    ta.setRows(5);
    ta.setWidth("99%");
    layout.addComponent(ta);

    HorizontalLayout buttHl = new HorizontalLayout();
    final Button bcancelButt = new Button("Cancel");
    buttHl.addComponent(bcancelButt);
    Button bokButt = new Button(buttName);
    buttHl.addComponent(bokButt);
    layout.addComponent(buttHl);
    layout.setComponentAlignment(buttHl, Alignment.TOP_RIGHT);

    if (doWarning)
        layout.addComponent(new Label("Use with great deliberation!"));

    bcastWindow.setWidth("320px");
    UI.getCurrent().addWindow(bcastWindow);
    bcastWindow.setPositionX(0);
    bcastWindow.setPositionY(0);

    ta.focus();

    @SuppressWarnings("serial")
    ClickListener lis = new ClickListener() {
        @Override
        @MmowgliCodeEntry
        @HibernateOpened
        @HibernateClosed
        @HibernateUserRead
        public void buttonClick(ClickEvent event) {
            if (event.getButton() == bcancelButt)
                ; // nothin
            else {
                // This check is now done in GameEvent.java, but should ideally prompt the user.
                HSess.init();
                String msg = ta.getValue().toString().trim();
                if (msg.length() > 0) {
                    if (msg.length() > 255) // clamp to 255 to avoid db exception
                        msg = msg.substring(0, 254);
                    Serializable uid = Mmowgli2UI.getGlobals().getUserID();
                    User u = User.getTL(uid);
                    if (typ == GameEvent.EventType.GAMEMASTERNOTE)
                        GameEventLogger.logGameMasterCommentTL(msg, u);
                    else
                        GameEventLogger.logGameMasterBroadcastTL(typ, msg, u); // GameEvent.save(new GameEvent(typ,msg));
                    HSess.close();
                }
            }
            bcastWindow.close();
        }
    };
    bcancelButt.addClickListener(lis);
    bokButt.addClickListener(lis);
}

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

License:Open Source License

@SuppressWarnings("serial")
public static void inviteAuthorsToActionPlan() {
    final Window win = new Window("Choose Action Plan");
    win.setWidth("600px");
    win.setHeight("500px");

    VerticalLayout layout = new VerticalLayout();
    win.setContent(layout);//w  w  w  . java  2 s.c  om
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setSizeFull();

    final ActionPlanTable apt = new ActionPlanTable() {
        @Override
        public ItemClickListener getItemClickListener() {
            return new ItemClickListener() {
                public void itemClick(ItemClickEvent event) {
                }
            }; // null listener
        }
    };
    apt.setMultiSelect(false);
    apt.setPageLength(10);
    apt.setSizeFull();
    layout.addComponent(apt);
    layout.setExpandRatio(apt, 1.0f);

    HorizontalLayout buttHL = new HorizontalLayout();
    layout.addComponent(buttHL);
    buttHL.setWidth("100%");
    buttHL.setSpacing(true);
    Label sp;
    buttHL.addComponent(sp = new Label());
    sp.setWidth("1px");
    buttHL.setExpandRatio(sp, 1.0f);

    Button selectButton = new Button("Select");
    buttHL.addComponent(selectButton);
    Button cancelButton = new Button("Cancel");
    buttHL.addComponent(cancelButton);

    UI.getCurrent().addWindow(win);
    win.center();

    selectButton.addClickListener(new ClickListener() {
        @Override
        @MmowgliCodeEntry
        @HibernateOpened
        @HibernateClosed
        public void buttonClick(ClickEvent event) {
            win.close();
            Object o = apt.getValue();
            if (o != null) {
                HSess.init();
                inviteAuthorsToActionPlanTL(o);
                HSess.close();
            }
        }
    });
    cancelButton.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            win.close();
        }
    });
}

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

License:Open Source License

@SuppressWarnings("serial")
Table createTable(TableFiller filler) {/* w  w w .j  av  a 2  s  .  c o  m*/
    final Table tab = new Table();
    tab.setStyleName("m-useradmintable");
    tab.setWidth("920px");
    tab.setHeight("100%");
    tab.setPageLength(40);

    // Special column renderers
    Table.ColumnGenerator colGen = new columnCustomizer();
    tab.addGeneratedColumn(USER_ID_COL, colGen);
    tab.addGeneratedColumn(ADMIN_COL, colGen);
    tab.addGeneratedColumn(DESIGNER_COL, colGen);
    tab.addGeneratedColumn(LOCKEDOUT_COL, colGen);
    tab.addGeneratedColumn(TWEETER_COL, colGen);
    tab.addGeneratedColumn(GAMEMASTER_COL, colGen);
    tab.addGeneratedColumn(EMAIL_COL, colGen);
    tab.addGeneratedColumn(CONFIRMED_COL, colGen);

    filler.fillTable(tab);

    tab.setColumnWidth(USER_ID_COL, 25);
    tab.setColumnWidth(ADMIN_COL, 25);
    tab.setColumnWidth(GAMEMASTER_COL, 25);
    tab.setColumnWidth(DESIGNER_COL, 25);
    tab.setColumnWidth(LOCKEDOUT_COL, 43);
    tab.setColumnWidth(TWEETER_COL, 50);
    tab.setColumnWidth(UNAME_COL, 120);
    tab.setColumnWidth(FIRSTNAME_COL, 108); //128);
    tab.setColumnWidth(LASTNAME_COL, 108); //128);
    tab.setColumnWidth(EMAIL_COL, 190);
    tab.setColumnWidth(CONFIRMED_COL, 67);

    tab.setEditable(false);
    tab.setSelectable(true);
    tab.setImmediate(true); // to immed update view
    tab.setNullSelectionAllowed(false); // can't deselect a row

    tab.addItemClickListener(new ItemClickListener() {
        EditPanel ep;

        @Override
        @MmowgliCodeEntry
        @HibernateOpened
        @HibernateClosed
        @HibernateUserRead
        public void itemClick(ItemClickEvent event) {
            if (event.isDoubleClick()) {
                HSess.init();
                Window w = new Window("Edit Player Account");
                w.setWidth("620px");
                w.setHeight("505px");
                w.setModal(true);

                @SuppressWarnings({ "unchecked" })
                final QuickUser qu = (QuickUser) ((BeanItem<QuickUser>) event.getItem()).getBean();
                User u = User.getTL(qu.getId());
                if (u == null) {
                    // This has been happening infrequently...some error on signup where (maybe) a user object gets created
                    // but doesn't make it into the db.
                    Notification.show("Woops, database error!",
                            "A player account identified by id = " + qu.getId() + " is not in the database.",
                            Notification.Type.ERROR_MESSAGE);
                    HSess.close();
                    return;
                }
                VerticalLayout vl = new VerticalLayout();
                w.setContent(vl);
                vl.addComponent(ep = new EditPanel(w, qu.getId()));
                ep.setWidth("100%");
                UI.getCurrent().addWindow(w);
                w.center();

                w.addCloseListener(new CloseListener() {
                    @Override
                    public void windowClose(CloseEvent e) {
                        if (ep.user != null) {
                            BeanItem<QuickUser> bi = lastTableFiller.getContainer().getItem(ep.user.getId());
                            QuickUser qu = bi.getBean();
                            qu.update(ep.user);
                            tab.refreshRowCache();
                        }
                    }
                });
                HSess.close();
            }
        }
    });
    return tab;
}

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

License:Open Source License

@SuppressWarnings("serial")
@HibernateUserRead//from w  w w  .j av a 2 s.  c  o m
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:eu.lod2.DeleteGraphs.java

License:Apache License

private Button showConfirmDialog(String message) {
    final Window notifier = new Window("Are you sure?");
    notifier.setWidth("400px");
    notifier.setModal(true);/*from  w w  w .  j a v a  2s . co m*/

    VerticalLayout layout = (VerticalLayout) notifier.getContent();
    layout.setMargin(true);
    layout.setSpacing(true);

    Label messageLabel = new Label(message);
    notifier.addComponent(messageLabel);

    Button yes = new Button("Yes", new ClickListener() {
        public void buttonClick(ClickEvent event) {
            notifier.getParent().removeWindow(notifier);
        }
    });
    Button no = new Button("No", new Button.ClickListener() {
        public void buttonClick(Button.ClickEvent event) {
            notifier.getParent().removeWindow(notifier);
        }
    });

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.addComponent(yes);
    buttons.addComponent(no);
    notifier.addComponent(buttons);

    getWindow().addWindow(notifier);

    return yes;
}

From source file:eu.lod2.ExportSelector.java

License:Apache License

public void addNewItem(String newItemCaption) {
    final String newItem = newItemCaption;

    // request the user whether to add it to the list or to reject his choice.
    final Window subwindow = new Window("Create new graph");
    subwindow.setModal(true);/*from w  w  w. j av a2 s  . c o  m*/

    // Configure the windows layout; by default a VerticalLayout
    VerticalLayout swlayout = (VerticalLayout) subwindow.getContent();

    Label desc = new Label(
            "The graphname " + newItemCaption + " is not a known graph. Shall we create the graph?");
    HorizontalLayout buttons = new HorizontalLayout();

    Button ok = new Button("Create graph", new ClickListener() {
        public void buttonClick(ClickEvent event) {
            createGraph(newItem);
            (subwindow.getParent()).removeWindow(subwindow);
        }
    });
    ok.setDebugId(this.getClass().getSimpleName() + "_ok");
    Button cancel = new Button("Cancel", new ClickListener() {
        public void buttonClick(ClickEvent event) {
            (subwindow.getParent()).removeWindow(subwindow);
        }
    });
    cancel.setDebugId(this.getClass().getSimpleName() + "_cancel");

    swlayout.addComponent(desc);
    swlayout.addComponent(buttons);
    buttons.addComponent(ok);
    buttons.addComponent(cancel);
    buttons.setComponentAlignment(ok, Alignment.BOTTOM_RIGHT);
    buttons.setComponentAlignment(cancel, Alignment.BOTTOM_RIGHT);
    getWindow().addWindow(subwindow);
    subwindow.setWidth("300px");

}

From source file:eu.lod2.ExportSelector3.java

License:Apache License

public void addNewItem(String newItemCaption) {
    final String newItem = newItemCaption;

    // request the user whether to add it to the list or to reject his choice.
    final Window subwindow = new Window("Create new graph");
    subwindow.setModal(true);/*from   w  w w.  j a v a2 s  . com*/

    // Configure the windows layout; by default a VerticalLayout
    VerticalLayout swlayout = (VerticalLayout) subwindow.getContent();

    Label desc = new Label(
            "The graphname " + newItemCaption + " is not a known graph. Shall we create the graph?");
    HorizontalLayout buttons = new HorizontalLayout();

    Button ok = new Button("Create graph", new ClickListener() {
        public void buttonClick(ClickEvent event) {
            createGraph(newItem);
            (subwindow.getParent()).removeWindow(subwindow);
        }
    });
    ok.setDebugId(this.getClass().getSimpleName() + "_ok");
    Button cancel = new Button("Cancel", new ClickListener() {
        public void buttonClick(ClickEvent event) {
            (subwindow.getParent()).removeWindow(subwindow);
        }
    });
    cancel.setDebugId(this.getClass().getSimpleName() + "_cancel");
    swlayout.addComponent(desc);
    swlayout.addComponent(buttons);
    buttons.addComponent(ok);
    buttons.addComponent(cancel);
    buttons.setComponentAlignment(ok, Alignment.BOTTOM_RIGHT);
    buttons.setComponentAlignment(cancel, Alignment.BOTTOM_RIGHT);
    getWindow().addWindow(subwindow);
    subwindow.setWidth("300px");

}

From source file:eu.lod2.stat.StatLOD2Demo.java

License:Apache License

/**
 * A function to get an ontowiki export command
 * @param format - the formating string defining the format to export in
 *///from  w  w  w .j  a v a  2 s  . c  o m
private MenuBar.Command getOWExportCommand(final String format) {
    return new MenuBar.Command() {
        public void menuSelected(final MenuItem selectedItem) {
            String currentGraph = state.getCurrentGraph();
            if (currentGraph == null || currentGraph.isEmpty()) {
                final Window window = new Window("No graph selected");
                window.setWidth("550px");
                LOD2DemoState.CurrentGraphListener listener = new LOD2DemoState.CurrentGraphListener() {
                    boolean ignoreFirst = true;

                    public void notifyCurrentGraphChange(String graph) {
                        if (ignoreFirst) {
                            ignoreFirst = false;
                            return;
                        }
                        window.getParent().removeWindow(window);
                        menuSelected(selectedItem);
                        state.removeCurrentGraphListener(this);
                    }
                };
                VerticalLayout layout = (VerticalLayout) window.getContent();
                layout.addComponent(new Label(
                        "You did not specify a graph to work with. Please do so below and try again: "));
                ConfigurationTab configure = new ConfigurationTab(state);
                layout.addComponent(configure);
                layout.setComponentAlignment(configure, Alignment.BOTTOM_CENTER);
                getMainWindow().addWindow(window);
                window.center();
                state.addCurrentGraphListener(listener);
                return;
            }
            try {
                getMainWindow()
                        .open(new ExternalResource(state.getHostNameWithoutPort() + "/ontowiki/model/export?m="
                                + URLEncoder.encode(currentGraph, "UTF-8") + "&f=" + format));
            } catch (UnsupportedEncodingException e) {
                // should never happen
                throw new RuntimeException("The lod2 server encountered error when exporting the graph: "
                        + e.getMessage() + " Please contact an administrator");
            }
        }
    };
}

From source file:facs.components.BookAdmin.java

License:Open Source License

private Component deletedBookingsGrid() {
    VerticalLayout devicesLayout = new VerticalLayout();
    devicesLayout.setCaption("Trash");
    // HorizontalLayout buttonLayout = new HorizontalLayout();

    // there will now be space around the test component
    // components added to the test component will now not stick together but have space between
    // them//from   w  w  w.  j  a  v a 2 s.c om
    devicesLayout.setMargin(true);
    devicesLayout.setSpacing(true);
    // buttonLayout.setMargin(true);
    // buttonLayout.setSpacing(true);

    // buttonLayout.addComponent(add);

    BeanItemContainer<BookingBean> booking = getDeletedBookings();

    GeneratedPropertyContainer gpc = new GeneratedPropertyContainer(booking);

    gpc.addGeneratedProperty("restore", new PropertyValueGenerator<String>() {
        /**
         * 
         */
        private static final long serialVersionUID = 4082425701384202280L;

        @Override
        public String getValue(Item item, Object itemId, Object propertyId) {
            // return FontAwesome.TRASH_O.getHtml(); // The caption
            return "Restore"; // The caption

        }

        @Override
        public Class<String> getType() {
            return String.class;
        }
    });

    gpc.addGeneratedProperty("delete", new PropertyValueGenerator<String>() {
        /**
         * 
         */
        private static final long serialVersionUID = 1307493624895857513L;

        @Override
        public String getValue(Item item, Object itemId, Object propertyId) {
            // return FontAwesome.TRASH_O.getHtml(); // The caption
            return "Purge"; // The caption

        }

        @Override
        public Class<String> getType() {
            return String.class;
        }
    });

    devicesGridTrash = new Grid(gpc);
    // Create a grid

    devicesGridTrash.setWidth("100%");
    devicesGridTrash.setSelectionMode(SelectionMode.SINGLE);
    devicesGridTrash.getColumn("delete").setRenderer(new HtmlRenderer());
    devicesGridTrash.getColumn("restore").setRenderer(new HtmlRenderer());
    setRenderers(devicesGridTrash);
    devicesGridTrash.setColumnOrder("ID", "deviceName", "service", "start", "end", "username", "phone",
            "price");

    // Render a button that deletes the data row (item)

    /*
     * devicesGrid.addColumn("delete", FontIcon.class).setWidth(35) .setRenderer(new
     * FontIconRenderer(new RendererClickListener() {
     * 
     * @Override public void click(RendererClickEvent e) { Notification.show("Deleted item " +
     * e.getItemId()); } }));
     */

    devicesGridTrash.getColumn("delete")
            .setRenderer(new ButtonRenderer(new ClickableRenderer.RendererClickListener() {
                /**
                 * 
                 */
                private static final long serialVersionUID = 302628105070456680L;

                @Override
                public void click(RendererClickEvent event) {

                    try {

                        Window cd = new Window("Purge Booking");

                        cd.setHeight("200px");
                        cd.setWidth("400px");
                        cd.setResizable(false);

                        GridLayout dialogLayout = new GridLayout(3, 3);

                        Button okButton = new Button("Yes");
                        okButton.addStyleName(ValoTheme.BUTTON_DANGER);
                        Button cancelButton = new Button("No, I'm actually not sure!");
                        cancelButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
                        Label information = new Label("Are you sure you want to purge this item?");
                        information.addStyleName(ValoTheme.LABEL_NO_MARGIN);

                        okButton.addClickListener(new Button.ClickListener() {

                            /**
                             * 
                             */
                            private static final long serialVersionUID = 3739260172118651857L;

                            @Override
                            public void buttonClick(ClickEvent okEvent) {
                                purgeBooking((BookingBean) event.getItemId());
                                cd.close();
                                Notification("The booking was purged!",
                                        "At the end, you are the admin, you have the power.", "");
                            }
                        });

                        cancelButton.addClickListener(new Button.ClickListener() {

                            /**
                             * 
                             */
                            private static final long serialVersionUID = -3931200823633220160L;

                            @Override
                            public void buttonClick(ClickEvent okEvent) {
                                cd.close();
                            }
                        });

                        dialogLayout.addComponent(information, 0, 0, 2, 0);
                        dialogLayout.addComponent(okButton, 0, 1);
                        dialogLayout.addComponent(cancelButton, 1, 1);
                        dialogLayout.setMargin(true);
                        dialogLayout.setSpacing(true);
                        cd.setContent(dialogLayout);
                        cd.center();
                        UI.getCurrent().addWindow(cd);

                    } catch (Exception e) {
                        e.printStackTrace();
                    }

                    FieldGroup fieldGroup = devicesGridTrash.getEditorFieldGroup();
                    fieldGroup.addCommitHandler(new FieldGroup.CommitHandler() {
                        /**
                         * 
                         */
                        private static final long serialVersionUID = 3799806709907688919L;

                        @Override
                        public void preCommit(FieldGroup.CommitEvent commitEvent)
                                throws FieldGroup.CommitException {

                        }

                        @Override
                        public void postCommit(FieldGroup.CommitEvent commitEvent)
                                throws FieldGroup.CommitException {

                            Notification("Successfully Updated",
                                    "Selected values are updated in the database. If it was a mistake, please remind that there is no 'undo' functionality yet.",
                                    "success");

                            refreshGrid();
                        }

                        private void refreshGrid() {
                            getDeletedBookings();
                        }

                    });

                }
            }));

    devicesGridTrash.getColumn("restore")
            .setRenderer(new ButtonRenderer(new ClickableRenderer.RendererClickListener() {
                /**
                 * 
                 */
                private static final long serialVersionUID = -9104571186503913834L;

                @Override
                public void click(RendererClickEvent event) {
                    restoreBooking((BookingBean) event.getItemId());
                }
            }));

    // devicesGrid.setEditorEnabled(true);

    // devicesLayout.addComponent(buttonLayout);
    devicesLayout.addComponent(devicesGridTrash);

    // TODO filtering
    // HeaderRow filterRow = devicesGrid.prependHeaderRow();

    return devicesLayout;
}

From source file:facs.components.Booking.java

License:Open Source License

private Component myUpcomingBookings() {
    VerticalLayout devicesLayout = new VerticalLayout();
    // devicesLayout.setCaption("My Bookings");
    // there will now be space around the test component
    // components added to the test component will now not stick together but have space between
    // them//www .j a v a  2  s .c  o m
    devicesLayout.setMargin(true);
    devicesLayout.setSpacing(true);

    Date serverTime = new WebBrowser().getCurrentDate();
    Date nextDayTime = new Date(serverTime.getTime() + (1000 * 60 * 60 * 24));

    BeanItemContainer<BookingBean> users = getMyUpcomingBookings(bookingModel.getLDAP(), nextDayTime);
    // System.out.println(bookingModel.getLDAP());

    GeneratedPropertyContainer gpc = new GeneratedPropertyContainer(users);
    gpc.addGeneratedProperty("delete", new PropertyValueGenerator<String>() {
        /**
         * 
         */
        private static final long serialVersionUID = 1263377339178640406L;

        @Override
        public String getValue(Item item, Object itemId, Object propertyId) {
            // return FontAwesome.TRASH_O.getHtml(); // The caption
            return "Trash"; // The caption

        }

        @Override
        public Class<String> getType() {
            return String.class;
        }
    });

    /*
     * 
     * try {
     * 
     * FreeformQuery query = new FreeformQuery(
     * "SELECT * FROM booking INNER JOIN user ON booking.user_ldap = user.user_ldap WHERE deleted IS NULL AND booking.user_ldap ='"
     * + bookingModel.getLDAP() + "';", DBManager.getDatabaseInstanceAlternative(), "booking_id");
     * SQLContainer container = new SQLContainer(query);
     * 
     * // System.out.println("Print Container: " + container.size());
     * container.setAutoCommit(isEnabled());
     * 
     * myBookings = new Grid(container);
     * 
     * } catch (Exception e) { e.printStackTrace(); }
     * 
     * myBookings.setColumnOrder("booking_id", "confirmation", "device_name", "service", "start",
     * "end", "kostenstelle", "price", "project");
     * 
     * myBookings.removeColumn("user_ldap"); myBookings.removeColumn("timestamp");
     * myBookings.removeColumn("deleted"); myBookings.removeColumn("user_name");
     * myBookings.removeColumn("group_id"); myBookings.removeColumn("workgroup_id");
     * myBookings.removeColumn("email"); myBookings.removeColumn("phone");
     * myBookings.removeColumn("admin_panel"); myBookings.removeColumn("user_id");
     * 
     * myBookings.getColumn("booking_id").setHeaderCaption("Booking ID");
     */

    upcomingBookings = new Grid(gpc);
    // Create a grid
    upcomingBookings.setStyleName("my-style");
    upcomingBookings.setWidth("100%");
    upcomingBookings.setSelectionMode(SelectionMode.SINGLE);
    upcomingBookings.setEditorEnabled(false);

    upcomingBookings.setColumnOrder("ID", "confirmation", "deviceName", "service", "start", "end", "username",
            "phone", "price");
    upcomingBookings.getColumn("price").setHeaderCaption("Approx. Price");

    // System.out.println(myBookings.getColumns());
    setRenderers(upcomingBookings);
    devicesLayout.addComponent(upcomingBookings);

    upcomingBookings.getColumn("delete")
            .setRenderer(new ButtonRenderer(new ClickableRenderer.RendererClickListener() {
                /**
                 * 
                 */
                private static final long serialVersionUID = 302628105070456680L;

                @Override
                public void click(RendererClickEvent event) {

                    try {

                        Window cd = new Window("Delete Booking");

                        cd.setHeight("200px");
                        cd.setWidth("400px");
                        cd.setResizable(false);

                        GridLayout dialogLayout = new GridLayout(3, 3);

                        Button okButton = new Button("Yes");
                        okButton.addStyleName(ValoTheme.BUTTON_DANGER);
                        Button cancelButton = new Button("No, I'm actually not sure!");
                        cancelButton.addStyleName(ValoTheme.BUTTON_PRIMARY);
                        Label information = new Label("Are you sure you want to trash this item?");
                        information.addStyleName(ValoTheme.LABEL_NO_MARGIN);

                        okButton.addClickListener(new Button.ClickListener() {
                            /**
                             * 
                             */
                            private static final long serialVersionUID = 1778157399909757369L;

                            @Override
                            public void buttonClick(ClickEvent okEvent) {

                                purgeBooking((BookingBean) event.getItemId());

                                booking.setSelectedTab(myUpcomingBookings());

                                cd.close();

                                showNotification("The booking was deleted!",
                                        "You wanted to delete an upcoming booking and it wasn't within the next 24 hours. All good, item purged.");
                            }
                        });

                        cancelButton.addClickListener(new Button.ClickListener() {
                            /**
                             * 
                             */
                            private static final long serialVersionUID = -8957620319158438769L;

                            @Override
                            public void buttonClick(ClickEvent okEvent) {
                                cd.close();
                            }
                        });

                        dialogLayout.addComponent(information, 0, 0, 2, 0);
                        dialogLayout.addComponent(okButton, 0, 1);
                        dialogLayout.addComponent(cancelButton, 1, 1);
                        dialogLayout.setMargin(true);
                        dialogLayout.setSpacing(true);
                        cd.setContent(dialogLayout);
                        cd.center();
                        UI.getCurrent().addWindow(cd);

                    } catch (Exception e) {
                        e.printStackTrace();
                    }

                }

            }));

    // TODO filtering
    // HeaderRow filterRow = devicesGrid.prependHeaderRow();

    return devicesLayout;
}