// Path: client/src/main/java/com/threerings/gardens/client/ClientContext.java
// public interface ClientContext {
// 
//     /** Returns our Nexus client. */
//     NexusClient client ();
// 
//     /** Returns our current auth token. */
//     String authToken ();
// 
//     /** Replaces the main panel being displayed by the client. */
//     void setMainPanel (Widget panel);
// }
// 
// Path: core/src/main/java/com/threerings/gardens/user/ChatMessage.java
// public class ChatMessage implements Streamable {
// 
//     public final String sender;
//     public final String message;
// 
//     public ChatMessage (String sender, String message) {
//         this.sender = sender;
//         this.message = message;
//     }
// }


import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.resources.client.CssResource;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;
import react.Connection;
import react.Slot;
import com.threerings.nexus.distrib.DMap;
import com.threerings.gwt.ui.EnterClickAdapter;
import com.threerings.gwt.ui.Widgets;
import com.threerings.gardens.client.ClientContext;
import com.threerings.gardens.user.ChatMessage;
//
// Game Gardens - a platform for hosting simple multiplayer Java games
// Copyright (c) 2005-2013, Three Rings Design, Inc. - All rights reserved.
// https://github.com/threerings/game-gardens/blob/master/LICENSE

package com.threerings.gardens.lobby;






public class LobbyPanel extends Composite {

    public LobbyPanel (ClientContext ctx, LobbyObject obj) {
        _ctx = ctx;
        _obj = obj;

        initWidget(_binder.createAndBindUi(this));

        // wire up the occupants list display
        new MapViewer<Integer,String>(_people) {
            protected Widget createView (Integer id, String name) {
                return Widgets.newLabel(name);
            }
        }.connect(_obj.occupants);

        // wire up the pending tables display and create button
        new MapViewer<Integer,LobbyObject.Table>(_penders) {
            protected Widget createView (Integer id, LobbyObject.Table table) {
                return new TableView(table);
            }
        }.connect(_obj.tables);

        _newGame.addClickHandler(new ClickHandler() {
            public void onClick (ClickEvent event) {
                _obj.svc.get().createTable("test", new GameConfig(), 2);
            }
        });

        // wire up the chat bits
        _obj.chat.connect(new Slot<ChatMessage>() {
// Path: client/src/main/java/com/threerings/gardens/client/ClientContext.java
// public interface ClientContext {
// 
//     /** Returns our Nexus client. */
//     NexusClient client ();
// 
//     /** Returns our current auth token. */
//     String authToken ();
// 
//     /** Replaces the main panel being displayed by the client. */
//     void setMainPanel (Widget panel);
// }
// 
// Path: core/src/main/java/com/threerings/gardens/user/ChatMessage.java
// public class ChatMessage implements Streamable {
// 
//     public final String sender;
//     public final String message;
// 
//     public ChatMessage (String sender, String message) {
//         this.sender = sender;
//         this.message = message;
//     }
// }


// Path: client/src/main/java/com/threerings/gardens/lobby/LobbyPanel.java
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.resources.client.CssResource;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;
import react.Connection;
import react.Slot;
import com.threerings.nexus.distrib.DMap;
import com.threerings.gwt.ui.EnterClickAdapter;
import com.threerings.gwt.ui.Widgets;
import com.threerings.gardens.client.ClientContext;
import com.threerings.gardens.user.ChatMessage;

//
// Game Gardens - a platform for hosting simple multiplayer Java games
// Copyright (c) 2005-2013, Three Rings Design, Inc. - All rights reserved.
// https://github.com/threerings/game-gardens/blob/master/LICENSE

package com.threerings.gardens.lobby;






public class LobbyPanel extends Composite {

    public LobbyPanel (ClientContext ctx, LobbyObject obj) {
        _ctx = ctx;
        _obj = obj;

        initWidget(_binder.createAndBindUi(this));

        // wire up the occupants list display
        new MapViewer<Integer,String>(_people) {
            protected Widget createView (Integer id, String name) {
                return Widgets.newLabel(name);
            }
        }.connect(_obj.occupants);

        // wire up the pending tables display and create button
        new MapViewer<Integer,LobbyObject.Table>(_penders) {
            protected Widget createView (Integer id, LobbyObject.Table table) {
                return new TableView(table);
            }
        }.connect(_obj.tables);

        _newGame.addClickHandler(new ClickHandler() {
            public void onClick (ClickEvent event) {
                _obj.svc.get().createTable("test", new GameConfig(), 2);
            }
        });

        // wire up the chat bits
        _obj.chat.connect(new Slot<ChatMessage>() {
            public void onEmit (ChatMessage msg) {