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:com.squadd.chat.UserInfoFace.java

public Panel getUserPanel(Integer userId) {
    Panel contactPanel = new Panel();
    FormLayout contactLine = new FormLayout();
    user = new UserInfoBean();
    user.setId(userId);//from   w w w  . j  a  va 2  s  .  c  om
    user.setName("id" + userId);
    contactPanel.addClickListener(upd);
    Label nameLabel = new Label(user.getName());
    nameLabel.setStyleName("userPanel");
    contactLine.addComponent(nameLabel);
    contactPanel.setContent(contactLine);
    contactPanel.setId(userId.toString());
    return contactPanel;
    //contactsContent.addComponent(look);
    //contactsPanel.setContent(contactsContent);
}

From source file:com.squadd.UI.GroupChatLayout.java

public GroupChatLayout(Group group) {
    name = new Panel();
    Label label = new Label("Group Chat");
    label.setSizeUndefined();/* ww  w  . ja  v  a2  s. c om*/
    HorizontalLayout hor = new HorizontalLayout();
    hor.setWidth(0.67 * Display.width + "px");
    hor.addComponent(label);
    hor.setComponentAlignment(label, Alignment.TOP_CENTER);
    name.setWidth(0.68 * Display.width + "px");
    name.setContent(hor);
    name.setStyleName("backColorGrey");
    message = new TextArea();
    msg = new ArrayList();
    send = new Button("send");
    content = new VerticalLayout();

    dateComparator = new Comparator<GroupChat>() {
        @Override
        public int compare(GroupChat o1, GroupChat o2) {
            return -o1.getDate().compareTo(o2.getDate());
        }
    };
    configureLayout(group);
    configureActions(group);
}

From source file:com.squadd.UI.GroupParticipantsLayout.java

public GroupParticipantsLayout(Group group) {
    name = new Panel();
    participants = new VerticalLayout();
    buildLayout(group);
    configureActions();
}

From source file:com.squadd.UI.MessageLayout.java

private void configureLayout() {
    VerticalLayout all = new VerticalLayout();
    HorizontalLayout dates = new HorizontalLayout(when);
    dates.setSpacing(true);/*from   w w  w . ja v a2 s .c o  m*/
    when.setSizeUndefined();
    Panel panel = new Panel();
    panel.setWidth(Display.width * 0.3 + "px");
    panel.setContent(text);
    groupPhoto.setWidth(Display.width * 0.05 + "px");
    groupPhoto.setHeight(Display.height * 0.05 + "px");
    HorizontalLayout other = new HorizontalLayout(groupPhoto, panel);
    all.addComponents(dates, other);
    Panel wrap = new Panel();
    wrap.setContent(all);
    addComponent(wrap);
}

From source file:com.squadd.UI.OneParticipant.java

private void buildLayout() {
    image.setWidth(0.04 * Display.width + "px");
    image.setHeight(0.04 * Display.height + "px");

    userName.setWidth(0.2 * Display.width + "px");

    Panel forPic = new Panel();
    forPic.setContent(image);//  w w  w . ja  v  a  2 s .c  om
    Panel userN = new Panel(userName);

    addComponents(forPic, userN);
}

From source file:com.squadd.views.ChatView.java

@Override
protected Panel fillContentPanel(Layout layout) {
    Panel result = new Panel();
    result.setContent(configureMainPageLayout());
    return result;
}

From source file:com.squadd.views.ChatView.java

private void configureComponents() {
    mainLayout = new HorizontalLayout();
    mainUser = man.get(contact.getUserInfo().getId(), UserInfo.class, UserInfoBean.class);
    contactsLayout = new VerticalLayout();
    contactsPanel = new Panel();
    chatPanel = new Panel();
    footer = new HorizontalLayout();
    control = new DialogController(mainUser, null, chatPanel, contactsPanel, footer, this);
    content = new FormLayout();
    contactsContent = new FormLayout();
    //this.getUI().getPushConfiguration().setPushMode(PushMode.MANUAL);

    ClickListener sendListener = new ClickListener() {
        @Override//from   w w w  .j  ava2  s.c o  m
        public void buttonClick(final ClickEvent event) {
            ChatMessage mess = new ChatMessage(control.getUserFromId(), control.getUserToId(), new Date(),
                    chatInput.getValue());
            String body = mess.getBody();
            if (body != null && !body.isEmpty()) {
                control.manager.add(mess);
                MessageBroadcaster.broadcast(mess);
                chatInput.clear();
                chatInput.focus();
            }
        }
    };

    ClickListener clearListener = (ClickEvent event) -> {
        clearChat();
        content = new FormLayout();
    };

    ClickListener updateListener = new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            clearChat();
            content = new FormLayout();
            control.updateChatLog(4);
        }
    };

    send = new Button("Send", sendListener);
    clear = new Button("Clear", clearListener);
    update = new Button("Update", updateListener);
}

From source file:com.studiodojo.qwikinvoice.QwikInvoiceApplication.java

License:Apache License

@Override
public void init() {
    this.mainWindow = new Window(
            "QwikInvoice CRM Tools - Developed by StudioDojo. Engineered by Vaadin. Powered by Google.");
    setMainWindow(mainWindow);//w  ww.j  a va2s  .  c o  m
    //
    // Check if a user is logged in
    //
    UserService us = UserServiceFactory.getUserService();
    this.logoutURL = us.createLogoutURL(super.getURL().toExternalForm());
    if (us.getCurrentUser() == null || us.getCurrentUser().getEmail() == null) {
        super.setLogoutURL(logoutURL);
        super.close();
        return;
    }
    String login = us.getCurrentUser().getEmail();
    this.userKey = KeyFactory.createKey(TokenBean.class.getSimpleName(), us.getCurrentUser().getEmail());
    //
    Key ucKey = KeyFactory.createKey(UserCompanyBean.class.getSimpleName(), us.getCurrentUser().getEmail());
    UserCompanyBean ucBean = UserDAO.getUserCompanyBean(us.getCurrentUser().getEmail());

    this.theSession = new SessionBean(login, ucBean);
    //
    // SETUP WORKING AREA
    //
    HorizontalLayout appLayout = new HorizontalLayout();
    appLayout.setSizeFull();
    // The Main Layout
    VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.setWidth(APP_WIDTH);
    mainLayout.setHeight(APP_HEIGHT);
    appLayout.addComponent(mainLayout);
    appLayout.setComponentAlignment(mainLayout, Alignment.TOP_CENTER);
    appLayout.setExpandRatio(mainLayout, 2);
    //
    // Setup Header (Welcome Message)
    //
    Label welcome = new Label(
            "<h1>QWIK!NVOICE</h1> You are " + (us.isUserLoggedIn() ? "logged in" : "logged out") + " as <b>"
                    + us.getCurrentUser().getNickname() + "</b>",
            Label.CONTENT_XHTML);
    mainLayout.addComponent(welcome);
    mainLayout.setComponentAlignment(welcome, Alignment.TOP_LEFT);
    //
    // Menu Bar
    //
    MenuBar menuBar = new MenuBar();
    menuBar.setWidth(APP_WIDTH);
    MenuBar.MenuItem fileMenuItem = menuBar.addItem("File", null, null);
    MenuItem newMenuItem = fileMenuItem.addItem("New...", null, null);
    newMenuItem.addItem("Invoice/Quote", new MenuBar.Command() {

        public void menuSelected(MenuItem selectedItem) {
            try {
                QwikInvoiceApplication.this.showPanel(InvoiceApplicationPanel.class);
            } catch (Exception e) {
                Log.log(Level.SEVERE, "Error loading panel", e);
                QwikInvoiceApplication.this.mainWindow.showNotification("Error", e.getMessage(),
                        Notification.TYPE_ERROR_MESSAGE);
            }

        }
    });
    newMenuItem.addItem("Order", new MenuBar.Command() {

        public void menuSelected(MenuItem selectedItem) {
            try {
                QwikInvoiceApplication.this.showPanel(FFOrderApplicationPanel.class);
            } catch (Exception e) {
                Log.log(Level.SEVERE, "Error loading panel", e);
                QwikInvoiceApplication.this.mainWindow.showNotification("Error", e.getMessage(),
                        Notification.TYPE_ERROR_MESSAGE);
            }

        }
    });
    /** SAVE */
    fileMenuItem.addItem("Save", new MenuBar.Command() {

        public void menuSelected(MenuItem selectedItem) {
            try {
                TokenBean userTokenBean = TokenStore.getToken(QwikInvoiceApplication.this.userKey);
                // User must have an OAuth AUTH Token to access Google Doc service
                if (userTokenBean != null) {
                    /*
                    GDocFileWindow saveWindow = new GDocFileWindow("Save As...");
                    saveWindow.init(QwikInvoiceApplication.this, PdfWriter.getFilename(QwikInvoiceApplication.this.theSession));
                    QwikInvoiceApplication.this.mainWindow.addWindow(saveWindow);
                    */
                    QwikInvoiceApplication.this.activePanel.validate();
                    QwikInvoiceApplication.this.activePanel.onSave();
                } else {
                    AuthSubWindow authsubWindow = new AuthSubWindow("Service Authorization Required");
                    authsubWindow.init(QwikInvoiceApplication.this.userKey);
                    QwikInvoiceApplication.this.mainWindow.addWindow(authsubWindow);
                }
            } catch (Exception e) {
                Log.log(Level.SEVERE, "Error Saving file", e);
                QwikInvoiceApplication.this.mainWindow.showNotification("Error", e.getMessage(),
                        Notification.TYPE_ERROR_MESSAGE);
            }
        }
    });
    /**
     * SETTINGS
     */
    fileMenuItem.addSeparator();
    MenuItem settingsMenuItem = fileMenuItem.addItem("Settings...", null, null);
    settingsMenuItem.addItem("Profile", new MenuBar.Command() {

        public void menuSelected(MenuItem selectedItem) {
            try {
                UserCompanySetupWindow aWindow = new UserCompanySetupWindow();
                aWindow.init(QwikInvoiceApplication.this);
                QwikInvoiceApplication.this.mainWindow.addWindow(aWindow);
            } catch (Exception e) {
                Log.log(Level.SEVERE, "Error Saving Profile", e);
                QwikInvoiceApplication.this.mainWindow.showNotification("Error", e.getMessage(),
                        Notification.TYPE_ERROR_MESSAGE);
            }
        }
    });
    fileMenuItem.addSeparator();

    fileMenuItem.addItem("Logout", new MenuBar.Command() {

        public void menuSelected(MenuItem selectedItem) {
            QwikInvoiceApplication.this.setLogoutURL(logoutURL);
            QwikInvoiceApplication.this.close();

        }
    });
    /**
     * Products
     */
    MenuBar.MenuItem productsMenuItem = menuBar.addItem("Products", null, null);
    productsMenuItem.addItem("Products", null, new MenuBar.Command() {

        public void menuSelected(MenuItem selectedItem) {
            try {
                QwikInvoiceApplication.this.showPanel(ProductApplicationPanel.class);
            } catch (Exception e) {
                Log.log(Level.SEVERE, "Error loading products", e);
                QwikInvoiceApplication.this.mainWindow.showNotification("Error", e.getMessage(),
                        Notification.TYPE_ERROR_MESSAGE);
            }
        }
    });
    productsMenuItem.addItem("Categories", null, new MenuBar.Command() {

        public void menuSelected(MenuItem selectedItem) {
            try {
                ProductCategorySettingsWindow window = new ProductCategorySettingsWindow();
                window.setCaption("Product Category");
                window.init(QwikInvoiceApplication.this.theSession, QwikInvoiceApplication.this);
                QwikInvoiceApplication.this.mainWindow.addWindow(window);
            } catch (Exception e) {
                Log.log(Level.SEVERE, "Error Loading Products", e);
                QwikInvoiceApplication.this.mainWindow.showNotification("Error", e.getMessage(),
                        Notification.TYPE_ERROR_MESSAGE);
            }
        }
    });
    productsMenuItem.addItem("Catalogs", null, new MenuBar.Command() {

        public void menuSelected(MenuItem selectedItem) {
            try {
                QwikInvoiceApplication.this.showPanel(CatalogApplicationPanel.class);
            } catch (Exception e) {
                Log.log(Level.SEVERE, "Error loading catalogs", e);
                QwikInvoiceApplication.this.mainWindow.showNotification("Error", e.getMessage(),
                        Notification.TYPE_ERROR_MESSAGE);
            }
        }
    });
    /**
     * Help
     */
    MenuBar.MenuItem helpMenuItem = menuBar.addItem("Help", null, new MenuBar.Command() {

        public void menuSelected(MenuItem selectedItem) {
            AboutWindow aboutWindow = new AboutWindow();
            aboutWindow.init();
            QwikInvoiceApplication.this.mainWindow.addWindow(aboutWindow);
        }
    });
    helpMenuItem.addItem("About...", null, null);
    mainLayout.addComponent(menuBar);
    mainLayout.setComponentAlignment(menuBar, Alignment.TOP_CENTER);
    //
    // Load Main Panel
    //
    IApplicationPanel invoiceApplicationPanel = (IApplicationPanel) this.map.get(InvoiceApplicationPanel.class);
    try {
        invoiceApplicationPanel.init(this.theSession, this);
        mainLayout.addComponent((Component) invoiceApplicationPanel);
        mainLayout.setComponentAlignment((Component) invoiceApplicationPanel, Alignment.TOP_CENTER);
        this.activePanel = invoiceApplicationPanel;
    } catch (Exception e) {
    }
    //
    // Setup Footer
    //
    //Label footerMessage = new Label("QwikInvoice <b>version "+_VERSION_+"</b>. This service is provided as is. E&O accepted. Developed by <a href='mailto:public@studiodojo.com?subject=QwikInvoice' target='_blank'>StudioDojo</a>. Engineered by Vaadin. Powered by Google. Apache License 2.0", Label.CONTENT_XHTML);
    //mainLayout.addComponent(footerMessage);
    //mainLayout.setComponentAlignment(footerMessage, Alignment.TOP_CENTER);
    Panel mainPanel = new Panel();
    mainPanel.setScrollable(true);
    mainPanel.setContent(appLayout);
    this.mainWindow.setContent(mainPanel);
}

From source file:com.terralcode.gestion.frontend.view.panel.employee.EmployeeView.java

private void builtBody() throws Exception {

    Panel panel = new Panel();

    panel.setContent(builtEmployeeTable());
    addComponent(panel);
}

From source file:com.terralcode.gestion.frontend.view.widgets.incomingAppointments.IncomingAppointments.java

@Override
protected Component buildContent() {
    wrapper = new Panel();
    wrapper.setSizeFull();//from  ww  w.j  ava2 s. c  o m

    root = new VerticalLayout();

    loadAppointments();

    wrapper.setContent(root);
    return wrapper;
}