/**
 * Get more info at : www.jrebirth.org .
 * Copyright JRebirth.org © 2011-2013
 * Contact : sebastien.bordes@jrebirth.org
 * 
 * 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.jrebirth.demo.masteringtables.ui.menu;

import org.jrebirth.af.core.concurrent.RunInto;
import org.jrebirth.af.core.concurrent.RunType;
import org.jrebirth.af.core.concurrent.RunnablePriority;
import org.jrebirth.af.core.ui.DefaultModel;
import org.jrebirth.af.core.wave.OnWave;
import org.jrebirth.af.core.wave.Wave;
import org.jrebirth.demo.masteringtables.beans.GameSettings;
import org.jrebirth.demo.masteringtables.service.ExpressionBuilderService;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * The Class GameMenuModel.
 */
public class GameMenuModel extends DefaultModel<GameMenuModel, GameMenuView> {

    /** The Constant LOGGER. */
    private static final Logger LOGGER = LoggerFactory.getLogger(GameMenuModel.class);

    /** The service used to build quiz data. */
    private ExpressionBuilderService expressionBuilderService;

    /** The game settings bean. */
    private final GameSettings gameSettings = new GameSettings();

    /**
     * {@inheritDoc}
     */
    @Override
    protected void initModel() {

        // Be notified when tables are ready
        // listen(ExpressionBuilderService.RE_TABLES_BUILT);

        // Store an hard link to avoid garbage collection of the service
        this.expressionBuilderService = getService(ExpressionBuilderService.class);

    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected void showView() {
        super.showView();

        // // getView().getLoadingBar().setVisible(true);
        // // Generate all tables
        // final Wave wave = returnData(ExpressionBuilderService.class, ExpressionBuilderService.DO_BUILD_TABLES,
        // WaveData.build(JRebirthWaves.PROGRESS_BAR, getView().getLoadingBar()));
        //
        // wave.statusProperty().addListener(new ChangeListener<Wave.Status>() {
        //
        // @Override
        // public void changed(final ObservableValue<? extends Wave.Status> arg0, final Wave.Status arg1, final Wave.Status arg2) {
        // if (arg1 == Status.Consumed) {
        // getView().getLoadingBar().setVisible(false);
        // }
        //
        // }
        // });
    }

    /**
     * Tables built.
     * 
     * @param wave the wave
     */
    @OnWave("TABLES_BUILT")
    @RunInto(value = RunType.JTP, priority = RunnablePriority.Highest)
    public void doTablesBuilt(final boolean boo, final Wave wave) {

        final int nbExpression = this.expressionBuilderService.getAdditionTable().size()
                + this.expressionBuilderService.getDivisionTable().size()
                + this.expressionBuilderService.getSubtractionTable().size()
                + this.expressionBuilderService.getMultiplicationTable().size();

        LOGGER.info("Tables are available and contains {} expressions.", nbExpression);
    }

    /**
     * Gets the game settings.
     * 
     * @return the game settings
     */
    public GameSettings getGameSettings() {
        return this.gameSettings;
    }
}

@@ -787,261 +787,74 @@
 ore.
-concurrent.RunInto;%0D%0Aimport org.jrebirth.af.core.concurrent.RunType;%0D%0Aimport org.jrebirth.af.core.concurrent.RunnablePriority;%0D%0Aimport org.jrebirth.af.core.ui.DefaultModel;%0D%0Aimport org.jrebirth.af.core.wave.OnWave;%0D%0Aimport org.jrebirth.af.core.wave.Wave
+annotation.Component;%0D%0Aimport org.jrebirth.af.core.ui.DefaultModel
 ;%0D%0Ai
@@ -1342,24 +1342,40 @@
 z data. */%0D%0A
+    @Component%0D%0A
     private 
@@ -1537,1890 +1537,8 @@
 %0D%0A%0D%0A
-    /**%0D%0A     * %7B@inheritDoc%7D%0D%0A     */%0D%0A    @Override%0D%0A    protected void initModel() %7B%0D%0A%0D%0A        // Be notified when tables are ready%0D%0A        // listen(ExpressionBuilderService.RE_TABLES_BUILT);%0D%0A%0D%0A        // Store an hard link to avoid garbage collection of the service%0D%0A        this.expressionBuilderService = getService(ExpressionBuilderService.class);%0D%0A%0D%0A    %7D%0D%0A%0D%0A    /**%0D%0A     * %7B@inheritDoc%7D%0D%0A     */%0D%0A    @Override%0D%0A    protected void showView() %7B%0D%0A        super.showView();%0D%0A%0D%0A        // // getView().getLoadingBar().setVisible(true);%0D%0A        // // Generate all tables%0D%0A        // final Wave wave = returnData(ExpressionBuilderService.class, ExpressionBuilderService.DO_BUILD_TABLES,%0D%0A        // WaveData.build(JRebirthWaves.PROGRESS_BAR, getView().getLoadingBar()));%0D%0A        //%0D%0A        // wave.statusProperty().addListener(new ChangeListener%3CWave.Status%3E() %7B%0D%0A        //%0D%0A        // @Override%0D%0A        // public void changed(final ObservableValue%3C? extends Wave.Status%3E arg0, final Wave.Status arg1, final Wave.Status arg2) %7B%0D%0A        // if (arg1 == Status.Consumed) %7B%0D%0A        // getView().getLoadingBar().setVisible(false);%0D%0A        // %7D%0D%0A        //%0D%0A        // %7D%0D%0A        // %7D);%0D%0A    %7D%0D%0A%0D%0A    /**%0D%0A     * Tables built.%0D%0A     * %0D%0A     * @param wave the wave%0D%0A     */%0D%0A    @OnWave(%22TABLES_BUILT%22)%0D%0A    @RunInto(value = RunType.JTP, priority = RunnablePriority.Highest)%0D%0A    public void doTablesBuilt(final boolean boo, final Wave wave) %7B%0D%0A%0D%0A        final int nbExpression = this.expressionBuilderService.getAdditionTable().size()%0D%0A                + this.expressionBuilderService.getDivisionTable().size()%0D%0A                + this.expressionBuilderService.getSubtractionTable().size()%0D%0A                + this.expressionBuilderService.getMultiplicationTable().size();%0D%0A%0D%0A        LOGGER.info(%22Tables are available and contains %7B%7D expressions.%22, nbExpression);%0D%0A    %7D%0D%0A%0D%0A
     

Remove all unnecessary code !!