Example usage for com.vaadin.ui Window getParent

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

Introduction

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

Prototype

@Override
    public HasComponents getParent() 

Source Link

Usage

From source file:org.escidoc.browser.ui.view.helpers.TableContainerVH.java

License:Open Source License

public void confirmActionWindow(final Object target) {
    final Window subwindow = new Window(ViewConstants.DELETE_RESOURCE_WINDOW_NAME);
    subwindow.setModal(true);/*from  w ww .  ja  v a2  s  .c  o  m*/
    subwindow.setWidth("500px");

    VerticalLayout layout = (VerticalLayout) subwindow.getContent();
    layout.setMargin(true);
    layout.setSpacing(true);
    Label message = new Label(ViewConstants.QUESTION_DELETE_RESOURCE);
    subwindow.addComponent(message);
    Button okBtn = new Button("Yes Remove", new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            removeAction(target);
            table.refreshRowCache();
            (subwindow.getParent()).removeWindow(subwindow);
        }
    });
    Button cancelBtn = new Button("Cancel", new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            (subwindow.getParent()).removeWindow(subwindow);

        }
    });
    HorizontalLayout hl = new HorizontalLayout();
    hl.addComponent(okBtn);
    hl.addComponent(cancelBtn);
    layout.addComponent(hl);

    this.getApplication().getMainWindow().addWindow(subwindow);
}

From source file:org.generationcp.breeding.manager.crossingmanager.listeners.CloseWindowAction.java

License:Open Source License

@Override
public void buttonClick(ClickEvent event) {
    Window window = event.getButton().getWindow();
    window.getParent().removeWindow(window);
}

From source file:org.lightframe.components.WindowManager.java

License:Apache License

/**
 * Close a {@link Window} that is managed by this {@link WindowManager}.
 * /*  w ww.j  a  va 2 s. c  o  m*/
 * @param window
 *            The {@link Window} to be closed.
 * @return <code>true</code> if the window was successfully closed.
 *         <code>false</code> if <code>window</code> is null, it's not
 *         attached to an {@link Application}, it's not managed by this
 *         {@link WindowManager} or this WindowManager isn't attached to an
 *         Application.
 */
public boolean closeWindow(Window window) {
    if (getApplication() != null && window != null && managedWindows.contains(window)
            && window.getParent() != null) {

        try {
            // window.close() is protected, not public
            WINDOW_CLOSE_METHOD.invoke(window);
        } catch (IllegalArgumentException e) {
            throw new RuntimeException(e);
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        } catch (InvocationTargetException e) {
            throw new RuntimeException(e);
        }

        return true;
    } else {
        return false;
    }
}

From source file:org.vaadin.dontpush.server.SocketCommunicationManager.java

License:Apache License

@Override
public void repaintRequested(RepaintRequestEvent event) {
    super.repaintRequested(event);
    Component paintable = (Component) event.getPaintable();
    Window window = paintable.getWindow();

    // Handle case where components that are referenced by some
    // other object and have been removed from application receive data.
    // Example: Component 'A' has a Container 'C' that listens to events
    // from some global object 'O' (e.g. singleton Spring bean).  'A' is
    // removed from application but 'C' is still a listener to events from
    // 'O' and 'C' is still the container of 'A' and any repaints of 'C'
    // will fail as it is no longer has a Window as its top-most parent
    ///*from www. ja v a 2s . c  o m*/
    // See http://dev.vaadin.com/ticket/8262
    if (window == null)
        return;

    if (window.getParent() != null) {
        window = window.getParent();
    }
    if (this.activeUidlRequestWindow != window) {
        synchronized (this.dirtyWindows) {
            this.dirtyWindows.add(window);
        }
        deferPaintPhase();
    }
}

From source file:ru.codeinside.gses.manager.processdefeniton.ProcessDefenitionQuery.java

License:Mozilla Public License

private static void closeWindow(final Window thisWindow, final Window window) {
    thisWindow.removeWindow(window);/*from  w  w  w  .ja  v a  2  s.  c  o  m*/
    if (thisWindow.getParent() != null) {
        thisWindow.getParent().removeWindow(window);
    }
}