/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mobirent.gui;

import com.mobirent.abstracttags.Epitomize;
import gr.bluevibe.fire.components.Component;
import gr.bluevibe.fire.components.Panel;
import gr.bluevibe.fire.components.Row;
import gr.bluevibe.fire.displayables.FireScreen;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.Font;

/**
 *
 * @author Budai Attila
 */
public class SetupPanel extends Epitomize {

    private static SetupPanel INSTANCE = null;
    private static Panel panel;
    private static Command back = new Command("Vissza", Command.BACK, 0);
    private static Command exit = new Command("Kilépés", Command.OK, 0);
    private String res = "";

    public SetupPanel() {
        panel = getSetupPanel();
    }

    private Panel getSetupPanel() {
        Panel pan = new Panel();
        pan.setId("Beállítások");
        pan.addCommand(back);
        pan.addCommand(exit);
        pan.setCommandListener(this);

        pan.add(createRow("Beállítások", Font.STYLE_BOLD));
        pan.add(new Row());

        pan.add(getChoose1("felhasználónév, jelszó megadása", FireScreen.CENTRE));
        pan.add(new Row());

        pan.add(getChoose2("URL módosítása", FireScreen.CENTRE));
        pan.add(new Row());



        return pan;
    }

    public static SetupPanel getInstance() {

        if (INSTANCE == null) {
            INSTANCE = new SetupPanel();
        }
        System.gc();
        return INSTANCE;
    }

    public Panel getPanel() {

        return panel;
    }

    public void commandAction(Command cmd, Component c) {
        System.gc();
        try {
        } catch (Exception e) {
        }
        if (cmd == exit) {
            myMidlet.exit();

        }
        if (cmd == back) {
            screen.closePopup();
            MainPanel.getInstance();
            screen.setCurrent(MainPanel.getInstance().getPanel(), FireScreen.RIGHT);
            return;
        }
        if (cmd == choose1) {


            AllSetupPanel a = AllSetupPanel.getInstance();
            AllSetupPanel.delPanelTags();
            a.getPanel().setId("Adatok");
            a.idSetup();
            a.getPanel().validate();
            return;
        }
        if (cmd == choose2) {
            AllSetupPanel a = AllSetupPanel.getInstance();
            AllSetupPanel.delPanelTags();
            a.getPanel().setId("URL");
            a.idSetup();
            a.getPanel().validate();
            return;
        }

    }
}
