Example usage for com.vaadin.ui Panel getId

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

Introduction

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

Prototype

@Override
    public String getId() 

Source Link

Usage

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

private void buildLayout() {

    VerticalLayout chatAndFooter = new VerticalLayout();
    chatAndFooter.setHeight("90%");
    VerticalLayout contacts = new VerticalLayout();
    contacts.setSizeFull();/*w  w  w.  j  a  va2  s  . c o m*/
    contactsPanel.setHeight("800px");
    contactsPanel.setWidth("300px");
    contactsPanel.setContent(contactsLayout);
    contacts.addComponent(contactsPanel);
    contacts.setHeight("90%");

    TextField idTo = new TextField("idTo");
    idTo.setWidth("200px");
    Button setIdTo = new Button("set");
    setIdTo.setWidth("100px");
    HorizontalLayout setUserToId = new HorizontalLayout();

    Button.ClickListener st = new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (!idTo.getValue().equals("")) {
                UserInfoBean newUserTo = new UserInfoBean();
                newUserTo.setId(Integer.parseInt(idTo.getValue()));
                newUserTo.setName("id" + idTo.getValue());
                control.setUserTo(newUserTo);
                if (footer.isVisible() == false) {
                    footer.setVisible(true);
                }
                UserInfoFace look = new UserInfoFace(newUserTo, control, footer);
                Panel panel = look.getUserPanel();

                boolean exists = false;
                for (int i = 0; i < contactsLayout.getComponentCount(); i++) {
                    if (contactsLayout.getComponent(i).getClass() == Panel.class) {
                        Panel pan = (Panel) contactsLayout.getComponent(i);
                        if ((!(pan.getId() == null)) && pan.getId().equals(idTo.getValue())) {
                            exists = true;
                        }
                    }
                }
                if (exists == false) {
                    contactsLayout.addComponent(panel);
                }
                control.clearChat();
                control.updateChatLog(10);
            }
            idTo.clear();
        }
    };

    setIdTo.addClickListener(st);
    setUserToId.addComponents(idTo, setIdTo);
    setUserToId.setComponentAlignment(setIdTo, Alignment.BOTTOM_CENTER);
    contacts.addComponent(setUserToId);
    mainLayout.addComponents(contacts);
    footer.setVisible(false);/////////
    chatAndFooter.addComponents(chatPanel, footer);
    chatLayout = new VerticalLayout();
    chatPanel.setHeight("750px");
    chatPanel.setWidth("900px");
    chatPanel.setContent(chatLayout);
    chatInput = new TextField();
    chatInput.setWidthUndefined();
    footer.addComponent(chatInput);
    chatInput.focus();
    send.setWidth("120px");
    footer.addComponent(send);
    clear.setWidth("120px");
    footer.addComponent(clear);
    update.setWidth("120px");
    footer.addComponent(update);
    footer.setHeight("50px");
    footer.setWidth("900px");
    chatInput.setWidth("100%");
    footer.setExpandRatio(chatInput, 1f);
    chatAndFooter.setExpandRatio(chatPanel, 1f);
    mainLayout.addComponents(chatAndFooter);
    mainLayout.setExpandRatio(chatAndFooter, 1f);
    control.loadFriends();
}