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.save.global.ErrorLoggedNotification.java

public static void showWarningLoggedOnWindow(String warning, String className) {
    VerticalLayout v = new VerticalLayout();
    v.setSizeFull();/*from www  . ja va2s .co m*/
    v.setMargin(true);

    Window sub = new Window("WARNING MESSAGE!");
    sub.setWidth("500px");
    if (sub.getParent() == null) {
        UI.getCurrent().addWindow(sub);
    }
    sub.setModal(true);

    Panel panel = new Panel();
    panel.setSizeFull();
    panel.addStyleName(ValoTheme.PANEL_BORDERLESS);
    panel.setContent(new Label(warning + " on \n" + className, ContentMode.HTML));
    panel.getContent().setHeightUndefined();
    v.addComponent(panel);

    sub.setContent(v);
    sub.getContent().setHeightUndefined();
}

From source file:com.scipionyx.butterflyeffect.frontend.core.ui.MainUI.java

License:Apache License

/**
 * /*from w  w w.  j  av a 2  s.c om*/
 */
@Override
protected void init(VaadinRequest request) {

    // Top Menu

    final VerticalLayout root = new VerticalLayout();
    root.setSizeFull();
    root.setMargin(new MarginInfo(false, false, false, false));
    root.setSpacing(false);

    root.addComponent(topFactory.instance());

    setContent(root);

    viewContainer = new Panel();
    viewContainer.setStyleName(ValoTheme.PANEL_BORDERLESS);
    viewContainer.setSizeFull();

    root.addComponent(viewContainer);
    root.setExpandRatio(viewContainer, 1.0f);

    // Define the access denied view
    viewProvider.setAccessDeniedViewClass(AccessDeniedView.class);

}

From source file:com.selzlein.lojavirtual.vaadin.page.SettingsView.java

License:Open Source License

private void createView() {
    ui = (LspsUI) getUI();/*from w w w. j a v  a2 s.  com*/
    user = ui.getUser().getPerson();
    userRights = user.getRights();

    setTitle(ui.getMessage(TITLE));

    Panel panel = new Panel();
    panel.addStyleName("l-border-none");
    setContent(panel);

    VerticalLayout layout = new VerticalLayout();
    layout.addStyleName("l-settings");
    layout.setSizeFull();
    layout.setSpacing(true);
    layout.setMargin(true);
    panel.setContent(layout);

    //user data and settings will be laid out next to each other
    HorizontalLayout topSection = new HorizontalLayout();
    topSection.setSpacing(true);
    topSection.setWidth("100%");
    layout.addComponent(topSection);

    VerticalLayout userData = createUserDataSection(ui, user);
    topSection.addComponent(userData);
    topSection.setExpandRatio(userData, 1);

    Label spacer = new Label();
    spacer.setWidth("20px");
    topSection.addComponent(spacer);

    VerticalLayout settings = createSettingsSection(ui);
    topSection.addComponent(settings);
    topSection.setExpandRatio(settings, 1);

    //substitution section
    VerticalLayout substitution = createSubstitutionSection();
    layout.addComponent(substitution);
    layout.setExpandRatio(substitution, 2);

    //buttons
    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    Button saveButton = new Button(ui.getMessage("action.save"), new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            if (save()) {
                if (requestReload) {
                    JavaScript.getCurrent().execute("window.location.reload()");
                } else {
                    close();
                }
            }
        }
    });
    saveButton.setData(BUTTON_TYPE_SAVE);
    buttons.addComponent(saveButton);
    Button cancelButton = new Button(ui.getMessage("action.cancel"), new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            close();
        }
    });
    buttons.addComponent(cancelButton);
    layout.addComponent(buttons);
}

From source file:com.selzlein.lojavirtual.vaadin.page.SettingsView.java

License:Open Source License

private VerticalLayout createSubstitutionSection() {
    VerticalLayout substitution = new VerticalLayout();
    substitution.addStyleName("l-substitutes");
    substitution.setSpacing(true);//from   ww w  . j  a v  a2 s.c om
    substitution.setSizeFull();

    Label substitutionHeader = new Label("<h2>" + ui.getMessage("settings.substitutionSection") + "</h2>",
            ContentMode.HTML);
    substitution.addComponent(substitutionHeader);

    Label substitutionHelp = new Label(ui.getMessage("settings.substitutionHelp"));
    substitutionHelp.setStyleName("form-help");
    substitution.addComponent(substitutionHelp);

    this.substitutionActive = new CheckBox(ui.getMessage("settings.substitutionActive"));
    substitutionActive.addStyleName("ui-spacing");
    substitutionActive.setValue(user.isSubstitutionActive());
    substitution.addComponent(substitutionActive);

    //substitutes
    selectedPersons = user.getDirectSubstitutes();
    this.substitutes = new OptionGroup(ui.getMessage("settings.substitutes"));
    refreshSubstitutes("");

    TextField substituteFilter = new TextField(ui.getMessage("action.filter"));
    substituteFilter.addValueChangeListener(new ValueChangeListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            substitutes.removeAllItems();
            refreshSubstitutes(event.getProperty().getValue().toString());
        }
    });
    substitution.addComponent(substituteFilter);
    Panel substitutesPanel = new Panel();
    substitutesPanel.addStyleName("l-border-none");
    substitutesPanel.setSizeFull();
    substitutesPanel.setContent(substitutes);
    substitution.addComponent(substitutesPanel);
    substitution.setExpandRatio(substitutesPanel, 2);

    return substitution;
}

From source file:com.skysql.manager.ui.OverviewPanel.java

License:Open Source License

/**
 * Instantiates a new overview panel./*from w ww . ja va2  s  .  c om*/
 */
public OverviewPanel() {

    HorizontalLayout overviewContainer = new HorizontalLayout();
    overviewContainer.addStyleName("overviewPanel");
    overviewContainer.setWidth("100%");
    setContent(overviewContainer);

    systemInfo = VaadinSession.getCurrent().getAttribute(SystemInfo.class);
    systemRecord = systemInfo.getCurrentSystem();
    systemLayout = new SystemLayout(systemRecord);
    overviewContainer.addComponent(systemLayout);

    VerticalLayout nodesSlot = new VerticalLayout();
    nodesSlot.addStyleName("nodesSlot");
    nodesSlot.setMargin(new MarginInfo(false, false, false, false));
    overviewContainer.addComponent(nodesSlot);
    overviewContainer.setExpandRatio(nodesSlot, 1.0f);

    final HorizontalLayout nodesHeader = new HorizontalLayout();
    nodesHeader.setStyleName("panelHeaderLayout");
    nodesHeader.setWidth("100%");
    nodesSlot.addComponent(nodesHeader);
    nodesLabel = new Label(" ");
    nodesLabel.setSizeUndefined();
    nodesHeader.addComponent(nodesLabel);
    nodesHeader.setComponentAlignment(nodesLabel, Alignment.MIDDLE_CENTER);
    nodesHeader.setExpandRatio(nodesLabel, 1.0f);

    final HorizontalLayout buttonsLayout = new HorizontalLayout();
    buttonsLayout.setSpacing(true);
    buttonsLayout.setMargin(new MarginInfo(false, true, false, false));
    nodesHeader.addComponent(buttonsLayout);
    nodesHeader.setComponentAlignment(buttonsLayout, Alignment.MIDDLE_RIGHT);

    addSystemButton = new Button("Add System...");
    addSystemButton.setDescription("Add System");
    addSystemButton.setVisible(false);
    buttonsLayout.addComponent(addSystemButton);
    addSystemButton.addClickListener(new Button.ClickListener() {

        public void buttonClick(ClickEvent event) {
            new SystemDialog(null, null);
        }
    });

    addNodeButton = new Button("Add Node...");
    addNodeButton.setDescription("Add Node to the current System");
    addNodeButton.setVisible(false);
    buttonsLayout.addComponent(addNodeButton);
    addNodeButton.addClickListener(new Button.ClickListener() {

        public void buttonClick(ClickEvent event) {
            new NodeDialog(null, null);
        }
    });

    final Button editButton = new Button("Edit");
    editButton.setDescription("Enter Editing mode");
    final Button saveButton = new Button("Done");
    saveButton.setDescription("Exit Editing mode");
    buttonsLayout.addComponent(editButton);

    editButton.addClickListener(new Button.ClickListener() {

        public void buttonClick(ClickEvent event) {
            buttonsLayout.replaceComponent(editButton, saveButton);
            isEditable = true;
            systemLayout.setEditable(true);
            nodesLayout.setEditable(true);
            nodesHeader.setStyleName("panelHeaderLayout-editable");
            if (systemRecord != null && !SystemInfo.SYSTEM_ROOT.equals(systemRecord.getID())) {
                addNodeButton.setVisible(true);
            } else {
                addSystemButton.setVisible(true);
            }
            if (systemRecord == null || (systemRecord != null && systemRecord.getNodes().length == 0)) {
                nodesLayout.placeholderLayout(null);
            }
        }
    });

    saveButton.addClickListener(new Button.ClickListener() {

        public void buttonClick(ClickEvent event) {
            buttonsLayout.replaceComponent(saveButton, editButton);
            isEditable = false;
            systemLayout.setEditable(false);
            nodesLayout.setEditable(false);
            nodesHeader.setStyleName("panelHeaderLayout");
            if (systemRecord != null && systemRecord.getNodes().length == 0) {
                nodesLayout.placeholderLayout(null);
            }
            addNodeButton.setVisible(false);
            addSystemButton.setVisible(false);
        }
    });

    Panel panel = new Panel();
    panel.setHeight(PANEL_HEIGHT, Unit.PIXELS);
    panel.addStyleName(Runo.PANEL_LIGHT);
    nodesSlot.addComponent(panel);

    nodesLayout = new NodesLayout(systemRecord);
    nodesLayout.addStyleName("nodesLayout");
    nodesLayout.setWidth("100%");
    panel.setContent(nodesLayout);

}

From source file:com.skysql.manager.ui.PanelInfo.java

License:Open Source License

/**
 * Creates the charts layout.//from  w w  w  . j  a va 2 s.co m
 */
private void createChartsLayout() {

    chartsLayout = new VerticalLayout();
    chartsLayout.addStyleName("chartsLayout");
    chartsLayout.setHeight("100%");
    chartsLayout.setSpacing(true);
    addComponent(chartsLayout);

    final HorizontalLayout chartsHeaderLayout = new HorizontalLayout();
    chartsHeaderLayout.setStyleName("panelHeaderLayout");
    chartsHeaderLayout.setWidth("100%");
    chartsHeaderLayout.setSpacing(true);
    chartsHeaderLayout.setMargin(new MarginInfo(false, true, false, true));
    chartsLayout.addComponent(chartsHeaderLayout);

    chartControls = new ChartControls();
    chartControls.addIntervalSelectionListener(chartIntervalListener);
    chartControls.addThemeSelectionListener(chartThemeListener);
    chartsHeaderLayout.addComponent(chartControls);
    chartsHeaderLayout.setComponentAlignment(chartControls, Alignment.MIDDLE_LEFT);

    final HorizontalLayout buttonsLayout = new HorizontalLayout();
    buttonsLayout.setSpacing(true);
    chartsHeaderLayout.addComponent(buttonsLayout);
    chartsHeaderLayout.setComponentAlignment(buttonsLayout, Alignment.MIDDLE_RIGHT);

    SettingsDialog settingsDialog = new SettingsDialog("Edit Monitors...", "Monitors");
    final Button editMonitorsButton = settingsDialog.getButton();
    editMonitorsButton.setVisible(false);
    buttonsLayout.addComponent(editMonitorsButton);

    final Button addChartButton = new Button("Add Chart...");
    addChartButton.setVisible(false);
    buttonsLayout.addComponent(addChartButton);
    addChartButton.addClickListener(new Button.ClickListener() {

        public void buttonClick(ClickEvent event) {
            new ChartsDialog(chartsArrayLayout, null);
        }
    });

    final Button editButton = new Button("Edit");
    editButton.setDescription("Enter Editing mode");
    final Button saveButton = new Button("Done");
    saveButton.setDescription("Exit Editing mode");
    buttonsLayout.addComponent(editButton);
    editButton.addClickListener(new Button.ClickListener() {

        public void buttonClick(ClickEvent event) {
            buttonsLayout.replaceComponent(editButton, saveButton);
            chartsArrayLayout.setDragMode(LayoutDragMode.CLONE);
            chartsArrayLayout.setEditable(true);
            chartsHeaderLayout.setStyleName("panelHeaderLayout-editable");
            editMonitorsButton.setVisible(true);
            addChartButton.setVisible(true);
            OverviewPanel overviewPanel = getSession().getAttribute(OverviewPanel.class);
            overviewPanel.setEnabled(false);

        }
    });

    saveButton.addClickListener(new Button.ClickListener() {

        public void buttonClick(ClickEvent event) {
            buttonsLayout.replaceComponent(saveButton, editButton);
            chartsArrayLayout.setDragMode(LayoutDragMode.NONE);
            chartsArrayLayout.setEditable(false);
            chartsHeaderLayout.setStyleName("panelHeaderLayout");
            editMonitorsButton.setVisible(false);
            addChartButton.setVisible(false);
            OverviewPanel overviewPanel = getSession().getAttribute(OverviewPanel.class);
            overviewPanel.setEnabled(true);
            refresh();
        }
    });

    final Button expandButton = new NativeButton();
    expandButton.setStyleName("expandButton");
    expandButton.setDescription("Expand/Reduce viewing area");
    buttonsLayout.addComponent(expandButton);
    buttonsLayout.setComponentAlignment(expandButton, Alignment.MIDDLE_CENTER);
    expandButton.addClickListener(new Button.ClickListener() {

        public void buttonClick(ClickEvent event) {
            isExpanded = !isExpanded;

            AnimatorProxy proxy = getSession().getAttribute(AnimatorProxy.class);
            proxy.addListener(new AnimationListener() {
                public void onAnimation(AnimationEvent event) {
                    Component component = event.getComponent();
                    component.setVisible(isExpanded ? false : true);
                }
            });
            //            OverviewPanel overviewPanel = getSession().getAttribute(OverviewPanel.class);
            //            if (!isExpanded) {
            //               overviewPanel.setVisible(isExpanded ? false : true);
            //            }
            //            proxy.animate(overviewPanel, isExpanded ? AnimType.ROLL_UP_CLOSE : AnimType.ROLL_DOWN_OPEN).setDuration(500).setDelay(100);
            //
            //            TopPanel topPanel = getSession().getAttribute(TopPanel.class);
            //            if (!isExpanded) {
            //               topPanel.setVisible(isExpanded ? false : true);
            //            }
            //            proxy.animate(topPanel, isExpanded ? AnimType.ROLL_UP_CLOSE : AnimType.ROLL_DOWN_OPEN).setDuration(500).setDelay(100);

            VerticalLayout topMid = getSession().getAttribute(VerticalLayout.class);
            if (!isExpanded) {
                topMid.setVisible(isExpanded ? false : true);
            }
            proxy.animate(topMid, isExpanded ? AnimType.ROLL_UP_CLOSE : AnimType.ROLL_DOWN_OPEN)
                    .setDuration(500).setDelay(100);

            expandButton.setStyleName(isExpanded ? "contractButton" : "expandButton");
        }
    });

    chartsPanel = new Panel();
    chartsPanel.setSizeFull();
    chartsPanel.addStyleName(Runo.PANEL_LIGHT);
    chartsLayout.addComponent(chartsPanel);
    chartsLayout.setExpandRatio(chartsPanel, 1.0f);

}

From source file:com.squadd.chat.ChatController.java

public Panel createPhotoPanel(Embedded image) {
    Panel photoPanel = new Panel();
    photoPanel.setContent(image);/*from w w w  . j a v a  2  s  .  c  o  m*/
    //photoPanel.setWidth("50px");
    //photoPanel.setHeight("50px");

    UserInfoBean use = man.get(userTo.getId(), UserInfo.class, UserInfoBean.class);

    MouseEvents.ClickListener showUserButtonListener = new MouseEvents.ClickListener() {
        @Override
        public void click(MouseEvents.ClickEvent event) {
            if (use != null) {
                System.out.println(use.getId());
                view.setAnotherUser(use);
                UI.getCurrent().getNavigator().navigateTo(UserPageView.NAME);
            }
        }
    };
    if (use != null) {
        photoPanel.addClickListener(showUserButtonListener);
    }

    return photoPanel;
}

From source file:com.squadd.chat.ChatController.java

public static Panel createDatePanel(ChatMessage mess) {
    Panel datePanel = new Panel();
    //FormLayout form = new FormLayout();
    //form.setMargin(false);
    Label dateLabel = new Label(mess.getFormattedDate());
    dateLabel.addStyleName("dateLabel");
    dateLabel.setValue("YrMOOOm");
    //form.addComponent(dateLabel);
    //datePanel.setContent(form);
    datePanel.setContent(dateLabel);/*  w  w  w  . ja va  2s .  co  m*/
    datePanel.setWidth("100px");
    datePanel.setHeight("50px");
    return datePanel;
}

From source file:com.squadd.chat.ChatController.java

public static Panel createMessagePanel(ChatMessage message) {
    Panel chatLine = new Panel();
    Integer from = message.getIdFrom();
    Integer to = message.getIdTo();
    String body = message.getBody();

    VerticalLayout messageLayout = new VerticalLayout();
    Label nameLabel = new Label(from.toString() + " said:");//!!! ?
    nameLabel.setStyleName("messageHeader");
    Label messageLabel = new Label(body);
    messageLabel.setStyleName("messageBody");
    messageLayout.addComponents(nameLabel, messageLabel);
    chatLine.setContent(messageLayout);/*from  w  ww  .j a  va  2  s  .  c  om*/
    chatLine.setWidth("500px");
    return chatLine;
}

From source file:com.squadd.chat.UserInfoFace.java

public Panel getUserPanel() {
    Panel contactPanel = new Panel();
    FormLayout contactLine = new FormLayout();
    contactPanel.addClickListener(upd);//  w w w  .  j a  v  a  2  s  .  co m
    Label nameLabel = new Label(user.getName());
    nameLabel.setStyleName("userPanel");
    contactLine.addComponent(nameLabel);
    contactPanel.setContent(contactLine);
    contactPanel.setId(user.getId().toString());
    return contactPanel;
    //contactsContent.addComponent(look);
    //contactsPanel.setContent(contactsContent);
}