Example usage for com.vaadin.ui Button focus

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

Introduction

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

Prototype

@Override
    public void focus() 

Source Link

Usage

From source file:com.skysql.manager.ui.UserForm.java

License:Open Source License

/**
 * Instantiates a new user form.//from w  ww .j  a va  2s. c o  m
 *
 * @param userInfo the user info
 * @param user the user
 * @param description the description
 * @param commitButton the commit button
 */
UserForm(final UserInfo userInfo, final UserObject user, String description, final Button commitButton) {
    this.user = user;

    setMargin(new MarginInfo(true, true, false, true));
    setSpacing(false);

    addComponent(form);
    form.setImmediate(false);
    form.setFooter(null);
    form.setDescription(description);

    String value;
    if ((value = user.getUserID()) != null) {
        userName.setValue(value);
        userName.setEnabled(false);
    } else {
        userName.setRequired(true);
        userName.setRequiredError("Username is missing");
        userName.focus();
        userName.setImmediate(true);
        userName.addValidator(new UserNameValidator(userInfo));
    }
    form.addField("userName", userName);

    if ((value = user.getName()) != null) {
        fullname.setValue(value);
    }
    form.addField("fullname", fullname);

    // we don't get the user password from the API - set input prompt so bullets are displayed
    if (user.getUserID() != null) {
        newPassword.setInputPrompt("placeholder");
        newPassword2.setInputPrompt("placeholder");
    } else {
        newPassword.setRequired(true);
        newPassword.setRequiredError("Password is a required field");
        newPassword2.setRequired(true);
        newPassword2.setRequiredError("Password is a required field");
    }

    newPassword.setImmediate(true);
    newPassword.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 0x4C656F6E6172646FL;

        public void valueChange(ValueChangeEvent event) {
            commitButton.setClickShortcut(KeyCode.ENTER);
            newPassword2.focus();
        }
    });
    form.addField("newPassword", newPassword);

    newPassword2.setImmediate(true);
    newPassword2.addValidator(new Password2Validator(newPassword));
    newPassword2.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 0x4C656F6E6172646FL;

        public void valueChange(ValueChangeEvent event) {
            commitButton.focus();
        }
    });
    form.addField("newPassword2", newPassword2);

}

From source file:com.toptal.ui.view.LoginView.java

License:Open Source License

/**
 * Generates content.//from  w  w  w  .ja v  a  2  s.co  m
 * @return Content.
 */
private Component content() {
    final HorizontalLayout content = new HorizontalLayout();
    content.setSpacing(true);
    this.username = new TextField("Username");
    this.username.setIcon(FontAwesome.USER);
    this.username.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    this.password = new PasswordField("Password");
    this.password.setIcon(FontAwesome.LOCK);
    this.password.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    final Button login = new Button("Log In");
    login.addStyleName(ValoTheme.BUTTON_FRIENDLY);
    login.setClickShortcut(KeyCode.ENTER);
    login.focus();
    login.addClickListener(e -> this.login(this.username.getValue(), this.password.getValue()));
    final Button signup = new Button("Sign Up");
    signup.addStyleName(ValoTheme.BUTTON_PRIMARY);
    signup.addClickListener(e -> this.signup(this.username.getValue(), this.password.getValue()));
    content.addComponents(this.username, this.password, login, signup);
    content.setComponentAlignment(login, Alignment.BOTTOM_LEFT);
    content.setComponentAlignment(signup, Alignment.BOTTOM_LEFT);
    return content;
}

From source file:com.wintindustries.pfserver.interfaces.view.dashboard.LoginView.java

private Component buildFields() {
    HorizontalLayout fields = new HorizontalLayout();
    fields.setSpacing(true);//from   w  ww .  j a v a 2  s.c om
    fields.addStyleName("fields");

    final TextField username = new TextField("Username");
    username.setIcon(FontAwesome.USER);
    username.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);

    final PasswordField password = new PasswordField("Password");
    password.setIcon(FontAwesome.LOCK);
    password.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);

    final Button signin = new Button("Sign In");
    signin.addStyleName(ValoTheme.BUTTON_PRIMARY);
    signin.setClickShortcut(KeyCode.ENTER);
    signin.focus();

    fields.addComponents(username, password, signin);
    fields.setComponentAlignment(signin, Alignment.BOTTOM_LEFT);

    signin.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {

            System.out.println("TRIGGER LOGIN");
            DashboardEventBus.post(new UserLoginRequestedEvent(username.getValue(), password.getValue()));
        }
    });
    return fields;
}

From source file:info.magnolia.ui.framework.overlay.OverlayPresenter.java

License:Open Source License

private void addOkHandler(BaseDialog dialog, String okButtonText, final OverlayCloser overlayCloser,
        final AlertCallback cb) {
    CssLayout footer = new CssLayout();
    footer.setWidth(100, Unit.PERCENTAGE);
    footer.addStyleName("v-align-right");
    Button okButton = new Button(okButtonText, new ClickListener() {
        @Override/*from   w w w. j  a  va 2 s .  c  o m*/
        public void buttonClick(ClickEvent event) {
            cb.onOk();
            overlayCloser.close();
        }
    });
    okButton.focus();
    footer.addComponent(okButton);
    dialog.setFooterToolbar(footer);
}

From source file:jp.primecloud.auto.ui.MyCloudManage.java

License:Open Source License

MyCloudManage(Application ap) {

    apl = ap;//from w  w w . ja v a 2  s .co m
    //
    setIcon(Icons.EDITMINI.resource());

    setCaption(ViewProperties.getCaption("window.myCloudManage"));
    setModal(true);
    setWidth("550px");

    VerticalLayout layout = (VerticalLayout) getContent();
    layout.setMargin(true);

    // ?
    HorizontalLayout tbar = new HorizontalLayout();
    tbar.setWidth("100%");
    tbar.setSpacing(true);

    // ?
    Label tcaption = new Label(ViewProperties.getCaption("table.cloud"));
    tcaption.setWidth("300px");
    tbar.addComponent(tcaption);
    tbar.setComponentAlignment(tcaption, Alignment.MIDDLE_LEFT);

    // Edit
    Button editButton = new Button(ViewProperties.getCaption("button.editCloud"));
    editButton.setDescription(ViewProperties.getCaption("description.editCloud"));
    editButton.setIcon(Icons.EDITMINI.resource());
    editButton.setWidth("85px");
    editButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            MyCloudManage.this.editButtonClick(event);
        }
    });
    tbar.addComponent(editButton);
    tbar.setComponentAlignment(editButton, Alignment.BOTTOM_RIGHT);

    // Delete
    Button deleteButton = new Button(ViewProperties.getCaption("button.delete"));
    deleteButton.setDescription(ViewProperties.getCaption("description.delete"));
    deleteButton.setWidth("85px");
    deleteButton.setIcon(Icons.DELETEMINI.resource());
    deleteButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {

            MyCloudManage.this.deleteButtonClick(event);
        }
    });
    tbar.addComponent(deleteButton);
    tbar.setComponentAlignment(deleteButton, Alignment.BOTTOM_RIGHT);
    tbar.setExpandRatio(tcaption, 10);
    layout.addComponent(tbar);

    // ?
    Label spacer1 = new Label("");
    spacer1.setHeight("5px");
    layout.addComponent(spacer1);

    // 
    cloudTable = new CloudTable();
    layout.addComponent(cloudTable);

    // ?
    Label spacer2 = new Label("");
    spacer2.setHeight("7px");
    layout.addComponent(spacer2);

    // ??
    HorizontalLayout bbar = new HorizontalLayout();
    bbar.setWidth("100%");
    HorizontalLayout rlay = new HorizontalLayout();
    rlay.setSpacing(true);

    // New
    Button addButton = new Button(ViewProperties.getCaption("button.newCloud"));
    addButton.setDescription(ViewProperties.getCaption("description.newCloud"));
    addButton.setIcon(Icons.ADD.resource());
    addButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            MyCloudManage.this.addButtonClick(event);
        }
    });
    bbar.addComponent(addButton);
    bbar.setComponentAlignment(addButton, Alignment.MIDDLE_LEFT);

    // Switch
    Button switchButton = new Button(ViewProperties.getCaption("button.switch"));
    switchButton.setDescription(ViewProperties.getCaption("description.mycloud.switch"));
    switchButton.setWidth("85px");
    switchButton.setIcon(Icons.SELECTMINI.resource());
    switchButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            MyCloudManage.this.switchButtonClick(event);
        }
    });
    // [Enter]?switchButton
    switchButton.setClickShortcut(KeyCode.ENTER);
    switchButton.focus();
    rlay.addComponent(switchButton);

    // Cancel
    Button cancelButton = new Button(ViewProperties.getCaption("button.cancel"));
    cancelButton.setDescription(ViewProperties.getCaption("description.cancel"));
    cancelButton.setWidth("85px");
    cancelButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            MyCloudManage.this.close();
        }
    });
    rlay.addComponent(cancelButton);

    bbar.addComponent(rlay);
    bbar.setComponentAlignment(rlay, Alignment.MIDDLE_RIGHT);

    layout.addComponent(bbar);

    // ???
    initData();

    //???/?
    if (ViewContext.getPowerUser()) {
        addButton.setEnabled(true);
        deleteButton.setEnabled(true);
        editButton.setEnabled(true);
        //??????????????
        if (ViewContext.getPowerUser()
                && !ViewContext.getPowerDefaultMaster().equals(ViewContext.getLoginUser())) {
            addButton.setEnabled(false);
        }

    } else if (ViewContext.getUserNo().equals(ViewContext.getLoginUser())) {
        addButton.setEnabled(true);
        deleteButton.setEnabled(true);
        editButton.setEnabled(true);
    } else {
        addButton.setEnabled(false);
        deleteButton.setEnabled(false);
        editButton.setEnabled(false);
    }

    // 
    showClouds();
}

From source file:jp.primecloud.auto.ui.WinServerAdd.java

License:Open Source License

WinServerAdd(Application ap) {
    apl = ap;/*  www . j  av  a  2 s. com*/

    //
    setIcon(Icons.ADD.resource());
    setCaption(ViewProperties.getCaption("window.winServerAdd"));
    setModal(true);
    setWidth("620px");
    //setHeight("600px");

    VerticalLayout layout = (VerticalLayout) getContent();
    layout.setMargin(true, true, false, true);
    layout.setSpacing(false);

    // 
    layout.addComponent(new BasicForm());

    // ??
    HorizontalLayout okbar = new HorizontalLayout();
    okbar.setSpacing(true);
    okbar.setMargin(false, false, true, false);
    layout.addComponent(okbar);
    layout.setComponentAlignment(okbar, Alignment.BOTTOM_RIGHT);

    // Add
    Button addButton = new Button(ViewProperties.getCaption("button.add"));
    addButton.setDescription(ViewProperties.getCaption("description.addServer"));

    addButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            addButtonClick(event);
        }
    });

    // [Enter]?addButton
    addButton.setClickShortcut(KeyCode.ENTER);
    addButton.focus();
    okbar.addComponent(addButton);

    // Cancel
    Button cancelButton = new Button(ViewProperties.getCaption("button.cancel"));
    cancelButton.setDescription(ViewProperties.getCaption("description.cancel"));
    cancelButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            close();
        }
    });
    okbar.addComponent(cancelButton);

    // ??
    initValidation();

    // ???
    initData();

    // ?
    showClouds();
}

From source file:jp.primecloud.auto.ui.WinServerEdit.java

License:Open Source License

WinServerEdit(Application ap, Long instanceNo) {
    apl = ap;//from  w  w  w. java 2s  .c  o  m
    this.instanceNo = instanceNo;

    // ???
    initData();

    //
    setCaption(ViewProperties.getCaption("window.winServerEdit"));
    setModal(true);
    setWidth("600px");
    setIcon(Icons.EDITMINI.resource());

    VerticalLayout layout = (VerticalLayout) getContent();
    layout.setMargin(false, true, false, true);
    layout.setSpacing(true);

    //Tab?
    basicTab = new BasicTab();
    tab.addTab(basicTab, ViewProperties.getCaption("tab.basic"), Icons.BASIC.resource());
    layout.addComponent(tab);
    // ??
    basicTab.initValidation();
    // ?
    basicTab.showData();

    //Tab?
    String platformType = platformDto.getPlatform().getPlatformType();
    // TODO CLOUD BRANCHING
    if (PCCConstant.PLATFORM_TYPE_AWS.equals(platformType)) {
        awsDetailTab = new AWSDetailTab();
        tab.addTab(awsDetailTab, ViewProperties.getCaption("tab.detail"), Icons.DETAIL.resource());
        layout.addComponent(tab);
        // ??
        awsDetailTab.initValidation();
        // ?
        awsDetailTab.showData();
    } else if (PCCConstant.PLATFORM_TYPE_VMWARE.equals(platformType)) {
        vmwareDetailTab = new VMWareDetailTab();
        tab.addTab(vmwareDetailTab, ViewProperties.getCaption("tab.detail"), Icons.DETAIL.resource());
        // ??
        vmwareDetailTab.initValidation();
        // ?
        vmwareDetailTab.showData();

        boolean enableVmwareStaticIp = BooleanUtils.toBoolean(Config.getProperty("ui.enableVmwareEditIp"));
        if (BooleanUtils.isTrue(enableVmwareStaticIp)) {
            this.vmwareEditIpTab = new VmwareEditIpTab();
            tab.addTab(vmwareEditIpTab, ViewProperties.getCaption("tab.editIp"), Icons.DETAIL.resource());
            this.vmwareEditIpTab.showData();
            this.vmwareEditIpTab.initValidation();
        }

        layout.addComponent(tab);

    } else if (PCCConstant.PLATFORM_TYPE_NIFTY.equals(platformType)) {
        niftyDetailTab = new NiftyDetailTab();
        tab.addTab(niftyDetailTab, ViewProperties.getCaption("tab.detail"), Icons.DETAIL.resource());
        layout.addComponent(tab);
        // ??
        niftyDetailTab.initValidation();
        // ?
        niftyDetailTab.showData();

    } else if (PCCConstant.PLATFORM_TYPE_CLOUDSTACK.equals(platformType)) {
        cloudStackDetailTab = new CloudStackDetailTab();
        tab.addTab(cloudStackDetailTab, ViewProperties.getCaption("tab.detail"), Icons.DETAIL.resource());
        layout.addComponent(tab);
        // ??
        cloudStackDetailTab.initValidation();
        // ?
        cloudStackDetailTab.showData();
    } else if (PCCConstant.PLATFORM_TYPE_VCLOUD.equals(platformType)) {
        //
        vcloudDetailTab = new VcloudDetailTab();
        tab.addTab(vcloudDetailTab, ViewProperties.getCaption("tab.detail"), Icons.DETAIL.resource());
        // ??
        vcloudDetailTab.initValidation();
        // ?
        vcloudDetailTab.showData();

        //?
        vcloudNetworkTab = new VcloudNetworkTab();
        tab.addTab(vcloudNetworkTab, ViewProperties.getCaption("tab.network"), Icons.DETAIL.resource());
        vcloudNetworkTab.showData();

        layout.addComponent(tab);
    } else if (PCCConstant.PLATFORM_TYPE_AZURE.equals(platformType)) {
        azureDetailTab = new AzureDetailTab();
        tab.addTab(azureDetailTab, ViewProperties.getCaption("tab.detail"), Icons.DETAIL.resource());
        layout.addComponent(tab);
        // ??
        azureDetailTab.initValidation();
        // ?
        azureDetailTab.showData();
    } else if (PCCConstant.PLATFORM_TYPE_OPENSTACK.equals(platformType)) {
        openStackDetailTab = new OpenStackDetailTab();
        tab.addTab(openStackDetailTab, ViewProperties.getCaption("tab.detail"), Icons.DETAIL.resource());
        layout.addComponent(tab);
        // ??
        openStackDetailTab.initValidation();
        // ?
        openStackDetailTab.showData();
    }

    //        tab.addTab(new UserTab(), "", new ThemeResource("icons/user.png"));
    //        layout.addComponent(tab);

    // ??
    HorizontalLayout okbar = new HorizontalLayout();
    okbar.setSpacing(true);
    okbar.setMargin(false, false, true, false);
    layout.addComponent(okbar);
    layout.setComponentAlignment(okbar, Alignment.BOTTOM_RIGHT);

    // OK
    Button okButton = new Button(ViewProperties.getCaption("button.ok"));
    okButton.setDescription(ViewProperties.getCaption("description.editServer.ok"));
    okButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            okButtonClick(event);
        }
    });
    okbar.addComponent(okButton);
    // [Enter]?okButton
    okButton.setClickShortcut(KeyCode.ENTER);
    okButton.focus();

    Button cancelButton = new Button(ViewProperties.getCaption("button.cancel"));
    cancelButton.setDescription(ViewProperties.getCaption("description.cancel"));
    cancelButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            close();
        }
    });
    okbar.addComponent(cancelButton);
}

From source file:jp.primecloud.auto.ui.WinServiceAdd.java

License:Open Source License

WinServiceAdd(Application ap) {
    apl = ap;//  ww w  .ja v  a2 s  .  c o  m

    //
    setIcon(Icons.ADD.resource());
    setCaption(ViewProperties.getCaption("window.winServiceAdd"));
    setModal(true);
    setWidth("630px");
    //setHeight("500px");

    VerticalLayout layout = (VerticalLayout) getContent();
    layout.setMargin(false, true, false, true);
    layout.setSpacing(false);

    // 
    layout.addComponent(new BasicForm());

    // ??
    HorizontalLayout okbar = new HorizontalLayout();
    okbar.setSpacing(true);
    okbar.setMargin(false, false, true, false);
    layout.addComponent(okbar);
    layout.setComponentAlignment(okbar, Alignment.BOTTOM_RIGHT);

    // Add
    Button addButton = new Button(ViewProperties.getCaption("button.add"));
    addButton.setDescription(ViewProperties.getCaption("description.addService"));
    addButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            WinServiceAdd.this.addButtonClick(event);
        }
    });
    okbar.addComponent(addButton);
    // [Enter]?addButton
    addButton.setClickShortcut(KeyCode.ENTER);
    addButton.focus();

    // Cancel
    Button cancelButton = new Button(ViewProperties.getCaption("button.cancel"));
    cancelButton.setDescription(ViewProperties.getCaption("description.cancel"));
    cancelButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            WinServiceAdd.this.close();
        }
    });
    okbar.addComponent(cancelButton);

    // ??
    initValidation();

    // ???
    initData();

    // 
    showServices();
}

From source file:jp.primecloud.auto.ui.WinServiceEdit.java

License:Open Source License

WinServiceEdit(Application ap, Long componentNo) {
    apl = ap;/*from   w  ww . j ava 2  s.  c o m*/
    this.componentNo = componentNo;

    // ???
    initData();

    //
    setIcon(Icons.EDITMINI.resource());
    setCaption(ViewProperties.getCaption("window.winServiceEdit"));
    setModal(true);
    setWidth("600px");

    VerticalLayout layout = (VerticalLayout) getContent();
    //        layout.setWidth("100%");
    layout.setMargin(false, true, false, true);
    layout.setSpacing(true);

    // 
    layout.addComponent(tab);

    basicTab = new BasicTab();
    tab.addTab(basicTab, ViewProperties.getCaption("tab.basic"), Icons.BASIC.resource());

    detailTab = new DetailTab();
    Boolean useCustomPara = BooleanUtils.toBooleanObject(Config.getProperty("userCustomize.useCustomParam"));
    if (BooleanUtils.isTrue(useCustomPara)) {
        tab.addTab(detailTab, ViewProperties.getCaption("tab.detail"), Icons.BASIC.resource());
    }

    // ??
    HorizontalLayout okbar = new HorizontalLayout();
    okbar.setSpacing(true);
    okbar.setMargin(false, false, true, false);
    layout.addComponent(okbar);
    layout.setComponentAlignment(okbar, Alignment.BOTTOM_RIGHT);

    // OK
    Button okButton = new Button(ViewProperties.getCaption("button.ok"));
    okButton.setDescription(ViewProperties.getCaption("description.editService.ok"));
    okButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            okButtonClick(event);
        }
    });
    okbar.addComponent(okButton);
    // [Enter]?okButton
    okButton.setClickShortcut(KeyCode.ENTER);
    okButton.focus();

    // Cancel
    Button cancelButton = new Button(ViewProperties.getCaption("button.cancel"));
    cancelButton.setDescription(ViewProperties.getCaption("description.cancel"));
    cancelButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            close();
        }
    });
    okbar.addComponent(cancelButton);

    // ??
    initValidation();

    // ?
    basicTab.showData();

    // ?
    detailTab.showData();
}

From source file:kn.uni.gis.ui.GameApplication.java

License:Apache License

private Window createGameWindow() {

    tabsheet = new TabSheet();
    tabsheet.setImmediate(true);//from w  w  w  .j  a  v  a  2  s.c o m
    tabsheet.setCloseHandler(new CloseHandler() {
        @Override
        public void onTabClose(TabSheet tabsheet, Component tabContent) {

            Game game = ((GameComposite) tabContent).getGame();

            GameComposite remove = gameMap.remove(game);

            // closes the game and the running thread!
            remove.getLayer().handleApplicationClosedEvent(new ApplicationClosedEvent());

            eventBus.unregister(remove);
            eventBus.unregister(remove.getLayer());

            map.removeLayer(remove.getLayer());

            tabsheet.removeComponent(tabContent);

            if (gameMap.isEmpty()) {
                pi.setVisible(false);
            }
        }
    });

    final Window mywindow = new Window("Games");
    mywindow.setPositionX(0);
    mywindow.setPositionY(0);
    mywindow.setHeight("50%");
    mywindow.setWidth("25%");
    VerticalLayout layout = new VerticalLayout();
    HorizontalLayout lay = new HorizontalLayout();

    final Button button_1 = new Button();
    button_1.setCaption("Open Game");
    button_1.setWidth("-1px");
    button_1.setHeight("-1px");

    button_1.addListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            final String id = textField_1.getValue().toString();

            if (id.length() < 5) {
                window.showNotification("id must have at least 5 characters", Notification.TYPE_ERROR_MESSAGE);
            } else {
                String sql = String.format("select player_id,player_name,min(timestamp),max(timestamp) from %s"
                        + " where id LIKE ? group by player_id, player_name", GisResource.FOX_HUNTER);

                final Game game = new Game(id);
                final PreparedStatement statement = geoUtil.getConn()
                        .prepareStatement("select poly_geom,timestamp from " + GisResource.FOX_HUNTER
                                + " where id LIKE ? and player_id=? and timestamp > ? order by timestamp LIMIT "
                                + MAX_STATES_IN_MEM);

                try {
                    geoUtil.getConn().executeSafeQuery(sql, new DoWithin() {

                        @Override
                        public void doIt(ResultSet executeQuery) throws SQLException {

                            while (executeQuery.next()) {
                                if (statement == null) {

                                }
                                String playerId = executeQuery.getString(1);
                                Timestamp min = executeQuery.getTimestamp(3);
                                Timestamp max = executeQuery.getTimestamp(4);
                                game.addPlayer(playerId, executeQuery.getString(2), min, max,
                                        new TimingIterator(geoUtil, id, playerId, min.getTime(), statement));
                            }
                        }
                    }, id + "%");
                } catch (SQLException e) {
                    LOGGER.info("error on sql!", e);

                }

                game.finish(statement);

                if (!!!gameMap.containsKey(game)) {
                    if (game.getStates().size() == 0) {
                        window.showNotification("game not found!");
                    } else {
                        LOGGER.info("received game info: {},{} ", game.getId(), game.getStates().size());

                        GameVectorLayer gameVectorLayer = new GameVectorLayer(GameApplication.this, eventBus,
                                game, createColorMap(game));

                        final GameComposite gameComposite = new GameComposite(GameApplication.this, game,
                                gameVectorLayer, eventBus);

                        eventBus.register(gameComposite);
                        eventBus.register(gameVectorLayer);

                        map.addLayer(gameVectorLayer);
                        gameMap.put(game, gameComposite);

                        // Add the component to the tab sheet as a new tab.
                        Tab addTab = tabsheet.addTab(gameComposite);
                        addTab.setCaption(game.getId().substring(0, 5));
                        addTab.setClosable(true);

                        pi.setVisible(true);
                        // pl.get
                        PlayerState playerState = game.getStates().get(game.getFox()).peek();
                        map.zoomToExtent(new Bounds(CPOINT_TO_POINT.apply(playerState.getPoint())));
                    }
                }
            }
        }

        private Map<Player, Integer> createColorMap(Game game) {
            Function<Double, Double> scale = HardTasks.scale(0, game.getStates().size());

            ImmutableMap.Builder<Player, Integer> builder = ImmutableMap.builder();

            int i = 0;

            for (Player play : game.getStates().keySet()) {
                builder.put(play, getColor(scale.apply((double) i++)));
            }

            return builder.build();
        }

        private Integer getColor(double dob) {

            int toReturn = 0;
            toReturn = toReturn | 255 - (int) Math.round(255 * dob);
            toReturn = toReturn | (int) ((Math.round(255 * dob)) << 16);
            return toReturn;
            // return (int) (10000 + 35000 * dob + 5000 * dob + 1000 * dob +
            // 5 * dob);
        }

    });

    Button button_2 = new Button();
    button_2.setCaption("All seeing Hunter");
    button_2.setImmediate(false);
    button_2.setWidth("-1px");
    button_2.setHeight("-1px");
    button_2.addListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            if (adminWindow == null) {
                adminWindow = new AdminWindow(password, geoUtil, new ItemClickListener() {
                    @Override
                    public void itemClick(ItemClickEvent event) {

                        textField_1.setValue(event.getItemId().toString());
                        mywindow.bringToFront();
                        button_1.focus();
                    }
                });
                window.addWindow(adminWindow);
                adminWindow.setWidth("30%");
                adminWindow.setHeight("40%");
                adminWindow.addListener(new CloseListener() {
                    @Override
                    public void windowClose(CloseEvent e) {
                        adminWindow = null;
                    }
                });
            }
        }
    });

    lay.addComponent(button_1);
    textField_1 = new TextField();
    textField_1.setImmediate(false);
    textField_1.setWidth("-1px");
    textField_1.setHeight("-1px");
    lay.addComponent(textField_1);
    lay.addComponent(button_2);
    lay.addComponent(pi);

    lay.setComponentAlignment(pi, Alignment.TOP_RIGHT);

    layout.addComponent(lay);
    layout.addComponent(tabsheet);

    mywindow.addComponent(layout);
    mywindow.setClosable(false);

    /* Add the window inside the main window. */
    return mywindow;
}