Example usage for com.vaadin.ui Window Window

List of usage examples for com.vaadin.ui Window Window

Introduction

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

Prototype

public Window(String caption) 

Source Link

Document

Creates a new, empty window with a given title.

Usage

From source file:com.khoinguyen.samples.vaadin.HelloVaadin.java

License:Open Source License

@Override
public void init() {
    Window mainWindow = new Window("Test Application");
    Label label = new Label("Hello world");
    mainWindow.addComponent(label);//from  w  w  w .j  av a 2s .co  m
    setMainWindow(mainWindow);
}

From source file:com.kreative.webportal.MyVaadinApplication.java

License:Apache License

@Override
public void init() {
    window = new Window("My Vaadin Application");
    setMainWindow(window);//w ww.  ja v a2 s . com
    Button button = new Button("Click Me");
    button.addListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            window.addComponent(new Label("Thank you for clicking"));
        }
    });
    window.addComponent(button);
    //

}

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

License:Open Source License

private void editAccount(Account account) {

    String windowTitle = Lang.get(account == null ? "add-mail-account" : "edit-account");
    final Window editorWindow = new Window(windowTitle);
    editorWindow.setSizeUndefined();//from w  w w  . jav a  2  s  .c  o  m
    editorWindow.center();
    editorWindow.setModal(true);
    editorWindow.setResizable(false);

    AccountEditor.AccountEditorListener listener = new SaveAccountListener(editorWindow);

    // show a pre-filled edit dialog
    AccountEditor editor = new AccountEditor(account, controller, listener);
    editorWindow.setContent(editor);
    controller.getApplication().getMainWindow().addWindow(editorWindow);
}

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

License:Open Source License

private void editGmailAccount(Account account) {
    String windowTitle = Lang.get(account == null ? "add-gmail-account" : "edit-gmail-account");
    final Window editorWindow = new Window(windowTitle);
    editorWindow.setSizeUndefined();/* w  ww.ja v  a2  s .  c  o m*/
    editorWindow.center();
    editorWindow.setModal(true);
    editorWindow.setResizable(false);

    AccountEditor.AccountEditorListener listener = new SaveAccountListener(editorWindow);

    // show a pre-filled edit dialog
    AccountEditor editor = new GMailAccountEditor(account, controller, listener);
    editorWindow.setContent(editor);
    controller.getApplication().getMainWindow().addWindow(editorWindow);
}

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

License:Apache License

@Override
public void shapeFileUploadedEvent(final String filename, final ByteArrayInputStream input) {
    final Window modal = new Window("Wait");
    final Window mainWindow = (ExpressZipWindow) setupMapView.getApplication().getMainWindow();
    final SetupMapPresenter presenter = this;

    Thread spinner = new Thread(new Runnable() {
        public void run() {
            ProgressIndicator pi = new ProgressIndicator();
            pi.setCaption("Processing Shapefile...");
            modal.setModal(true);// ww  w.j a  va 2 s .c  o m
            modal.setClosable(false);
            modal.setResizable(false);
            modal.getContent().setSizeUndefined(); // trick to size around content
            modal.getContent().addComponent(pi);
            modal.setWidth(modal.getWidth(), modal.getWidthUnits());
            mainWindow.addWindow(modal);
            VectorLayer uploadedShapeFile = setupMapModel.shapeFileUploaded(filename, input);
            if (uploadedShapeFile != null) {
                shapeFileLayer = uploadedShapeFile;
                mapModel.addVectorLayer(shapeFileLayer);
                setupMapView.updateShapeLayer(shapeFileLayer);
                mapModel.updateOpenLayersMap();

                Bounds shpFileBounds = shapeFileLayer.getBoundsForLayer(mapModel.getCurrentProjection());
                resetExtentLayer(shpFileBounds, presenter);
                map.addLayer(boundingBoxLayer);
            }
            mainWindow.removeWindow(modal);
        }
    });
    spinner.start();
}

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

License:Apache License

public FindLayersViewComponent() {

    treeTable = new ExpressZipTreeTable();
    popupTable = new ExpressZipTreeTable();
    configureTable(treeTable);/*from w w w  .j a  va 2 s .com*/

    popupSelectionListener = new Property.ValueChangeListener() {
        private static final long serialVersionUID = 625365970493526725L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            // the current popup selection
            Set<ExpressZipLayer> popupSelection = (Set<ExpressZipLayer>) event.getProperty().getValue();

            // get the tree's current selection
            HashSet<ExpressZipLayer> treeSelection = new HashSet<ExpressZipLayer>(
                    (Set<ExpressZipLayer>) treeTable.getValue());

            // remove all items in common with popup
            treeSelection.removeAll(popupTable.getItemIds());

            // set the treeTable selection to the union
            Set<ExpressZipLayer> unionSelection = new HashSet<ExpressZipLayer>();
            unionSelection.addAll(popupSelection);
            unionSelection.addAll(treeSelection);
            treeTable.setValue(unionSelection);
        }
    };
    popupTable.addListener(popupSelectionListener);

    treeTable.addListener(new Property.ValueChangeListener() {
        private static final long serialVersionUID = 6236114836521221107L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            Set<ExpressZipLayer> highlightedLayers = (Set<ExpressZipLayer>) event.getProperty().getValue();
            for (FindLayersViewListener listener : listeners) {
                listener.layerHighlightedEvent(highlightedLayers);
            }

            // reset selection of popup table
            popupTable.removeListener(popupSelectionListener);

            // intersection of treeTable's selection and popupTable items
            Set<ExpressZipLayer> popupSelection = new HashSet<ExpressZipLayer>();
            popupSelection.addAll(highlightedLayers);
            popupSelection.retainAll(popupTable.getItemIds());
            popupTable.setValue(popupSelection);

            popupTable.addListener(popupSelectionListener);
        }
    });
    configureTable(popupTable);

    filter = new Filter(this);
    filterButtonListener = new FilterListeners();
    axisSelectedListener = new AxisSelected();
    listeners = new ArrayList<FindLayersViewListener>();
    btnNext = new ExpressZipButton("Next", Style.STEP);
    btnBack = new ExpressZipButton("Back", Style.STEP);

    btnAddFilter = new ExpressZipButton("Add Filter", Style.ACTION);
    btnAddFilter.addStyleName("filter-flow");

    hshFilterButtons = new HashMap<Button, FilterObject>();
    cssLayers = new CssLayout();

    basemapSelector = new ComboBox();
    basemapSelector.setWidth(100.0f, UNITS_PERCENTAGE);
    basemapSelector.setTextInputAllowed(false);
    basemapSelector.setImmediate(true);
    basemapSelector.setNullSelectionAllowed(false);
    basemapSelector.addListener(new Property.ValueChangeListener() {
        private static final long serialVersionUID = -7358667131762099215L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            ProjectedLayer l = (ProjectedLayer) basemapSelector.getValue();
            boolean enableCheckbox = false;
            if (l instanceof WebMapServiceLayer) {
                for (ExpressZipLayer local : mapModel.getLocalBaseLayers()) {
                    if (l.toString().equals(local.getName())) {
                        enableCheckbox = true;
                        break;
                    }
                }
            }
            includeBasemap.setEnabled(enableCheckbox);
            if (!enableCheckbox) {
                includeBasemap.setValue(false);
            }

            if (mapModel.getBaseLayerTerms(l) != null && !mapModel.getBaseLayerTermsAccepted(l)) {
                final Window modal = new Window("Terms of Use");
                modal.setModal(true);
                modal.setClosable(false);
                modal.setResizable(false);
                modal.getContent().setSizeUndefined(); // trick to size around content
                Button bOK = new ExpressZipButton("OK", Style.ACTION, new ClickListener() {
                    private static final long serialVersionUID = -2872178665349848542L;

                    @Override
                    public void buttonClick(ClickEvent event) {
                        ProjectedLayer l = (ProjectedLayer) basemapSelector.getValue();
                        mapModel.setBaseLayerTermsAccepted(l);
                        for (FindLayersViewListener listener : listeners)
                            listener.baseMapChanged(l);
                        ((ExpressZipWindow) getApplication().getMainWindow()).removeWindow(modal);
                    }
                });
                Button bCancel = new ExpressZipButton("Cancel", Style.ACTION, new ClickListener() {
                    private static final long serialVersionUID = -3044064554876422836L;

                    @Override
                    public void buttonClick(ClickEvent event) {
                        basemapSelector.select(mapModel.getBaseLayers().get(0));
                        ((ExpressZipWindow) getApplication().getMainWindow()).removeWindow(modal);
                    }
                });
                HorizontalLayout buttons = new HorizontalLayout();
                buttons.setSpacing(true);
                buttons.addComponent(bOK);
                buttons.addComponent(bCancel);
                Label termsText = new Label(mapModel.getBaseLayerTerms(l));
                termsText.setContentMode(Label.CONTENT_XHTML);
                VerticalLayout vlay = new VerticalLayout();
                vlay.addComponent(termsText);
                vlay.addComponent(buttons);
                vlay.setComponentAlignment(buttons, Alignment.MIDDLE_RIGHT);
                vlay.setWidth(400, UNITS_PIXELS);
                modal.getContent().addComponent(vlay);
                ((ExpressZipWindow) getApplication().getMainWindow()).addWindow(modal);
            } else {
                for (FindLayersViewListener listener : listeners)
                    listener.baseMapChanged(l);
            }
        }
    });

    includeBasemap = new CheckBox();
    includeBasemap.setDescription("Include this basemap in the exported image.");
    includeBasemap.setWidth(64f, UNITS_PIXELS);

    HorizontalLayout basemapLayout = new HorizontalLayout();
    basemapLayout.setWidth(100f, UNITS_PERCENTAGE);

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

    Label step = new Label("Step 1: Select Layers");
    step.addStyleName("step");
    layout.addComponent(step);

    layout.addComponent(treeTable);
    layout.setSpacing(true);
    treeTable.setSizeFull();
    layout.setExpandRatio(treeTable, 1f);

    layout.addComponent(new Panel(BASEMAP, basemapLayout));
    basemapLayout.addComponent(basemapSelector);
    basemapLayout.setExpandRatio(basemapSelector, 1f);
    basemapLayout.addComponent(includeBasemap);

    layout.addComponent(cssLayers);
    cssLayers.addComponent(btnAddFilter);

    HorizontalLayout backSubmitLayout = new HorizontalLayout();
    backSubmitLayout.setWidth("100%");
    backSubmitLayout.addComponent(btnBack);
    backSubmitLayout.addComponent(btnNext);
    backSubmitLayout.setComponentAlignment(btnBack, Alignment.BOTTOM_LEFT);
    backSubmitLayout.setComponentAlignment(btnNext, Alignment.BOTTOM_RIGHT);

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

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

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

    btnNext.addListener(this);
    btnNext.setEnabled(false);
    btnBack.setEnabled(false); // always disabled
    btnAddFilter.addListener(this);

    layout.addStyleName("findlayers");
    setCompositionRoot(layout);
}

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

License:Apache License

@Override
public void buttonClick(ClickEvent event) {
    if (event.getButton() == btnNext) {
        // For 'Next' being pressed
        String localBaseLayerName = null;
        if (includeBasemap.booleanValue()) {
            ProjectedLayer basemap = (ProjectedLayer) basemapSelector.getValue();
            if (basemap instanceof WebMapServiceLayer) {
                localBaseLayerName = ((WebMapServiceLayer) basemap).getDisplayName();
            }//  w  w  w  .  ja va  2  s . com
        }
        for (FindLayersViewListener l : listeners) {
            l.setIncludedLocalBaseMap(localBaseLayerName);
        }
        ((ExpressZipWindow) getApplication().getMainWindow()).advanceToNext();
    } else if (event.getButton() == btnAddFilter) {
        // For 'Add Filter'

        // This window is already created and setup, add it and return
        ExpressZipWindow parent = (ExpressZipWindow) getApplication().getMainWindow();
        if (wndAddFilter != null) {
            parent.addWindow(wndAddFilter);
            return;
        }
        wndAddFilter = new Window("Add Filter");
        wndAddFilter.setModal(true);
        int height = 250;
        int width = 400;

        wndAddFilter.setWidth(width + "px");
        wndAddFilter.setHeight(height + "px");
        // Center the window based on browser width/height
        wndAddFilter.setPositionX((parent.getBrowserWindowWidth() - width) / 2);
        wndAddFilter.setPositionY((parent.getBrowserWindowHeight() - height) / 2);

        setupAddFilterWindow(wndAddFilter);

        parent.addWindow(wndAddFilter);
    }
}

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  ww  .ja  v  a2s  . 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.mil.MyVaadinApplication.java

License:Apache License

@Override
public void init() {
    window = new Window("My Vaadin Application");
    setMainWindow(window);/*from  ww w .j  av a2 s .  c  o  m*/
    Button button = new Button("Click M e");
    button.addListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            window.addComponent(new Label("Thank you for clicking"));
        }
    });
    window.addComponent(button);

}

From source file:com.naoset.framework.frontend.component.profile.CustomerEditWindowView.java

private void openWindow() {
    Window myWindow = new Window("Cliente");
    myWindow.addStyleName("profile-window");
    myWindow.setId(ID);/* w ww. j a  va 2 s .c  o  m*/
    Responsive.makeResponsive(this);

    myWindow.setModal(true);
    myWindow.setCloseShortcut(ShortcutAction.KeyCode.ESCAPE, null);
    myWindow.setResizable(false);
    myWindow.setClosable(false);
    myWindow.setHeight(90.0f, Unit.PERCENTAGE);
    VerticalLayout layout = new VerticalLayout();
    CustomerPanelView customerPanelView = new CustomerPanelView();

    layout.addComponent(customerPanelView.buildCustomerPanel(null));
    layout.addComponent(builtButton());

    myWindow.setContent(layout);
    myWindow.setVisible(true);
    UI.getCurrent().addWindow(myWindow);
    myWindow.focus();
}