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(String caption) 

Source Link

Document

Creates a new empty panel with caption.

Usage

From source file:com.liferay.mail.vaadin.PreferencesView.java

License:Open Source License

public PreferencesView(final Controller controller) {

    this.controller = controller;

    setSpacing(true);//from   ww w. j a v  a 2  s.c  o  m

    accountPanel = new Panel(Lang.get("your-email-accounts"));
    updateAccountList();
    addComponent(accountPanel);

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    addComponent(buttons);

    Button createAccountButton = new Button(Lang.get("create-account"));
    createAccountButton.addListener(new ClickListener() {
        public void buttonClick(ClickEvent event) {
            editAccount(null);
        }
    });
    buttons.addComponent(createAccountButton);

    Button createGmailButton = new Button("Create GMail account");
    createGmailButton.addListener(new ClickListener() {
        public void buttonClick(ClickEvent event) {
            editGmailAccount(null);

        }
    });
    buttons.addComponent(createGmailButton);

    Link poweredByVaadin = new Link("", new ExternalResource("http://vaadin.com"));
    poweredByVaadin.setIcon(new PortletResource("images/vaadin/powered-by-vaadin.png"));
    poweredByVaadin.setDescription("Mail portlet interface created using Vaadin - RIA's with pure Java.");
    addComponent(poweredByVaadin);
}

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

License:Apache License

@Override
public void buttonClick(ClickEvent event) {
    Button b = event.getButton();
    if (b == btnJobQueueStatus) {
        Window subWindow = new Window("Job Manager");
        subWindow.setWidth("500px");
        subWindow.center();/*w  w w . j a  v a2 s. c  o m*/
        getApplication().getMainWindow().addWindow(subWindow);

        Panel p = new Panel(new JobsStatusViewComponent(getApplication().getURL()));
        p.getContent().setWidth("100%");
        p.setWidth("100%");
        subWindow.addComponent(p);
        subWindow.setModal(true);
    } else if (b == help) {
        String HelpURL = getApplication().getURL().toExternalForm() + "doc";
        getApplication().getMainWindow().open(new ExternalResource(HelpURL), "_blank");
    } else if (b == restart) {
        ((ExpressZipWindow) getApplication().getMainWindow()).getApplication().close();
    }
}

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

License:Apache License

public SetupMapViewComponent() {

    listeners = new ArrayList<SetupMapViewListener>();
    cmbProjection = new ComboBox();
    cmbProjection.setTextInputAllowed(false);
    HorizontalLayout projectionLayout = new HorizontalLayout();
    projectionLayout.addComponent(cmbProjection);
    projectionLayout.setWidth(100f, UNITS_PERCENTAGE);

    setSizeFull();/*from   w w  w. j a v a  2  s. c o  m*/

    // main layout
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.setSizeFull();

    // instruction banner
    Label step = new Label("Step 2: Select Export Region");
    step.addStyleName("step");
    layout.addComponent(step);

    //
    // setup tree data source
    //
    treeHier = new HierarchicalContainer();
    treeHier.addContainerProperty(ExpressZipTreeTable.LAYER, ExpressZipLayer.class, null);
    treeHier.addContainerProperty(DRAG_PROPERTY, Embedded.class, null);

    // table holding layers
    treeTable = new ExpressZipTreeTable();
    treeTable.setContainerDataSource(treeHier);

    treeTable.setDragMode(TableDragMode.ROW);
    treeTable.setColumnHeaders(new String[] { ExpressZipTreeTable.LAYER, "" });
    treeTable.setColumnExpandRatio(ExpressZipTreeTable.LAYER, 1);
    treeTable.setColumnWidth(DRAG_PROPERTY, 23);

    // upload shape file
    btnUploadShapeFile.setFieldType(FieldType.BYTE_ARRAY);
    btnUploadShapeFile.setButtonCaption("");
    btnUploadShapeFile.setSizeUndefined();
    btnUploadShapeFile.addStyleName("shapefile");

    // remove shape file
    btnRemoveShapeFile.addListener(this);
    btnRemoveShapeFile.setSizeUndefined();
    btnRemoveShapeFile.setVisible(false);
    btnRemoveShapeFile.setIcon(new ThemeResource("img/RemoveShapefileStandard23px.png"));
    btnRemoveShapeFile.setStyleName(BaseTheme.BUTTON_LINK);
    btnRemoveShapeFile.addStyleName("shapefile");
    HorizontalLayout hznUpload = new HorizontalLayout();

    Panel coordPanel = new Panel("Export Extent");

    layout.addComponent(treeTable);
    layout.addComponent(new Panel(PROJECTION, projectionLayout));
    layout.addComponent(new Panel(SHAPEFILE_UPLOAD, hznUpload));
    layout.addComponent(coordPanel);

    layout.setSpacing(true);

    hznUpload.addComponent(btnUploadShapeFile);
    hznUpload.addComponent(btnRemoveShapeFile);
    hznUpload.addComponent(lblCurrentShapeFile);
    hznUpload.setExpandRatio(lblCurrentShapeFile, 1f);
    hznUpload.setComponentAlignment(lblCurrentShapeFile, Alignment.MIDDLE_LEFT);
    hznUpload.setWidth("100%");

    cmbProjection.setWidth("100%");

    topTextField.setWidth(150, UNITS_PIXELS);
    topTextField.setImmediate(true);
    topTextField.setRequired(true);
    topTextField.addListener(topListener);

    leftTextField.setWidth(150, UNITS_PIXELS);
    leftTextField.setImmediate(true);
    leftTextField.setRequired(true);
    leftTextField.addListener(leftListener);

    bottomTextField.setWidth(150, UNITS_PIXELS);
    bottomTextField.setImmediate(true);
    bottomTextField.setRequired(true);
    bottomTextField.addListener(bottomListener);

    rightTextField.setWidth(150, UNITS_PIXELS);
    rightTextField.setImmediate(true);
    rightTextField.setRequired(true);
    rightTextField.addListener(rightListener);

    VerticalLayout coordLayout = new VerticalLayout();
    coordLayout.setSizeFull();
    coordPanel.setContent(coordLayout);
    coordLayout.addComponent(topTextField);

    HorizontalLayout leftRightLayout = new HorizontalLayout();
    leftRightLayout.setWidth("100%");
    leftRightLayout.addComponent(leftTextField);
    leftRightLayout.addComponent(rightTextField);
    leftRightLayout.setComponentAlignment(leftTextField, Alignment.MIDDLE_LEFT);
    leftRightLayout.setComponentAlignment(rightTextField, Alignment.MIDDLE_RIGHT);
    coordLayout.addComponent(leftRightLayout);

    coordLayout.addComponent(bottomTextField);
    coordLayout.setComponentAlignment(topTextField, Alignment.TOP_CENTER);
    coordLayout.setComponentAlignment(bottomTextField, Alignment.BOTTOM_CENTER);

    btnNext = new ExpressZipButton("Next", Style.STEP, this);
    btnBack = new ExpressZipButton("Back", Style.STEP, this);

    HorizontalLayout backNextLayout = new HorizontalLayout();
    backNextLayout.addComponent(btnBack);
    backNextLayout.addComponent(btnNext);
    btnNext.setEnabled(false);

    backNextLayout.setComponentAlignment(btnBack, Alignment.BOTTOM_LEFT);
    backNextLayout.setComponentAlignment(btnNext, Alignment.BOTTOM_RIGHT);
    backNextLayout.setWidth("100%");

    VerticalLayout navLayout = new VerticalLayout();
    navLayout.addComponent(backNextLayout);
    navLayout.setSpacing(true);

    ThemeResource banner = new ThemeResource("img/ProgressBar2.png");
    navLayout.addComponent(new Embedded(null, banner));

    layout.addComponent(navLayout);
    layout.setComponentAlignment(navLayout, Alignment.BOTTOM_CENTER);

    layout.setExpandRatio(treeTable, 1.0f);
    setCompositionRoot(layout);

    // notify when selection changes
    treeTable.addListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            for (SetupMapViewListener listener : listeners) {
                listener.layersSelectedEvent((Set<ExpressZipLayer>) treeTable.getValue());
            }

        }
    });
    treeTable.addActionHandler(this);
    treeHier.removeAllItems();

    //
    // drag n' drop behavior
    //
    treeTable.setDropHandler(new DropHandler() {
        public AcceptCriterion getAcceptCriterion() {
            return AcceptAll.get();
        }

        // Make sure the drag source is the same tree
        public void drop(DragAndDropEvent event) {
            // Wrapper for the object that is dragged
            Transferable t = event.getTransferable();

            // Make sure the drag source is the same tree
            if (t.getSourceComponent() != treeTable)
                return;

            AbstractSelectTargetDetails target = (AbstractSelectTargetDetails) event.getTargetDetails();

            // Get ids of the dragged item and the target item
            Object sourceItemId = t.getData("itemId");
            Object targetItemId = target.getItemIdOver();

            // if we drop on ourselves, ignore
            if (sourceItemId == targetItemId)
                return;

            // On which side of the target the item was dropped
            VerticalDropLocation location = target.getDropLocation();

            // place source after target
            treeHier.moveAfterSibling(sourceItemId, targetItemId);

            // if top, switch them
            if (location == VerticalDropLocation.TOP) {
                treeHier.moveAfterSibling(targetItemId, sourceItemId);
            }

            Collection<ExpressZipLayer> layers = (Collection<ExpressZipLayer>) treeHier.rootItemIds();
            for (SetupMapViewListener listener : listeners)
                listener.layerMovedEvent(layers);
        }
    });

    cmbProjection.setImmediate(true);
    cmbProjection.setNullSelectionAllowed(false);
    cmbProjection.addListener(new Property.ValueChangeListener() {
        private static final long serialVersionUID = -5188369735622627751L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            if (cmbProjection.getValue() != null) {
                selectedEpsg = (String) cmbProjection.getValue();
                String currentProjection = ((ExpressZipWindow) getApplication().getMainWindow())
                        .getExportProps().getMapProjection();
                if (!selectedEpsg.equals(currentProjection))
                    for (SetupMapViewListener listener : new ArrayList<SetupMapViewListener>(listeners))
                        listener.projectionChangedEvent(selectedEpsg);
            }
        }
    });
}

From source file:com.logviewer.ui.dialog.LastMinute.java

License:Open Source License

private void addTab(final TabSheet panelContent, final String content, final String name) {
    panelContent.addTab(new Panel(new TailView(content) {
        {//from  ww  w . j  a v  a2s . c o m
            setStyleName("logcontent");
        }
    }) {
        {
            setSizeFull();
        }
    }, name);
}

From source file:com.m1kah.ui.TodoComponent.java

License:Open Source License

private void initInputRow() {
    toggleAllButton = new CheckBox();
    toggleAllButton.setId("toggle-all");

    inputField = new TextField();
    inputField.setInputPrompt("What needs to be done?");

    Panel panel = new Panel(inputField);
    panel.addShortcutListener(new ShortcutListener("", ShortcutAction.KeyCode.ENTER, null) {
        @Override//from  w  w  w  .ja  va2s .com
        public void handleAction(Object o, Object o1) {
            addNewTodo();
        }
    });

    HorizontalLayout inputFieldLayout = new HorizontalLayout(toggleAllButton, panel);
    inputFieldLayout.setComponentAlignment(toggleAllButton, Alignment.MIDDLE_LEFT);
    inputFieldLayout.setId("new-todo");
    addComponent(inputFieldLayout);
}

From source file:com.m4gik.views.component.LicenseScreen.java

/**
 * Method builds license layout with texts.
 * //from   w  ww . j av  a2  s.  c  om
 * @return The VerticalLayout with texts.
 * 
 * @see com.m4gik.views.component.ViewScreen#build()
 */
@Override
public Layout build() {
    VerticalLayout layout = new VerticalLayout();
    layout.setSizeFull();
    layout.setCaption("Welcome");

    Panel welcome = new Panel("License");
    welcome.setSizeFull();
    welcome.addStyleName(Runo.PANEL_LIGHT);
    layout.addComponent(welcome);
    layout.setExpandRatio(welcome, 1);

    CssLayout margin = new CssLayout();
    // margin.setMargin(true);
    margin.setWidth("100%");
    welcome.setContent(margin);

    Label title = new Label("Music player");
    title.addStyleName(Runo.LABEL_H1);
    // margin.addComponent(title);

    HorizontalLayout texts = new HorizontalLayout();
    texts.setSpacing(true);
    texts.setWidth("100%");
    margin.addComponent(texts);

    addText(texts,
            "<h3>Everything You Need Is Here</h3>" + "<p>Everything you see inside this application...</p>",
            null);
    addText(texts,
            "<h3>Everything You Need Is Here</h3>" + "<p>Everything you see inside this application...</p>",
            null);
    addText(texts,
            "<h3>Everything You Need Is Here</h3>" + "<p>Everything you see inside this application...</p>",
            null);

    layout.addComponent(new Label("<hr />", Label.CONTENT_XHTML));

    return layout;
}

From source file:com.m4gik.views.MainView.java

/**
 * @param split/*from   w  w w  .j a v a2  s.c  om*/
 */
private void addPanelLeft(HorizontalSplitPanel split) {
    Panel left = new Panel("Music explorer");
    left.setSizeFull();
    split.setFirstComponent(left);

    addAccordion(left);
}

From source file:com.mycompany.project.components.ContactDetails.java

public ContactDetails() {
    //        setCaption("Contact Details");

    VerticalLayout mainVLayout = new VerticalLayout();
    mainVLayout.setMargin(true);// w  w  w  .  j  a  v a  2s  . co  m
    mainVLayout.setSpacing(true);

    setContent(mainVLayout);

    tfName.setSizeFull();
    tfAddress.setSizeFull();
    tfPhone.setSizeFull();
    tfEmail.setSizeFull();

    Panel panel = new Panel("Grupos");
    panel.setWidth("100%");
    panel.setHeight("50px");
    panel.setContent(groupsHLayout);

    mainVLayout.addComponent(tfName);
    mainVLayout.addComponent(tfAddress);
    mainVLayout.addComponent(tfPhone);
    mainVLayout.addComponent(tfEmail);
    mainVLayout.addComponent(groupsHLayout);

    Button btnUpdate = new Button("Actualizar");
    mainVLayout.addComponent(btnUpdate);

    btnUpdate.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            //invoke business logic
            BusinessLogic bl = ((MyVaadinUI) getUI()).getBusinessLogic();

            String name = tfName.getValue();
            String address = tfAddress.getValue();
            String phone = tfPhone.getValue();
            String email = tfEmail.getValue();

            ArrayList<String> selectedGroupIds = new ArrayList<String>();
            Set<String> groupIdSet = groupsMap.keySet();
            for (String groupId : groupIdSet) {
                CheckBox cb = groupsMap.get(groupId);
                if (cb.getValue()) {
                    selectedGroupIds.add(groupId);
                }
            }

            boolean success = bl.updateContact(selectedContactId, name, address, phone, email,
                    selectedGroupIds);
            if (success) {
                load(selectedContactId);
                Notification.show("Informacion", "Contacto Actualizado", Notification.Type.TRAY_NOTIFICATION);
            } else {
                Notification.show("Error", "\nSomething bad happened", Notification.Type.ERROR_MESSAGE);
            }
        }
    });

    ContactDetails.this.setVisible(false);
}

From source file:com.naoset.framework.frontend.view.window.Window.java

public Window(Component component) {
    mySelf = this;
    this.body = component;

    //addStyleName("moviedetailswindow");
    Responsive.makeResponsive(this);

    setCaption(body.getCaption());//  w w  w. j a  v a2 s. co  m
    center();
    setCloseShortcut(ShortcutAction.KeyCode.ESCAPE, null);
    setResizable(false);
    setClosable(false);
    setHeight(90.0f, Unit.PERCENTAGE);

    VerticalLayout layout = new VerticalLayout();
    layout.setSizeFull();
    setContent(layout);

    Panel bodyWrapper = new Panel(body);
    bodyWrapper.setSizeFull();
    bodyWrapper.addStyleName(ValoTheme.PANEL_BORDERLESS);
    bodyWrapper.addStyleName("scroll-divider");
    layout.addComponent(bodyWrapper);
    layout.setExpandRatio(bodyWrapper, 1f);

    footer = buildFooter();
    layout.addComponent(footer);
}

From source file:com.openhris.commons.UploadImage.java

public UploadImage(Panel imagePanel, Embedded avatar, String employeeId) {
    this.imagePanel = imagePanel;
    this.avatar = avatar;
    this.employeeId = employeeId;

    imagePanel = new Panel("Upload Component");
    imagePanel.setWidth("400px");
    addComponent(imagePanel);/*from  ww w. jav  a  2  s  .co m*/

    // Create the Upload component.
    upload = new Upload("Upload the Image file here", receiver);
    // Use a custom button caption instead of plain "Upload".
    upload.setButtonCaption("Upload Now");

    // Listen for events regarding the success of upload. 
    upload.addListener((Upload.StartedListener) this);
    upload.addListener((Upload.SucceededListener) this);
    upload.addListener((Upload.FailedListener) this);

    panel.setWidth("100%");
    panel.addComponent(new Label("Click 'Choose file' to " + "select a file and then click 'Upload Now'. "
            + "image should have the same width and height so "
            + "that image will not look deformed when viewed."));

    imagePanel.addComponent(upload);
    imagePanel.addComponent(panel);

    avatar = new Embedded();
    avatar.setImmediate(true);
    avatar.setWidth(90, Sizeable.UNITS_PIXELS);
    avatar.setHeight(90, Sizeable.UNITS_PIXELS);
    imagePanel.addComponent(avatar);
}