// Path: src/main/java/org/lbogdanov/poker/web/markup/NavBar.java
// public class NavBar extends Panel {
// 
//     @Inject
//     private UserService userService;
// 
//     /**
//      * @see Panel#Panel(String)
//      */
//     public NavBar(String id) {
//         super(id);
//         Behavior visibilityManager = new Behavior() {
// 
//             @Override
//             public void onConfigure(Component component) {
//                 component.setVisible(userService.getCurrentUser() != null);
//             }
// 
//         };
//         WebMarkupContainer userMenu = new WebMarkupContainer("userMenu");
//         WebMarkupContainer navigation = new WebMarkupContainer("navigation");
//         Label username = new BodylessLabel("username", new AbstractReadOnlyModel<User>() {
// 
//             @Override
//             public User getObject() {
//                 return userService.getCurrentUser();
//             }
// 
//         });
//         userMenu.add(username, new LogoutLink("logout"));
//         navigation.add(new WebMarkupContainer("sessions").add(append("class", new AbstractReadOnlyModel<String>() {
// 
//             @Override
//             public String getObject() {
//                 return MySessionsPage.class.equals(NavBar.this.getPage().getClass()) ? "active" : null;
//             }
// 
//         })));
//         add(userMenu.add(visibilityManager), navigation.add(visibilityManager),
//             new BookmarkablePageLink<Void>("home", getApplication().getHomePage()));
//     }
// 
// }
// 
// Path: src/main/java/org/lbogdanov/poker/web/plugin/I18nPlugin.java
// public class I18nPlugin extends JQueryPluginResourceReference {
// 
//     private static final I18nPlugin INSTANCE = new I18nPlugin();
// 
//     /**
//      * Returns a single instance of jQuery i18n plugin resource reference.
//      * 
//      * @return the single instance
//      */
//     public static I18nPlugin get() {
//             return INSTANCE;
//     }
// 
//     private I18nPlugin() {
//         super(I18nPlugin.class, "jquery.i18n.js");
//     }
// 
// }


import java.util.Collections;
import org.apache.wicket.bootstrap.Bootstrap;
import org.apache.wicket.markup.head.CssHeaderItem;
import org.apache.wicket.markup.head.HeaderItem;
import org.apache.wicket.markup.head.IHeaderResponse;
import org.apache.wicket.markup.head.JavaScriptHeaderItem;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.model.IModel;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.request.resource.JavaScriptResourceReference;
import org.apache.wicket.request.resource.ResourceReference;
import org.lbogdanov.poker.web.markup.NavBar;
import org.lbogdanov.poker.web.plugin.I18nPlugin;
/**
 * Copyright 2012 Leonid Bogdanov
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.lbogdanov.poker.web.page;




/**
 * Base class for all pages: adds Twitter Bootstrap files, global navbar.
 * 
 * @author Leonid Bogdanov
 */
abstract class AbstractPage extends WebPage {

    protected final ResourceReference I18N = new JavaScriptResourceReference(AbstractPage.class, "i18n.js",
                                                                             getLocale(), null, null) {

            @Override
            public Iterable<? extends HeaderItem> getDependencies() {
                return Collections.singletonList(JavaScriptHeaderItem.forReference(I18nPlugin.get()));
            }

    };

// Path: src/main/java/org/lbogdanov/poker/web/markup/NavBar.java
// public class NavBar extends Panel {
// 
//     @Inject
//     private UserService userService;
// 
//     /**
//      * @see Panel#Panel(String)
//      */
//     public NavBar(String id) {
//         super(id);
//         Behavior visibilityManager = new Behavior() {
// 
//             @Override
//             public void onConfigure(Component component) {
//                 component.setVisible(userService.getCurrentUser() != null);
//             }
// 
//         };
//         WebMarkupContainer userMenu = new WebMarkupContainer("userMenu");
//         WebMarkupContainer navigation = new WebMarkupContainer("navigation");
//         Label username = new BodylessLabel("username", new AbstractReadOnlyModel<User>() {
// 
//             @Override
//             public User getObject() {
//                 return userService.getCurrentUser();
//             }
// 
//         });
//         userMenu.add(username, new LogoutLink("logout"));
//         navigation.add(new WebMarkupContainer("sessions").add(append("class", new AbstractReadOnlyModel<String>() {
// 
//             @Override
//             public String getObject() {
//                 return MySessionsPage.class.equals(NavBar.this.getPage().getClass()) ? "active" : null;
//             }
// 
//         })));
//         add(userMenu.add(visibilityManager), navigation.add(visibilityManager),
//             new BookmarkablePageLink<Void>("home", getApplication().getHomePage()));
//     }
// 
// }
// 
// Path: src/main/java/org/lbogdanov/poker/web/plugin/I18nPlugin.java
// public class I18nPlugin extends JQueryPluginResourceReference {
// 
//     private static final I18nPlugin INSTANCE = new I18nPlugin();
// 
//     /**
//      * Returns a single instance of jQuery i18n plugin resource reference.
//      * 
//      * @return the single instance
//      */
//     public static I18nPlugin get() {
//             return INSTANCE;
//     }
// 
//     private I18nPlugin() {
//         super(I18nPlugin.class, "jquery.i18n.js");
//     }
// 
// }


// Path: src/main/java/org/lbogdanov/poker/web/page/AbstractPage.java
import java.util.Collections;
import org.apache.wicket.bootstrap.Bootstrap;
import org.apache.wicket.markup.head.CssHeaderItem;
import org.apache.wicket.markup.head.HeaderItem;
import org.apache.wicket.markup.head.IHeaderResponse;
import org.apache.wicket.markup.head.JavaScriptHeaderItem;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.model.IModel;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.request.resource.JavaScriptResourceReference;
import org.apache.wicket.request.resource.ResourceReference;
import org.lbogdanov.poker.web.markup.NavBar;
import org.lbogdanov.poker.web.plugin.I18nPlugin;

/**
 * Copyright 2012 Leonid Bogdanov
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.lbogdanov.poker.web.page;




/**
 * Base class for all pages: adds Twitter Bootstrap files, global navbar.
 * 
 * @author Leonid Bogdanov
 */
abstract class AbstractPage extends WebPage {

    protected final ResourceReference I18N = new JavaScriptResourceReference(AbstractPage.class, "i18n.js",
                                                                             getLocale(), null, null) {

            @Override
            public Iterable<? extends HeaderItem> getDependencies() {
                return Collections.singletonList(JavaScriptHeaderItem.forReference(I18nPlugin.get()));
            }

    };

    private NavBar navBar;