Example usage for com.vaadin.ui Panel setContent

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

Introduction

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

Prototype

@Override
public void setContent(Component content) 

Source Link

Document

Sets the content of this container.

Usage

From source file:com.klwork.explorer.ui.content.email.EmailDetailPanel.java

License:Apache License

protected void addHtmlContent(String html) {
    Panel panel = new Panel();
    panel.setWidth(800, UNITS_PIXELS);/*from  w w  w  .  j  a va  2  s.  co m*/
    panel.setHeight(300, UNITS_PIXELS);

    content = new Label(html, Label.CONTENT_XHTML);
    content.setHeight(100, UNITS_PERCENTAGE);

    panel.setContent(content);
    mainLayout.addComponent(panel);
}

From source file:com.klwork.explorer.ui.custom.UploadComponent.java

License:Apache License

protected void addDropPanel() {
    Panel dropPanel = new Panel();
    dropPanel.setContent(new VerticalLayout());
    DragAndDropWrapper dragAndDropWrapper = new DragAndDropWrapper(dropPanel);
    //WW_TODO ?//  w w  w. ja  v a2 s  .  c  om
    dragAndDropWrapper.setDropHandler(this);
    dragAndDropWrapper.setWidth("80%");
    addComponent(dragAndDropWrapper);
    setComponentAlignment(dragAndDropWrapper, Alignment.MIDDLE_CENTER);
    //
    Label dropLabel = new Label(i18nManager.getMessage(Messages.UPLOAD_DROP));
    dropLabel.setSizeUndefined();
    ((VerticalLayout) dropPanel.getContent()).addComponent(dropLabel);
    ((VerticalLayout) dropPanel.getContent()).setComponentAlignment(dropLabel, Alignment.MIDDLE_CENTER);
}

From source file:com.klwork.explorer.ui.task.ProcessInstanceEventsPanel.java

License:Apache License

public void initAddEventInput(HorizontalLayout hLayout) {
    Panel textFieldPanel = new Panel(); // Hack: actionHandlers can only be
    // attached to panels or windows
    textFieldPanel.addStyleName(Reindeer.PANEL_LIGHT);
    VerticalLayout textFieldPanelLayout = new VerticalLayout();
    textFieldPanel.setContent(textFieldPanelLayout);

    textFieldPanel.setWidth(100, Unit.PERCENTAGE);
    hLayout.addComponent(textFieldPanel);
    hLayout.setExpandRatio(textFieldPanel, 1.0f);

    commentInputField = new TextField();
    commentInputField.setWidth(100, Unit.PERCENTAGE);
    textFieldPanelLayout.addComponent(commentInputField);

    // Hack to catch keyboard 'enter'
    textFieldPanel.addActionHandler(new Handler() {
        public void handleAction(Action action, Object sender, Object target) {
            addNewComment(commentInputField.getValue().toString());
        }/*w ww.j  av  a2 s  .co m*/

        public Action[] getActions(Object target, Object sender) {
            return new Action[] { new ShortcutAction("enter", ShortcutAction.KeyCode.ENTER, null) };
        }
    });
}

From source file:com.klwork.explorer.ui.task.TaskEventsPanel.java

License:Apache License

public void initAddEventInput(HorizontalLayout hLayout) {
    Panel textFieldPanel = new Panel(); // Hack: actionHandlers can only be attached to panels or windows
    textFieldPanel.addStyleName(Reindeer.PANEL_LIGHT);
    VerticalLayout textFieldPanelLayout = new VerticalLayout();
    textFieldPanel.setContent(textFieldPanelLayout);

    textFieldPanel.setWidth(100, Unit.PERCENTAGE);
    hLayout.addComponent(textFieldPanel);
    hLayout.setExpandRatio(textFieldPanel, 1.0f);

    commentInputField = new TextField();
    commentInputField.setWidth(100, Unit.PERCENTAGE);
    textFieldPanelLayout.addComponent(commentInputField);

    // Hack to catch keyboard 'enter'
    textFieldPanel.addActionHandler(new Handler() {
        public void handleAction(Action action, Object sender, Object target) {
            addNewComment(commentInputField.getValue().toString());
        }//from w w  w .ja  va 2s.  c  om

        public Action[] getActions(Object target, Object sender) {
            return new Action[] { new ShortcutAction("enter", ShortcutAction.KeyCode.ENTER, null) };
        }
    });
}

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();// w  w w.j  a v  a2 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.lexaden.platform.web.GridApplication.java

License:Apache License

/**
 * Initializes the application.//from w  ww .  j  a  v  a 2s  . c  o m
 */
@Override
public void init(VaadinRequest request) {
    final Panel panel = new Panel("Grid Demo");
    panel.setWidth(850, Sizeable.Unit.PIXELS);
    panel.setContent(personViewService.buildPersonsGrid());

    setContent(panel);

    getPage().setTitle("Grid Demo");
}

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  av a2 s.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  w  w . j a v  a 2 s  .c o  m

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

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 ww w  . j a v  a2 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.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);/*  ww  w .ja v a2s. c om*/
    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);

}