/**
 * Copyright 2010 JBoss Inc
 *
 * 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.drools.planner.examples.app;

import java.awt.Container;
import java.awt.GridLayout;
import java.awt.HeadlessException;
import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;

import org.drools.planner.examples.nqueens.app.NQueensApp;
import org.drools.planner.examples.nurserostering.app.NurseRosteringApp;
import org.drools.planner.examples.pas.app.PatientAdmissionScheduleApp;
import org.drools.planner.examples.travelingtournament.app.smart.SmartTravelingTournamentApp;
import org.drools.planner.examples.examination.app.ExaminationApp;
import org.drools.planner.examples.curriculumcourse.app.CurriculumCourseApp;
import org.drools.planner.examples.manners2009.app.Manners2009App;

/**
 * @author Geoffrey De Smet
 */
public class ExamplesApp extends JFrame {

    public static void main(String[] args) {
        ExamplesApp examplesApp = new ExamplesApp();
        examplesApp.pack();
        examplesApp.setVisible(true);
    }

    public ExamplesApp() {
        super("Drools Planner examples");
        setContentPane(createContentPane());
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }

    private Container createContentPane() {
        JPanel contentPane = new JPanel(new GridLayout(0, 1));
        contentPane.add(new JLabel("Which example do you want to see?"));
        contentPane.add(new JButton(new AbstractAction("N queens"){
            public void actionPerformed(ActionEvent e) {
                new NQueensApp().init(false);
            }
        }));
        contentPane.add(new JButton(new AbstractAction("Miss Manners 2009"){
            public void actionPerformed(ActionEvent e) {
                new Manners2009App().init(false);
            }
        }));
        contentPane.add(new JButton(new AbstractAction("Traveling tournament"){
            public void actionPerformed(ActionEvent e) {
                new SmartTravelingTournamentApp().init(false);
            }
        }));
        contentPane.add(new JButton(new AbstractAction("Curriculum course timetabling (ITC2007"){
            public void actionPerformed(ActionEvent e) {
                new CurriculumCourseApp().init(false);
            }
        }));
        contentPane.add(new JButton(new AbstractAction("Examination timetabling (ITC2007)"){
            public void actionPerformed(ActionEvent e) {
                new ExaminationApp().init(false);
            }
        }));
        contentPane.add(new JButton(new AbstractAction("Patient admission schedule"){
            public void actionPerformed(ActionEvent e) {
                new PatientAdmissionScheduleApp().init(false);
            }
        }));
        contentPane.add(new JButton(new AbstractAction("Nurse rostering (INRC2010)"){
            public void actionPerformed(ActionEvent e) {
                new NurseRosteringApp().init(false);
            }
        }));
        return contentPane;
    }

}

@@ -991,16 +991,89 @@
 Panel;%0A%0A
+import org.drools.planner.examples.cloudbalancing.app.CloudBalancingApp;%0A
 import o
@@ -2667,20 +2667,34 @@
 urnament
+ problem (TTP)
 %22)%7B%0A
-
         
@@ -2926,16 +2926,24 @@
 (ITC2007
+ track1)
 %22)%7B%0A    
@@ -3165,16 +3165,23 @@
 (ITC2007
+ track3
 )%22)%7B%0A   
@@ -3393,16 +3393,40 @@
 schedule
+ (hospital bed planning)
 %22)%7B%0A    
@@ -3703,32 +3703,32 @@
 ctionEvent e) %7B%0A
-
                 
@@ -3783,32 +3783,244 @@
  %7D%0A        %7D));%0A
+        contentPane.add(new JButton(new AbstractAction(%22Cloud balancing%22)%7B%0A            public void actionPerformed(ActionEvent e) %7B%0A                new CloudBalancingApp().init(false);%0A            %7D%0A        %7D));%0A
         return c

add cloud balancing to ExamplesApp