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.klwork.explorer.ui.user.ProfilePanel.java

License:Apache License

protected void initInformationPanel() {
    Panel infoPanel = new Panel();
    infoPanel.addStyleName(Reindeer.PANEL_LIGHT);
    infoPanel.setSizeFull();//from ww  w  . j  av  a 2  s  .c o  m

    profilePanelLayout.addComponent(infoPanel);
    profilePanelLayout.setExpandRatio(infoPanel, 1.0f); // info panel should take all the remaining width available

    // All the information sections are put under each other in a vertical layout
    this.infoPanelLayout = new VerticalLayout();
    infoPanel.setContent(infoPanelLayout);
    //
    initAboutSection();
    //?
    initContactSection();

}

From source file:com.lizardtech.expresszip.ui.FindLayersPresenter.java

License:Apache License

private void addClusteredVectorLayer() {
    if (clusterLayer != null) {
        findLayersMap.removeLayer(clusterLayer);
    }//from   w w  w. j  a  v a  2s  . com
    clusterLayer = new VectorLayer();
    clusterLayer.setSelectionMode(SelectionMode.SIMPLE);
    clusterLayer.addListener(new org.vaadin.vol.VectorLayer.VectorSelectedListener() {

        @Override
        public void vectorSelected(org.vaadin.vol.VectorLayer.VectorSelectedEvent event) {
            Vector[] vectors = event.getVectors();
            if (null == vectors)
                return;

            if (null != popup) {
                findLayersMap.removeComponent(popup);
            }
            popup = new Popup();
            findLayersMap.addPopup(popup);
            CssLayout cssLayout = new CssLayout();
            VerticalLayout verticalLayout = new VerticalLayout();
            Panel panel = new Panel();
            panel.setStyleName(Runo.PANEL_LIGHT);
            panel.setContent(verticalLayout);
            int height = Math.min(400, (vectors.length + 1) * 32 + 10);
            panel.setHeight(height + "px");
            cssLayout.addComponent(panel);
            popup.addComponent(cssLayout);

            TreeTable popupTable = findLayersView.getPopupTable();
            popupTable.removeAllItems();
            verticalLayout.addComponent(popupTable);

            List<ExpressZipLayer> layers = new ArrayList<ExpressZipLayer>();
            for (Vector selected : vectors) {
                final ExpressZipLayer layer = (ExpressZipLayer) selected.getData();
                findLayersView.addLayerItem(layer, popupTable);
                layers.add(layer);
            }
            Bounds b = MapModel.getBoundsForLayers(layers, MapModel.EPSG4326);
            popup.setLat((b.getMinLat() + b.getMaxLat()) / 2.0d);
            popup.setLon((b.getMaxLon() + b.getMinLon()) / 2.0d);
        }

    });

    clusterLayer.addListener(new org.vaadin.vol.VectorLayer.VectorUnSelectedListener() {

        @Override
        public void vectorUnSelected(VectorUnSelectedEvent event) {
            if (null != popup) {
                findLayersMap.removeComponent(popup);
                popup = null;
            }
        }
    });

    clusterLayer.setImmediate(true);
    findLayersMap.addLayer(clusterLayer);
}

From source file:com.lizardtech.expresszip.vaadin.ExportOptionsViewComponent.java

License:Apache License

public static Panel getScrollableComponent(Component form) {
    VerticalLayout vl = new VerticalLayout();
    vl.addComponent(form);//from   w ww  .j a  v a2 s . c o m

    Panel panel = new Panel();
    panel.setContent(vl);
    return panel;
}

From source file:com.logicbomb.newschool.MyAppWidgetSet.core.DayWidget.java

public DayWidget() {

    //Creating Panel
    Panel iPanel = new Panel();
    iPanel.addStyleName("backColorWhite");
    iPanel.setWidth("876px");
    iPanel.setHeight("41px");

    ProgressBar iDayProgressBar = new ProgressBar();
    iDayProgressBar.setCaption("Period 3, 10th October");
    iDayProgressBar.setWidth("875px");
    iDayProgressBar.setValue(0.3f);/*w  w w.  j ava 2s  .  c  o  m*/
    addComponent(iDayProgressBar);

    //Adding Panel to Vertical Layout
    addComponent(iPanel);
    VerticalLayout iVerticalLayout = new VerticalLayout();

    GridLayout iGridLayout = new GridLayout(9, 1);
    iGridLayout.setWidth("1000px");
    iGridLayout.setHeight("40px");

    for (int i = 1; i <= 8; i++) {

        HourWidget iHourAtAGlanceWidget = new HourWidget(i, 8);
        iHourAtAGlanceWidget.setSizeFull();
        iGridLayout.addComponent(iHourAtAGlanceWidget);
        iGridLayout.setColumnExpandRatio(i, 1);
    }

    iVerticalLayout.addComponent(iGridLayout);
    iPanel.setContent(iVerticalLayout);

}

From source file:com.logicbomb.newschool.MyAppWidgetSet.core.UserDetailsWidgetOld.java

public UserDetailsWidgetOld() {

    setSpacing(true);/*  w ww.  j  a  v  a2s  .  c om*/
    Panel iPanel = new Panel();
    iPanel.setWidth("50px");
    iPanel.setHeight("50px");
    iPanel.setStyleName("backColorWhite");
    addComponent(iPanel);
    String basepath = VaadinService.getCurrent().getBaseDirectory().getAbsolutePath();

    // Image as a file resource
    FileResource resource = new FileResource(new File(basepath + "/VAADIN/themes/mytheme/img/loginPage.jpg"));

    // Show the image in the application
    Image image = new Image("", resource);
    image.setSizeFull();
    iPanel.setContent(image);

}

From source file:com.logicbomb.newschool.MyAppWidgetSet.LoginWidget.java

public LoginWidget() {
    setMargin(true);//w ww  .j  a v a  2s .c om
    setSpacing(true);

    Panel iPanel = new Panel();
    iPanel.addStyleName("backColorWhite");
    iPanel.setSizeUndefined();

    addComponent(iPanel);

    TextField iTextField = new TextField("Username");
    iTextField.setWidth("300px");
    iTextField.setRequired(true);
    iTextField.setInputPrompt("Your username (eg. joe@email.com)");
    iTextField.setIcon(FontAwesome.USER);
    iTextField.addValidator(new EmailValidator("Username must be an email address"));
    iTextField.setInvalidAllowed(true);
    iTextField.focus();

    PasswordField iPasswordField = new PasswordField("Password");
    iPasswordField.setIcon(FontAwesome.KEY);
    iPasswordField.setWidth("300px");
    iPasswordField.setRequired(true);
    iPasswordField.setValue("");
    iPasswordField.setNullRepresentation("");

    Button iButton = new Button("Login");
    iButton.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            addComponent(new Label("Login Successfully"));
        }
    });

    FormLayout iFormLayout = new FormLayout();
    iFormLayout.setSpacing(true);
    iFormLayout.setMargin(true);
    iFormLayout.addComponent(iTextField);
    iFormLayout.addComponent(iPasswordField);
    iFormLayout.addComponent(iButton);
    iPanel.setContent(iFormLayout);

}

From source file:com.logicbomb.newschool.MyAppWidgetSet.MenuWidget.java

public MenuWidget(String Width) {

    Panel iPanel = new Panel();
    iPanel.setWidth(Width);/*from  w  ww .  ja v  a  2 s . c  o m*/
    iPanel.setStyleName("backColorWhite");

    addComponent(iPanel);

    VerticalLayout iVerticalLayout = new VerticalLayout();
    for (int i = 1; i <= 8; i++) {
        Button iButton = new Button();
        iButton.setWidth(Width);
        iButton.setHeight("50px");
        iVerticalLayout.addComponent(iButton);
    }
    iPanel.setContent(iVerticalLayout);

}

From source file:com.logicbomb.newschool.pages.masterpages.PrimaryMasterPage.java

public PrimaryMasterPage() {

    //ContextWidget c= new ContextWidget();

    HorizontalLayout iHorizontalLayout = new HorizontalLayout();
    //addComponent(iHorizontalLayout,"top:0px;left:0px");
    iHorizontalLayout.setWidth(String.valueOf(Page.getCurrent().getBrowserWindowWidth()));
    iHorizontalLayout.setHeight(String.valueOf(Page.getCurrent().getBrowserWindowHeight()));
    iHorizontalLayout.setStyleName("backColorBlack");

    //String[] captions1 = {"Logo Here", "My Cool School", "Third"};

    //Layout A and its sub components
    Panel AP = new Panel();
    iHorizontalLayout.addComponent(AP);/*  ww w  . j a  va2 s  .  co m*/
    AP.setSizeFull();
    AP.setStyleName("backColorBlack");
    VerticalLayout A1 = new VerticalLayout();
    AP.setContent(A1);
    //A.setSizeFull();
    A1.setSpacing(true);
    iHorizontalLayout.setExpandRatio(AP, 1);

    A1.setStyleName("backColorBlack");
    A1.setMargin(new MarginInfo(true, true, true, true));

    Button logoImage = new Button();
    logoImage.setIcon(FontAwesome.PICTURE_O);
    logoImage.setWidth("80px");
    logoImage.setHeight(logoImage.getWidth(), Unit.PIXELS);
    //logoImage.setWidth("100px");
    A1.addComponent(logoImage);
    A1.setComponentAlignment(logoImage, Alignment.TOP_CENTER);

    Label schoolName = new Label("The School Of Future");
    schoolName.setStyleName("v-label-big");
    A1.addComponent(schoolName);
    //A.setComponentAlignment(schoolName,Alignment.TOP_CENTER);

    Label schoolMinorName = new Label("Random Branch");
    schoolMinorName.setStyleName("v-label-small");
    A1.addComponent(schoolMinorName);

    VerticalLayout A2 = new VerticalLayout();
    A1.addComponent(A2);
    MainMenuWidget iMainMenuWidget = new MainMenuWidget();
    A2.addComponent(iMainMenuWidget);

    //A.setComponentAlignment(schoolName,Alignment.TOP_CENTER);

    //Layout B
    ContextWidgetTop c = new ContextWidgetTop();
    c = ContextWidgetTop.ContextWidgetTransformer(c, new UserDetailsWidget(), SliderMode.TOP,
            SliderPanelStyles.COLOR_RED);
    VerticalLayout B = new VerticalLayout();
    B.setSizeFull();
    //B.setSpacing(true);
    iHorizontalLayout.addComponent(c);
    c.addComponent(B);
    iHorizontalLayout.setExpandRatio(c, 7);

    //Layout B1 and its sub Components
    HorizontalLayout B1 = new HorizontalLayout();
    B.addComponent(B1);
    //B.setExpandRatio(B1, 1);
    //B1.setHeight("70px");
    B1.setSizeFull();
    //B1=ContextWidget.ContextWidgetTransformer(B1, new SliderMasterPage(),SliderMode.RIGHT,SliderPanelStyles.COLOR_RED);

    HorizontalLayout B11 = new HorizontalLayout();
    B1.addComponent(B11);
    B1.setStyleName("backColorBlack");
    B11.setSizeFull();
    B1.setHeight("45px");
    //B1.setStyleName("backColorWhite");
    //B1.setMargin(new MarginInfo(false, true, false, true));

    TextField iTextField = new TextField();
    iTextField.setWidth("200px");
    iTextField.setInputPrompt("Search!");
    iTextField.setStyleName("v-text-type-search");
    iTextField.focus();
    B11.addComponent(iTextField);
    B11.setComponentAlignment(iTextField, Alignment.MIDDLE_LEFT);

    //Layout B2 and its Sub Components
    ContextWidget B2 = new ContextWidget();
    B2.setSizeFull();
    B.addComponent(B2);
    B.setExpandRatio(B2, 10);
    B2 = ContextWidget.ContextWidgetTransformer(B2, new SliderMasterPage(), SliderMode.RIGHT,
            SliderPanelStyles.COLOR_BLUE);
    //B2=ContextWidget.ContextWidgetTransformer(B2, new SliderMasterPage(),SliderMode.TOP,SliderPanelStyles.COLOR_RED);
    VerticalLayout v = new VerticalLayout();
    B2.addComponent(v);

    Button b1111 = new Button(
            "Put all the inner components like this Put all the inner components like this Put all the inner components like this Put all the inner components like this");
    v.addComponent(b1111);
    Button b1112 = new Button("Put all the inner components like this");
    v.addComponent(b1112);

    /*
    Panel p = new Panel();
    VerticalLayout v= new VerticalLayout();
    v.addComponent(new TextField("Name"));
    v.addComponent(new TextField("Street address"));
    v.addComponent(new TextField("Postal code"));
    p.setContent(v);
    B2.addComponent(p);
    v.setWidth(String.valueOf(B2.getWidth()*10)+"px");
    //v.setSizeFull();// <- This will cause issues. Don't do this
    p.setSizeFull();
    */

    //ContextWidget iContextPanel= new ContextWidget(p);
    //B2.addComponent(iContextPanel);
    //setPosition(p, iComponentPositionPanel);

    addComponent(iHorizontalLayout);
}

From source file:com.lst.deploymentautomation.vaadin.core.AppFormConnector.java

License:Open Source License

@Override
public void setContent(Component content) {
    if (content == null) {
        //rendering failed; show a sad face to show how sorry we are
        VerticalLayout layout = new VerticalLayout();
        Label fail = new Label(":-(");
        fail.addStyleName("screen-failed-to-render");
        layout.addComponent(fail);/*from w w  w.  j  a v  a  2  s  .c  o m*/
        layout.setExpandRatio(fail, 1);
        layout.setComponentAlignment(fail, Alignment.MIDDLE_LEFT);
        layout.setSizeFull();

        view.setContent(layout);

    } else {
        //if the component has either natural or absolute size, wrap it
        //in a scrollable panel with full size and nice margin
        if (content.getHeightUnits() != Unit.PERCENTAGE) {
            final Panel panel = new Panel();
            panel.addStyleName("l-border-none");
            panel.setContent(content);
            panel.setSizeFull();
            content = panel;
        }

        view.setContent(content);
    }
}

From source file:com.lst.deploymentautomation.vaadin.page.SettingsView.java

License:Open Source License

private void createView() {
    LspsUI ui = (LspsUI) getUI();/* ww w .ja  v a 2  s  .  co  m*/
    Person 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.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(ui, user);
    layout.addComponent(substitution);

    Label spacer2 = new Label();
    spacer2.setHeight("10px");
    layout.addComponent(spacer2);

    //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);
}