/*
 * Copyright 2016 Patrik Karlsson.
 *
 * 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.nbgames.gunu;

import org.nbgames.core.GameCategory;
import org.nbgames.core.GameController;
import org.nbgames.core.api.LogicGameProvider;
import org.nbgames.core.base.GamePanel;
import org.nbgames.core.game.NewGameController;
import org.nbgames.core.game.NewGameDialogManager;
import org.openide.DialogDisplayer;
import org.openide.util.lookup.ServiceProvider;
import org.openide.util.lookup.ServiceProviders;
import org.openide.windows.WindowManager;

/**
 *
 * @author Patrik Karlsson
 */
@ServiceProviders(value = {
    @ServiceProvider(service = GameController.class)
    ,
    @ServiceProvider(service = LogicGameProvider.class)}
)
public class GunuController extends GameController implements LogicGameProvider, NewGameController {

    public static final String TAG = "Gunu";
    private GunuPanel mGamePanel;

    public GunuController() {
    }

    @Override
    public GameCategory getCategory() {
        return GameCategory.LOGIC;
    }

    @Override
    public GamePanel getGamePanel() {
        if (mGamePanel == null) {
            mGamePanel = new GunuPanel();
        }

        return mGamePanel;
    }

    @Override
    public String getId() {
        return getClass().getName();
    }

    @Override
    public void onRequestNewGameCancel() {
    }

    @Override
    public void onRequestNewGameStart() {
//        getGamePanel().newGame()
        updateStatusBar();
    }

    @Override
    public void requestNewGame() {
        WindowManager.getDefault().invokeWhenUIReady(() -> {
            NewGameDialogManager manager = new NewGameDialogManager(new GunuNewGamePanel(), GunuController.this);
            DialogDisplayer.getDefault().notify(manager.getDialogDescriptor());
        });
    }

    @Override
    public void updateStatusBar() {
//        StatusDisplayer.getDefault().setStatusText(getGamePanel().getGameTitle(), StatusDisplayer.IMPORTANCE_ERROR_HIGHLIGHT);
    }
}

@@ -621,16 +621,43 @@
 .gunu;%0A%0A
+import javax.swing.JPanel;%0A
 import o
@@ -777,48 +777,8 @@
 er;%0A
-import org.nbgames.core.base.GamePanel;%0A
 impo
@@ -1572,20 +1572,103 @@
  public 
-Game
+String getId() %7B%0A        return getClass().getName();%0A    %7D%0A%0A    @Override%0A    public J
 Panel ge
@@ -1664,28 +1664,24 @@
 c JPanel get
-Game
 Panel() %7B%0A  
@@ -1828,61 +1828,171 @@
 lic 
-String getId() %7B%0A        return getClass().getName();
+JPanel getSettingsPanel() %7B%0A        throw new UnsupportedOperationException(%22Not supported yet.%22); //To change body of generated methods, choose Tools %7C Templates.
 %0A   

Introduce ComponentProvider