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.garyclayburg.vconsole.VConsole.java

License:Open Source License

private Table createUserTable(BeanContainer<String, User> userBeanContainer) {
    final Collection[] selectedRows = new Collection[1];
    final Table userTable = new Table();
    userTable.setSizeFull();/*from w w w . j  a  va2 s. c o  m*/
    userTable.setSelectable(true);
    userTable.setMultiSelect(false);
    userTable.setImmediate(true);
    userTable.setContainerDataSource(userBeanContainer);
    userTable.addItemClickListener(new ItemClickEvent.ItemClickListener() {
        @Override
        public void itemClick(ItemClickEvent event) {
            Collection<?> itemPropertyIds = event.getItem().getItemPropertyIds();
            log.info("properties clicked: " + itemPropertyIds);
            log.info("multiple select? " + selectedRows[0]);
        }
    });
    userTable.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            //                selectedRows[0] = (Collection) userTable.getValue();
            log.info("selected: " + userTable.getValue());
        }
    });

    userTable.addActionHandler(new Action.Handler() {
        @Override
        public Action[] getActions(Object target, Object sender) {
            Table selectedUserTable = (Table) sender;
            Item item = selectedUserTable.getItem(selectedUserTable.getValue());
            Action[] actions = new Action[0];
            if (item instanceof BeanItem) {
                log.debug("create right-click menu items");
                //                    if (target == null){ //create actions for item user clicked on
                Item targetItem = selectedUserTable.getItem(target);
                if (targetItem != null) {
                    User targetUser = (User) ((BeanItem) targetItem).getBean();

                    if (targetUser != null) {
                        Set<String> allEntitledTargets = attributeService.getEntitledTargets(targetUser);
                        Set<Action> entitledTargetActions = new HashSet<>();

                        for (String targetName : allEntitledTargets) {
                            final Action action = new Action(targetName);
                            entitledTargetActions.add(action);
                        }
                        actions = entitledTargetActions.toArray(new Action[entitledTargetActions.size()]);
                        log.debug("right-click actions for user {}: {}", target, entitledTargetActions);
                    }
                }
            } else {
                log.debug("Cannot create right-click menu items");
            }

            return actions;
        }

        @Override
        public void handleAction(Action action, Object sender, Object target) {
            if (action != null) {
                Table selectedUserTable = (Table) sender;
                selectedUserTable.getValue();
                Item item = selectedUserTable.getItem(selectedUserTable.getValue());

                if (item instanceof BeanItem) {
                    log.debug("create target window");
                    User user = (User) ((BeanItem) item).getBean();
                    targetWindows.showTargetWindow(user, action.getCaption());
                } else {
                    log.debug("Cannot create window");
                }
            } else {
                Window multiWindow = new Window("multi-user myAD attributes");
                UI.getCurrent().addWindow(multiWindow);
                Label stuff = new Label("2 users here " + selectedRows[0] + " ");
                multiWindow.setContent(stuff);
            }
        }
    });
    userTable.setVisibleColumns("firstname", "lastname");
    return userTable;
}

From source file:com.github.lsiu.MyVaadinApplication.java

@Override
public void init() {
    window = new Window("My Vaadin Application");
    setMainWindow(window);/*from   w ww.j a  v a 2  s.  c o  m*/
    VerticalLayout layout = new VerticalLayout();
    layout.setSizeFull();

    table = new FilterTable();
    initTable(table);

    HorizontalLayout topBar = new HorizontalLayout();
    initTopBar(topBar);
    layout.addComponent(topBar);

    layout.addComponent(table);
    layout.setExpandRatio(table, 1);
    window.setContent(layout);
}

From source file:com.hack23.cia.web.impl.ui.application.views.pageclicklistener.SetGoogleAuthenticatorCredentialClickListener.java

License:Apache License

@Override
public void buttonClick(final ClickEvent event) {
    final SetGoogleAuthenticatorCredentialResponse response = (SetGoogleAuthenticatorCredentialResponse) applicationManager
            .service(googleAuthRequest);

    if (ServiceResult.SUCCESS == response.getResult()) {

        try {/*from  w  ww.j  a  va  2  s .  c  o m*/
            final URI keyUri = new URI(response.getOtpAuthTotpURL());
            final QRCode qrCode = new QRCode(QR_CODE, keyUri.toASCIIString());
            qrCode.setHeight(QR_CODE_IMAGE_SIZE);
            qrCode.setWidth(QR_CODE_IMAGE_SIZE);

            final Window mywindow = new Window(GOOGLE_AUTHENTICATOR_QR_CODE);
            mywindow.setHeight(MODAL_WINDOW_SIZE);
            mywindow.setWidth(MODAL_WINDOW_SIZE);

            mywindow.setPositionX(WINDOW_POSITION);
            mywindow.setPositionY(WINDOW_POSITION);

            final VerticalLayout panelContent = new VerticalLayout();

            mywindow.setContent(panelContent);
            panelContent.addComponent(qrCode);

            mywindow.setModal(true);
            UI.getCurrent().addWindow(mywindow);

        } catch (final URISyntaxException e) {
            LOGGER.warn(PROBLEM_DISPLAYING_QR_CODE, e);
            Notification.show(PROBLEM_DISPLAYING_QR_CODE, ERROR_MESSAGE, Notification.Type.WARNING_MESSAGE);
        }

    } else {
        Notification.show(PROBLEM_ENABLE_GOOGLE_AUTHENTICATOR, ERROR_MESSAGE,
                Notification.Type.WARNING_MESSAGE);
        LOGGER.info(PROBLEM_ENABLE_GOOGLE_AUTHENTICATOR_SESSIONID, googleAuthRequest.getSessionId());
    }
}

From source file:com.hopcroft.vaadin.vaadin_ex.MyVaadinApplication.java

License:Apache License

@Override
public void init() {
    window = new Window("My Vaadin Application");
    setMainWindow(window);/*from   w  ww .  j a v a2  s.co  m*/
    Button button = new Button("Click Me pl");
    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.imediava.asistentesm2.MyVaadinApplication.java

License:Apache License

@Override
public void init() {
    Window window = new Window("My Vaadin Application");
    setMainWindow(window);//from   ww  w. ja v  a  2  s  .  c o  m
    window.addComponent(new Button("Click Me"));
    insertarTablas(window);

}

From source file:com.iton.gittest.HelloGit.MyVaadinApplication.java

License:Apache License

@Override
public void init() {
    window = new Window("My Vaadin Application");
    setMainWindow(window);//from   w  w  w  .  j a va 2 s  .c  om
    Button button = new Button("Click Me");
    button.addListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            window.addComponent(new Label("Thank you for clicking two"));
        }
    });
    window.addComponent(button);

}

From source file:com.iton.gittest.HelloWorld.MyVaadinApplication.java

License:Apache License

@Override
public void init() {
    window = new Window("My Vaadin Application");
    setMainWindow(window);//  ww  w  .j a  va2 s  .co m
    Button button = new Button("Click Me");
    button.addListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            Window win = new Window("PopUp Form");
            win.setModal(true);
            win.setScrollable(false);
            win.setDraggable(false);
            win.setResizable(false);
            win.center();
            win.setWidth("350px");
            win.addComponent(new Form());
            window.addWindow(win);
        }
    });
    window.addComponent(button);

}

From source file:com.jiangyifen.ec2.ui.LoginLayout.java

/**
 * ??? (?, ?)/* w  w w. j a  v a2  s .c  o  m*/
 */
private void createConflictManageWindow() {
    conflictManageWindow = new Window("?");
    conflictManageWindow.setModal(true);
    conflictManageWindow.setResizable(false);

    VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.setSpacing(true);
    mainLayout.setMargin(true);
    mainLayout.setSizeUndefined();
    mainLayout.setWidth("400px");
    conflictManageWindow.setContent(mainLayout);

    Label captionLabel = new Label("<font color='blue'><B>??</B></font>",
            Label.CONTENT_XHTML);
    captionLabel.setWidth("-1px");
    mainLayout.addComponent(captionLabel);

    conflictNotice = new RichTextArea();
    conflictNotice.setReadOnly(true);
    conflictNotice.setWriteThrough(false);
    conflictNotice.setWidth("-1px");
    mainLayout.addComponent(conflictNotice);

    String placeholder = "&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp";
    Label noticeLabel = new Label(
            "<font color='red'><B>" + placeholder
                    + "?</B></font>",
            Label.CONTENT_XHTML);
    noticeLabel.setWidth("-1px");
    mainLayout.addComponent(noticeLabel);

    Label confirmLabel = new Label("<B>" + placeholder + "??</B>",
            Label.CONTENT_XHTML);
    confirmLabel.setWidth("-1px");
    mainLayout.addComponent(confirmLabel);

    // ???
    HorizontalLayout operatorHLayout = new HorizontalLayout();
    operatorHLayout.setSpacing(true);
    mainLayout.addComponent(operatorHLayout);

    confirm = new Button("", this);
    confirm.setImmediate(true);
    cancel = new Button("?", this);
    cancel.setStyleName("default");
    cancel.setImmediate(true);
    operatorHLayout.addComponent(confirm);
    operatorHLayout.addComponent(cancel);
}

From source file:com.jiangyifen.ec2.ui.mgr.system.tabsheet.DynQueueMemberManagement.java

/**
 *  ??//from  www .  ja va 2 s.  c  o  m
 */
private void createPriorityConfirmWindow() {
    globalPriorityConfirmWindow = new Window("?");
    globalPriorityConfirmWindow.center();
    globalPriorityConfirmWindow.setWidth("300px");
    globalPriorityConfirmWindow.setModal(true);
    globalPriorityConfirmWindow.setResizable(false);

    VerticalLayout windowContent = new VerticalLayout();
    windowContent.setSizeFull();
    windowContent.setMargin(true);
    windowContent.setSpacing(true);
    globalPriorityConfirmWindow.setContent(windowContent);

    noticeInPriorityWindow = new Label("", Label.CONTENT_XHTML);
    windowContent.addComponent(noticeInPriorityWindow);

    HorizontalLayout buttonsHLayout = new HorizontalLayout();
    buttonsHLayout.setSpacing(true);
    windowContent.addComponent(buttonsHLayout);

    submit = new Button(" ", this);
    abolish = new Button("? ", this);
    abolish.setStyleName("default");
    buttonsHLayout.addComponent(submit);
    buttonsHLayout.addComponent(abolish);
}

From source file:com.kelt.disk.db.web.DiskDBApplication.java

License:Apache License

@Override
public void init() {
    final Window mainWindow = new Window("Samplevaadin Application");
    final Window window = new Window("Some Window");
    window.setWidth(800, Sizeable.UNITS_PIXELS);
    window.setHeight(601, Sizeable.UNITS_PIXELS);
    window.setClosable(false);//w w  w  .j  a v a 2  s.  c  o  m
    window.setDraggable(false);
    window.setResizable(false);
    window.center();
    setUpWindow(window);
    mainWindow.addWindow(window);
    setMainWindow(mainWindow);
}