Example usage for com.vaadin.ui Window focus

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

Introduction

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

Prototype

@Override
public void focus() 

Source Link

Document

Cause the window to be brought on top of other windows and gain keyboard focus.

Usage

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 w w  . j  a  v a 2 s .c  om*/
    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();
}

From source file:com.peergreen.webconsole.scope.home.extensions.PeergreenNewsFeedFrame.java

License:Open Source License

@PostConstruct
public void init() throws MalformedURLException, RssServiceException {
    Rss rss = null;/*w  w w . java  2  s.com*/
    rss = rssService.parse(new URL(PEERGREEN_RSS_FLOW_URL));
    int i = 0;
    for (final FeedMessage feedMessage : rss.getItems()) {
        Button news = new NativeButton(feedMessage.getTitle());
        news.addStyleName("link");
        news.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent event) {
                Window w = getNewsDescription(feedMessage);
                UI.getCurrent().addWindow(w);
                w.focus();
            }
        });

        addItem(new Object[] { news }, i++);
    }
}

From source file:org.apache.ace.webui.vaadin.component.ConfirmationDialog.java

License:Apache License

/**
 * @see com.vaadin.ui.Button.ClickListener#buttonClick(com.vaadin.ui.Button.ClickEvent)
 *//*from   w  w  w. j av a 2  s . co m*/
public void buttonClick(ClickEvent event) {
    Window parent = getParent();
    if (parent != null) {
        parent.removeWindow(this);
        parent.focus();
    }

    AbstractComponent comp = (AbstractComponent) event.getComponent();
    m_callback.onDialogResult((String) comp.getData());
}

From source file:pl.exsio.frameset.vaadin.ui.support.component.data.common.DataComponent.java

License:Open Source License

private void openForm(final I item, String title, final C container, final int mode) {
    Window formWindow = this.createFormWindow(title);
    final Layout form = this.buildForm(item, container, formWindow, mode);
    VerticalLayout windowLayout = new VerticalLayout() {
        {// w w w. java2s  .c  om
            addComponent(form);
            setMargin(true);
            setStyleName("frameset-dc-window-layout");
        }
    };
    formWindow.setContent(windowLayout);
    getUI().addWindow(formWindow);
    formWindow.focus();
}

From source file:pl.exsio.frameset.vaadin.ui.support.dialog.ConfirmationDialog.java

License:Open Source License

public static void show(final String msg, final Handler positiveHandler, final Handler negativeHandler) {
    final Window window = new Window(t("confirmation.title"));
    window.center();// w  w  w  . j  a  va2s.c  om
    window.setWidth("450px");
    window.setModal(true);
    window.setResizable(false);
    window.setDraggable(false);

    VerticalLayout vlayout = new VerticalLayout() {
        {
            addComponent(new Label(msg));
            addComponent(getControls(window, positiveHandler, negativeHandler));
        }
    };
    vlayout.setMargin(true);
    window.setContent(vlayout);
    UI.getCurrent().addWindow(window);
    window.focus();
}

From source file:pl.exsio.frameset.vaadin.ui.support.dialog.PromptDialog.java

License:Open Source License

public static void show(final String msg, final Handler handler) {
    final Window window = new Window(t("prompt.title"));
    window.center();/*  w w w .j  a v a2 s. c o  m*/
    window.setWidth("450px");
    window.setModal(true);
    window.setResizable(false);
    window.setDraggable(false);

    VerticalLayout vlayout = new VerticalLayout() {
        {
            HorizontalLayout hlayout = new HorizontalLayout();
            hlayout.setSpacing(true);
            hlayout.setMargin(true);

            hlayout.addComponent(new Label(t(msg) + ": "));
            final TextField value = new TextField();
            hlayout.addComponent(value);
            addComponent(hlayout);
            addComponent(getControls(window, handler, value));
        }
    };
    vlayout.setMargin(true);
    vlayout.setSpacing(true);
    window.setContent(vlayout);
    UI.getCurrent().addWindow(window);
    window.focus();
}

From source file:ru.codeinside.gses.webui.components.ShowDiagramComponent.java

License:Mozilla Public License

private void buildLayout(final ShowDiagramComponentParameterObject param) {
    setSizeFull();/*from   w w  w  . j  a  v a 2  s  . com*/
    setSpacing(true);
    final Panel panel = new Panel();
    panel.getContent().setSizeUndefined();
    panel.setCaption(param.caption);
    TaskGraph tg = new TaskGraph(param.processDefinitionId, param.executionId);
    if (param.height != null) {
        tg.setHeight(param.height);
    }
    if (param.width != null) {
        tg.setWidth(param.width);
    }
    tg.setStyleName("scheme-image");
    final TaskGraph bigGraph = new TaskGraph(param.processDefinitionId, param.executionId);
    tg.addListener(new MouseEvents.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void click(MouseEvents.ClickEvent event) {
            final Window schemeWindow = new Window(param.windowHeader);
            getWindow().addWindow(schemeWindow);
            schemeWindow.addComponent(bigGraph);
            schemeWindow.setWidth("90%");
            schemeWindow.setHeight("90%");
            schemeWindow.center();
            schemeWindow.focus();
            schemeWindow.setCloseShortcut(ShortcutAction.KeyCode.ESCAPE, 0);
            bigGraph.addListener(new MouseEvents.ClickListener() {
                @Override
                public void click(MouseEvents.ClickEvent event) {
                    getWindow().removeWindow(schemeWindow);
                }
            });
        }
    });
    panel.addComponent(tg);
    addComponent(panel);
}