Package midlets

Source Code of midlets.TwiterMidlet

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

import aplicacion.TweeterFacade;
import com.twitterapime.model.MetadataSet;
import com.twitterapime.search.Tweet;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import org.netbeans.microedition.util.SimpleCancellableTask;

/**
* @author Alan
*/
public class TwiterMidlet extends MIDlet implements CommandListener, ItemCommandListener {

    private boolean midletPaused = false;
    //<editor-fold defaultstate="collapsed" desc=" Generated Fields ">//GEN-BEGIN:|fields|0|
    private java.util.Hashtable __previousDisplayables = new java.util.Hashtable();
    private Command guardarCommand;
    private Command postTweetCommand;
    private Command backTweetCommand;
    private Command buscarCommand;
    private Command cfgCommand;
    private Command tweetCommand;
    private Command buscarContenidoCommand;
    private Command buscarTagCommand;
    private Command explorarTweetsCommand;
    private Command siguientePaginaCommand;
    private Command buscarAutorCommand;
    private Command reTweetCommand;
    private Command backCommand;
    private Command editarCommand;
    private Command eliminarCommand;
    private Command tweetPendienteCommand;
    private Command salirCommand;
    private Command busquedaAvanzadaCommand;
    private Command buscarAvanzadaCommand;
    private Command mailTweetCommand;
    private Command enviarMailCommand;
    private Form configuracionForm;
    private TextField userTF;
    private TextField passTF;
    private ChoiceGroup opcionesCG;
    private TextField tweetsPorPaginaTF;
    private Form tweetFrom;
    private TextField tweetTF;
    private StringItem caracteresSI;
    private Form inicialForm;
    private StringItem tweetsPendientesSI;
    private StringItem usuarioSI;
    private Form buscarForm;
    private TextField buscarTF;
    private List resultadosList;
    private List tweetsPendientesList;
    private Form editarPendienteForm;
    private TextField editarTweetTF;
    private Form avancedSearchForm;
    private TextField buscarAvanzadaTF;
    private ChoiceGroup tipoBusquedaCG;
    private ChoiceGroup desdeHastaCG;
    private DateField desdeDF;
    private TextField paraTF;
    private TextField tagBusquedaTF;
    private DateField hastaDF;
    private TextField referenciaTF;
    private TextField deTF;
    private Alert alerta;
    private Form enviarMailForm;
    private TextField eMailTF;
    //</editor-fold>//GEN-END:|fields|0|

    /**
     * The HelloMIDlet constructor.
     */
    public TwiterMidlet() {
    }

    //<editor-fold defaultstate="collapsed" desc=" Generated Methods ">//GEN-BEGIN:|methods|0|
    /**
     * Switches a display to previous displayable of the current displayable.
     * The <code>display</code> instance is obtain from the <code>getDisplay</code> method.
     */
    private void switchToPreviousDisplayable() {
        Displayable __currentDisplayable = getDisplay().getCurrent();
        if (__currentDisplayable != null) {
            Displayable __nextDisplayable = (Displayable) __previousDisplayables.get(__currentDisplayable);
            if (__nextDisplayable != null) {
                switchDisplayable(null, __nextDisplayable);
            }
        }
    }
    //</editor-fold>//GEN-END:|methods|0|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: initialize ">//GEN-BEGIN:|0-initialize|0|0-preInitialize
    /**
     * Initilizes the application.
     * It is called only once when the MIDlet is started. The method is called before the <code>startMIDlet</code> method.
     */
    private void initialize() {//GEN-END:|0-initialize|0|0-preInitialize
        // write pre-initialize user code here
//GEN-LINE:|0-initialize|1|0-postInitialize
        // write post-initialize user code here
    }//GEN-BEGIN:|0-initialize|2|
    //</editor-fold>//GEN-END:|0-initialize|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: startMIDlet ">//GEN-BEGIN:|3-startMIDlet|0|3-preAction
    /**
     * Performs an action assigned to the Mobile Device - MIDlet Started point.
     */
    public void startMIDlet() {//GEN-END:|3-startMIDlet|0|3-preAction
        // write pre-action user code here
        switchDisplayable(null, getInicialForm());//GEN-LINE:|3-startMIDlet|1|3-postAction
        // write post-action user code here
    }//GEN-BEGIN:|3-startMIDlet|2|
    //</editor-fold>//GEN-END:|3-startMIDlet|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: resumeMIDlet ">//GEN-BEGIN:|4-resumeMIDlet|0|4-preAction
    /**
     * Performs an action assigned to the Mobile Device - MIDlet Resumed point.
     */
    public void resumeMIDlet() {//GEN-END:|4-resumeMIDlet|0|4-preAction
        // write pre-action user code here
//GEN-LINE:|4-resumeMIDlet|1|4-postAction
        // write post-action user code here
    }//GEN-BEGIN:|4-resumeMIDlet|2|
    //</editor-fold>//GEN-END:|4-resumeMIDlet|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: switchDisplayable ">//GEN-BEGIN:|5-switchDisplayable|0|5-preSwitch
    /**
     * Switches a current displayable in a display. The <code>display</code> instance is taken from <code>getDisplay</code> method. This method is used by all actions in the design for switching displayable.
     * @param alert the Alert which is temporarily set to the display; if <code>null</code>, then <code>nextDisplayable</code> is set immediately
     * @param nextDisplayable the Displayable to be set
     */
    public void switchDisplayable(Alert alert, Displayable nextDisplayable) {//GEN-END:|5-switchDisplayable|0|5-preSwitch
        // write pre-switch user code here
        if (nextDisplayable == getInicialForm()) {
            getTweetsPendientesSI().setText(Integer.toString(facade.getNumeroTweetsSalvados()));
            getUsuarioSI().setText(facade.getUsuario());
        }
        if (nextDisplayable == getConfiguracionForm()) {
            getUserTF().setString(facade.getUsuario());
            getPassTF().setString(facade.getContrasena());
            boolean[] sf = new boolean[2];
            sf[0] = facade.getAutoSend();
            sf[1] = facade.getTruncarTweets();
            getOpcionesCG().setSelectedFlags(sf);
            getTweetsPorPaginaTF().setString(Integer.toString(facade.getTweetsPagina()));
        }

        Display display = getDisplay();//GEN-BEGIN:|5-switchDisplayable|1|5-postSwitch
        Displayable __currentDisplayable = display.getCurrent();
        if (__currentDisplayable != null  &&  nextDisplayable != null) {
            __previousDisplayables.put(nextDisplayable, __currentDisplayable);
        }
        if (alert == null) {
            display.setCurrent(nextDisplayable);
        } else {
            display.setCurrent(alert, nextDisplayable);
        }//GEN-END:|5-switchDisplayable|1|5-postSwitch
        // write post-switch user code here
    }//GEN-BEGIN:|5-switchDisplayable|2|
    //</editor-fold>//GEN-END:|5-switchDisplayable|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: commandAction for Displayables ">//GEN-BEGIN:|7-commandAction|0|7-preCommandAction
    /**
     * Called by a system to indicated that a command has been invoked on a particular displayable.
     * @param command the Command that was invoked
     * @param displayable the Displayable where the command was invoked
     */
    public void commandAction(Command command, Displayable displayable) {//GEN-END:|7-commandAction|0|7-preCommandAction
        // write pre-action user code here
        if (displayable == avancedSearchForm) {//GEN-BEGIN:|7-commandAction|1|204-preAction
            if (command == backCommand) {//GEN-END:|7-commandAction|1|204-preAction
                // write pre-action user code here
                switchDisplayable(null, getInicialForm());//GEN-LINE:|7-commandAction|2|204-postAction
                // write post-action user code here
            } else if (command == buscarAvanzadaCommand) {//GEN-LINE:|7-commandAction|3|212-preAction
                // write pre-action user code here
                buscarAvanzada();//GEN-LINE:|7-commandAction|4|212-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|5|140-preAction
        } else if (displayable == buscarForm) {
            if (command == backCommand) {//GEN-END:|7-commandAction|5|140-preAction
                // write pre-action user code here
                switchDisplayable(null, getInicialForm());//GEN-LINE:|7-commandAction|6|140-postAction
                // write post-action user code here
            } else if (command == buscarAutorCommand) {//GEN-LINE:|7-commandAction|7|113-preAction
                // write pre-action user code here
                buscarAutor();//GEN-LINE:|7-commandAction|8|113-postAction
                // write post-action user code here
            } else if (command == buscarContenidoCommand) {//GEN-LINE:|7-commandAction|9|111-preAction
                // write pre-action user code here
                buscarContenido();//GEN-LINE:|7-commandAction|10|111-postAction
                // write post-action user code here
            } else if (command == buscarTagCommand) {//GEN-LINE:|7-commandAction|11|109-preAction
                // write pre-action user code here
                buscarTag();//GEN-LINE:|7-commandAction|12|109-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|13|179-preAction
        } else if (displayable == configuracionForm) {
            if (command == backCommand) {//GEN-END:|7-commandAction|13|179-preAction
                // write pre-action user code here
                switchDisplayable(null, getInicialForm());//GEN-LINE:|7-commandAction|14|179-postAction
                // write post-action user code here
            } else if (command == guardarCommand) {//GEN-LINE:|7-commandAction|15|180-preAction
                // write pre-action user code here
                salvarConfiguracion();//GEN-LINE:|7-commandAction|16|180-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|17|152-preAction
        } else if (displayable == editarPendienteForm) {
            if (command == backCommand) {//GEN-END:|7-commandAction|17|152-preAction
                // write pre-action user code here
                salvarPendienteYVolver();//GEN-LINE:|7-commandAction|18|152-postAction
                // write post-action user code here
            } else if (command == postTweetCommand) {//GEN-LINE:|7-commandAction|19|155-preAction
                // write pre-action user code here
                enviarTweetEditado();//GEN-LINE:|7-commandAction|20|155-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|21|229-preAction
        } else if (displayable == enviarMailForm) {
            if (command == backCommand) {//GEN-END:|7-commandAction|21|229-preAction
                // write pre-action user code here
                switchDisplayable(null, getBuscarForm());//GEN-LINE:|7-commandAction|22|229-postAction
                // write post-action user code here
            } else if (command == enviarMailCommand) {//GEN-LINE:|7-commandAction|23|228-preAction
                // write pre-action user code here
                enviarTweetPorMail();//GEN-LINE:|7-commandAction|24|228-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|25|102-preAction
        } else if (displayable == inicialForm) {
            if (command == buscarCommand) {//GEN-END:|7-commandAction|25|102-preAction
                // write pre-action user code here
                switchDisplayable(null, getBuscarForm());//GEN-LINE:|7-commandAction|26|102-postAction
                // write post-action user code here
            } else if (command == busquedaAvanzadaCommand) {//GEN-LINE:|7-commandAction|27|207-preAction
                // write pre-action user code here
                switchDisplayable(null, getAvancedSearchForm());//GEN-LINE:|7-commandAction|28|207-postAction
                // write post-action user code here
            } else if (command == cfgCommand) {//GEN-LINE:|7-commandAction|29|100-preAction
                // write pre-action user code here
                switchDisplayable(null, getConfiguracionForm());//GEN-LINE:|7-commandAction|30|100-postAction
                // write post-action user code here
            } else if (command == explorarTweetsCommand) {//GEN-LINE:|7-commandAction|31|105-preAction
                // write pre-action user code here
                verTweetsPendientes();//GEN-LINE:|7-commandAction|32|105-postAction
                // write post-action user code here
            } else if (command == tweetCommand) {//GEN-LINE:|7-commandAction|33|98-preAction
                // write pre-action user code here
                switchDisplayable(null, getTweetFrom());//GEN-LINE:|7-commandAction|34|98-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|35|121-preAction
        } else if (displayable == resultadosList) {
            if (command == List.SELECT_COMMAND) {//GEN-END:|7-commandAction|35|121-preAction
                // write pre-action user code here
                resultadosListAction();//GEN-LINE:|7-commandAction|36|121-postAction
                // write post-action user code here
            } else if (command == backCommand) {//GEN-LINE:|7-commandAction|37|125-preAction
                // write pre-action user code here
                switchToPreviousDisplayable();//GEN-LINE:|7-commandAction|38|125-postAction
                // write post-action user code here

            } else if (command == mailTweetCommand) {//GEN-LINE:|7-commandAction|39|222-preAction
                // write pre-action user code here
                marcarTweetParaMail();//GEN-LINE:|7-commandAction|40|222-postAction
                // write post-action user code here
            } else if (command == reTweetCommand) {//GEN-LINE:|7-commandAction|41|127-preAction
                // write pre-action user code here
                reTweet();//GEN-LINE:|7-commandAction|42|127-postAction
                // write post-action user code here
            } else if (command == siguientePaginaCommand) {//GEN-LINE:|7-commandAction|43|123-preAction
                // write pre-action user code here
                buscarSiguientePagina();//GEN-LINE:|7-commandAction|44|123-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|45|86-preAction
        } else if (displayable == tweetFrom) {
            if (command == postTweetCommand) {//GEN-END:|7-commandAction|45|86-preAction
                // write pre-action user code here
                tweet();//GEN-LINE:|7-commandAction|46|86-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|47|144-preAction
        } else if (displayable == tweetsPendientesList) {
            if (command == List.SELECT_COMMAND) {//GEN-END:|7-commandAction|47|144-preAction
                // write pre-action user code here
                tweetsPendientesListAction();//GEN-LINE:|7-commandAction|48|144-postAction
                // write post-action user code here
            } else if (command == backCommand) {//GEN-LINE:|7-commandAction|49|146-preAction
                // write pre-action user code here
                switchDisplayable(null, getInicialForm());//GEN-LINE:|7-commandAction|50|146-postAction
                // write post-action user code here
            } else if (command == editarCommand) {//GEN-LINE:|7-commandAction|51|160-preAction
                // write pre-action user code here
                editarPendiente();//GEN-LINE:|7-commandAction|52|160-postAction
                // write post-action user code here
            } else if (command == eliminarCommand) {//GEN-LINE:|7-commandAction|53|164-preAction
                // write pre-action user code here
                eliminarPendiente();//GEN-LINE:|7-commandAction|54|164-postAction
                // write post-action user code here
            } else if (command == tweetPendienteCommand) {//GEN-LINE:|7-commandAction|55|167-preAction
                // write pre-action user code here
                tweetPendiente();//GEN-LINE:|7-commandAction|56|167-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|57|7-postCommandAction
        }//GEN-END:|7-commandAction|57|7-postCommandAction
        // write post-action user code here
    }//GEN-BEGIN:|7-commandAction|58|
    //</editor-fold>//GEN-END:|7-commandAction|58|

    //</editor-fold>
    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: guardarCommand ">//GEN-BEGIN:|78-getter|0|78-preInit
    /**
     * Returns an initiliazed instance of guardarCommand component.
     * @return the initialized component instance
     */
    public Command getGuardarCommand() {
        if (guardarCommand == null) {//GEN-END:|78-getter|0|78-preInit
            // write pre-init user code here
            guardarCommand = new Command("Guardar", Command.OK, 0);//GEN-LINE:|78-getter|1|78-postInit
            // write post-init user code here
        }//GEN-BEGIN:|78-getter|2|
        return guardarCommand;
    }
    //</editor-fold>//GEN-END:|78-getter|2|
    //</editor-fold>
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: configuracionForm ">//GEN-BEGIN:|75-getter|0|75-preInit
    /**
     * Returns an initiliazed instance of configuracionForm component.
     * @return the initialized component instance
     */
    public Form getConfiguracionForm() {
        if (configuracionForm == null) {//GEN-END:|75-getter|0|75-preInit
            // write pre-init user code here
            configuracionForm = new Form("Configuracion", new Item[] { getUserTF(), getPassTF(), getOpcionesCG(), getTweetsPorPaginaTF() });//GEN-BEGIN:|75-getter|1|75-postInit
            configuracionForm.addCommand(getGuardarCommand());
            configuracionForm.addCommand(getBackCommand());
            configuracionForm.setCommandListener(this);//GEN-END:|75-getter|1|75-postInit
            // write post-init user code here
        }//GEN-BEGIN:|75-getter|2|
        return configuracionForm;
    }
    //</editor-fold>//GEN-END:|75-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: userTF ">//GEN-BEGIN:|76-getter|0|76-preInit
    /**
     * Returns an initiliazed instance of userTF component.
     * @return the initialized component instance
     */
    public TextField getUserTF() {
        if (userTF == null) {//GEN-END:|76-getter|0|76-preInit
            // write pre-init user code here
            userTF = new TextField("Ususario", "", 32, TextField.ANY);//GEN-LINE:|76-getter|1|76-postInit
            // write post-init user code here
        }//GEN-BEGIN:|76-getter|2|
        return userTF;
    }
    //</editor-fold>//GEN-END:|76-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: passTF ">//GEN-BEGIN:|77-getter|0|77-preInit
    /**
     * Returns an initiliazed instance of passTF component.
     * @return the initialized component instance
     */
    public TextField getPassTF() {
        if (passTF == null) {//GEN-END:|77-getter|0|77-preInit
            // write pre-init user code here
            passTF = new TextField("Contrase\u00F1a", "", 32, TextField.ANY);//GEN-LINE:|77-getter|1|77-postInit
            // write post-init user code here
        }//GEN-BEGIN:|77-getter|2|
        return passTF;
    }
    //</editor-fold>//GEN-END:|77-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: tweetFrom ">//GEN-BEGIN:|80-getter|0|80-preInit
    /**
     * Returns an initiliazed instance of tweetFrom component.
     * @return the initialized component instance
     */
    public Form getTweetFrom() {
        if (tweetFrom == null) {//GEN-END:|80-getter|0|80-preInit
            // write pre-init user code here
            tweetFrom = new Form("Tweet", new Item[] { getTweetTF(), getCaracteresSI() });//GEN-BEGIN:|80-getter|1|80-postInit
            tweetFrom.addCommand(getPostTweetCommand());
            tweetFrom.setCommandListener(this);//GEN-END:|80-getter|1|80-postInit
            // write post-init user code here
        }//GEN-BEGIN:|80-getter|2|
        return tweetFrom;
    }
    //</editor-fold>//GEN-END:|80-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: tweetTF ">//GEN-BEGIN:|81-getter|0|81-preInit
    /**
     * Returns an initiliazed instance of tweetTF component.
     * @return the initialized component instance
     */
    public TextField getTweetTF() {
        if (tweetTF == null) {//GEN-END:|81-getter|0|81-preInit
            // write pre-init user code here
            tweetTF = new TextField("Nuevo Tweet", "", 500, TextField.ANY);//GEN-BEGIN:|81-getter|1|81-postInit
            tweetTF.setLayout(ImageItem.LAYOUT_DEFAULT);
            tweetTF.setPreferredSize(-1, -1);//GEN-END:|81-getter|1|81-postInit
            // write post-init user code here
        }//GEN-BEGIN:|81-getter|2|
        return tweetTF;
    }
    //</editor-fold>//GEN-END:|81-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: caracteresSI ">//GEN-BEGIN:|83-getter|0|83-preInit
    /**
     * Returns an initiliazed instance of caracteresSI component.
     * @return the initialized component instance
     */
    public StringItem getCaracteresSI() {
        if (caracteresSI == null) {//GEN-END:|83-getter|0|83-preInit
            // write pre-init user code here
            caracteresSI = new StringItem("Caracteres", "");//GEN-BEGIN:|83-getter|1|83-postInit
            caracteresSI.addCommand(getBackTweetCommand());
            caracteresSI.setItemCommandListener(this);
            caracteresSI.setLayout(ImageItem.LAYOUT_DEFAULT);//GEN-END:|83-getter|1|83-postInit
            // write post-init user code here
        }//GEN-BEGIN:|83-getter|2|
        return caracteresSI;
    }
    //</editor-fold>//GEN-END:|83-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: commandAction for Items ">//GEN-BEGIN:|17-itemCommandAction|0|17-preItemCommandAction
    /**
     * Called by a system to indicated that a command has been invoked on a particular item.
     * @param command the Command that was invoked
     * @param displayable the Item where the command was invoked
     */
    public void commandAction(Command command, Item item) {//GEN-END:|17-itemCommandAction|0|17-preItemCommandAction
        // write pre-action user code here
        if (item == caracteresSI) {//GEN-BEGIN:|17-itemCommandAction|1|88-preAction
            if (command == backTweetCommand) {//GEN-END:|17-itemCommandAction|1|88-preAction
                // write pre-action user code here
                switchToPreviousDisplayable();//GEN-LINE:|17-itemCommandAction|2|88-postAction
                // write post-action user code here
            }//GEN-BEGIN:|17-itemCommandAction|3|17-postItemCommandAction
        }//GEN-END:|17-itemCommandAction|3|17-postItemCommandAction
        // write post-action user code here
    }//GEN-BEGIN:|17-itemCommandAction|4|
    //</editor-fold>//GEN-END:|17-itemCommandAction|4|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: postTweetCommand ">//GEN-BEGIN:|85-getter|0|85-preInit
    /**
     * Returns an initiliazed instance of postTweetCommand component.
     * @return the initialized component instance
     */
    public Command getPostTweetCommand() {
        if (postTweetCommand == null) {//GEN-END:|85-getter|0|85-preInit
            // write pre-init user code here
            postTweetCommand = new Command("Tweet!", Command.ITEM, 0);//GEN-LINE:|85-getter|1|85-postInit
            // write post-init user code here
        }//GEN-BEGIN:|85-getter|2|
        return postTweetCommand;
    }
    //</editor-fold>//GEN-END:|85-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: backTweetCommand ">//GEN-BEGIN:|87-getter|0|87-preInit
    /**
     * Returns an initiliazed instance of backTweetCommand component.
     * @return the initialized component instance
     */
    public Command getBackTweetCommand() {
        if (backTweetCommand == null) {//GEN-END:|87-getter|0|87-preInit
            // write pre-init user code here
            backTweetCommand = new Command("Atras", Command.BACK, 0);//GEN-LINE:|87-getter|1|87-postInit
            // write post-init user code here
        }//GEN-BEGIN:|87-getter|2|
        return backTweetCommand;
    }
    //</editor-fold>//GEN-END:|87-getter|2|


    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: inicialForm ">//GEN-BEGIN:|92-getter|0|92-preInit
    /**
     * Returns an initiliazed instance of inicialForm component.
     * @return the initialized component instance
     */
    public Form getInicialForm() {
        if (inicialForm == null) {//GEN-END:|92-getter|0|92-preInit
            // write pre-init user code here
            inicialForm = new Form("Tweeter", new Item[] { getTweetsPendientesSI(), getUsuarioSI() });//GEN-BEGIN:|92-getter|1|92-postInit
            inicialForm.addCommand(getTweetCommand());
            inicialForm.addCommand(getCfgCommand());
            inicialForm.addCommand(getBuscarCommand());
            inicialForm.addCommand(getExplorarTweetsCommand());
            inicialForm.addCommand(getBusquedaAvanzadaCommand());
            inicialForm.setCommandListener(this);//GEN-END:|92-getter|1|92-postInit
            // write post-init user code here

        }//GEN-BEGIN:|92-getter|2|
        return inicialForm;
    }
    //</editor-fold>//GEN-END:|92-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: tweetsPendientesSI ">//GEN-BEGIN:|95-getter|0|95-preInit
    /**
     * Returns an initiliazed instance of tweetsPendientesSI component.
     * @return the initialized component instance
     */
    public StringItem getTweetsPendientesSI() {
        if (tweetsPendientesSI == null) {//GEN-END:|95-getter|0|95-preInit
            // write pre-init user code here
            tweetsPendientesSI = new StringItem("Tweets Pendientes", "");//GEN-LINE:|95-getter|1|95-postInit
            // write post-init user code here

        }//GEN-BEGIN:|95-getter|2|
        return tweetsPendientesSI;
    }
    //</editor-fold>//GEN-END:|95-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: usuarioSI ">//GEN-BEGIN:|96-getter|0|96-preInit
    /**
     * Returns an initiliazed instance of usuarioSI component.
     * @return the initialized component instance
     */
    public StringItem getUsuarioSI() {
        if (usuarioSI == null) {//GEN-END:|96-getter|0|96-preInit
            // write pre-init user code here
            usuarioSI = new StringItem("Usuario", "");//GEN-LINE:|96-getter|1|96-postInit
            // write post-init user code here
        }//GEN-BEGIN:|96-getter|2|
        return usuarioSI;
    }
    //</editor-fold>//GEN-END:|96-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: tweetCommand ">//GEN-BEGIN:|97-getter|0|97-preInit
    /**
     * Returns an initiliazed instance of tweetCommand component.
     * @return the initialized component instance
     */
    public Command getTweetCommand() {
        if (tweetCommand == null) {//GEN-END:|97-getter|0|97-preInit
            // write pre-init user code here
            tweetCommand = new Command("NuevoTweet", Command.ITEM, 0);//GEN-LINE:|97-getter|1|97-postInit
            // write post-init user code here
        }//GEN-BEGIN:|97-getter|2|
        return tweetCommand;
    }
    //</editor-fold>//GEN-END:|97-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: cfgCommand ">//GEN-BEGIN:|99-getter|0|99-preInit
    /**
     * Returns an initiliazed instance of cfgCommand component.
     * @return the initialized component instance
     */
    public Command getCfgCommand() {
        if (cfgCommand == null) {//GEN-END:|99-getter|0|99-preInit
            // write pre-init user code here
            cfgCommand = new Command("Configuracion", Command.ITEM, 0);//GEN-LINE:|99-getter|1|99-postInit
            // write post-init user code here
        }//GEN-BEGIN:|99-getter|2|
        return cfgCommand;
    }
    //</editor-fold>//GEN-END:|99-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: buscarCommand ">//GEN-BEGIN:|101-getter|0|101-preInit
    /**
     * Returns an initiliazed instance of buscarCommand component.
     * @return the initialized component instance
     */
    public Command getBuscarCommand() {
        if (buscarCommand == null) {//GEN-END:|101-getter|0|101-preInit
            // write pre-init user code here
            buscarCommand = new Command("Buscar", Command.ITEM, 0);//GEN-LINE:|101-getter|1|101-postInit
            // write post-init user code here
        }//GEN-BEGIN:|101-getter|2|
        return buscarCommand;
    }
    //</editor-fold>//GEN-END:|101-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: explorarTweetsCommand ">//GEN-BEGIN:|104-getter|0|104-preInit
    /**
     * Returns an initiliazed instance of explorarTweetsCommand component.
     * @return the initialized component instance
     */
    public Command getExplorarTweetsCommand() {
        if (explorarTweetsCommand == null) {//GEN-END:|104-getter|0|104-preInit
            // write pre-init user code here
            explorarTweetsCommand = new Command("Ver Tweets pendientes", Command.ITEM, 0);//GEN-LINE:|104-getter|1|104-postInit
            // write post-init user code here
        }//GEN-BEGIN:|104-getter|2|
        return explorarTweetsCommand;
    }
    //</editor-fold>//GEN-END:|104-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: buscarTagCommand ">//GEN-BEGIN:|108-getter|0|108-preInit
    /**
     * Returns an initiliazed instance of buscarTagCommand component.
     * @return the initialized component instance
     */
    public Command getBuscarTagCommand() {
        if (buscarTagCommand == null) {//GEN-END:|108-getter|0|108-preInit
            // write pre-init user code here
            buscarTagCommand = new Command("Buscar Tag", Command.ITEM, 0);//GEN-LINE:|108-getter|1|108-postInit
            // write post-init user code here
        }//GEN-BEGIN:|108-getter|2|
        return buscarTagCommand;
    }
    //</editor-fold>//GEN-END:|108-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: buscarContenidoCommand ">//GEN-BEGIN:|110-getter|0|110-preInit
    /**
     * Returns an initiliazed instance of buscarContenidoCommand component.
     * @return the initialized component instance
     */
    public Command getBuscarContenidoCommand() {
        if (buscarContenidoCommand == null) {//GEN-END:|110-getter|0|110-preInit
            // write pre-init user code here
            buscarContenidoCommand = new Command("Buscar Contenido", Command.ITEM, 0);//GEN-LINE:|110-getter|1|110-postInit
            // write post-init user code here
        }//GEN-BEGIN:|110-getter|2|
        return buscarContenidoCommand;
    }
    //</editor-fold>//GEN-END:|110-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: buscarAutorCommand ">//GEN-BEGIN:|112-getter|0|112-preInit
    /**
     * Returns an initiliazed instance of buscarAutorCommand component.
     * @return the initialized component instance
     */
    public Command getBuscarAutorCommand() {
        if (buscarAutorCommand == null) {//GEN-END:|112-getter|0|112-preInit
            // write pre-init user code here
            buscarAutorCommand = new Command("Buscar Autor", Command.ITEM, 0);//GEN-LINE:|112-getter|1|112-postInit
            // write post-init user code here
        }//GEN-BEGIN:|112-getter|2|
        return buscarAutorCommand;
    }
    //</editor-fold>//GEN-END:|112-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: siguientePaginaCommand ">//GEN-BEGIN:|115-getter|0|115-preInit
    /**
     * Returns an initiliazed instance of siguientePaginaCommand component.
     * @return the initialized component instance
     */
    public Command getSiguientePaginaCommand() {
        if (siguientePaginaCommand == null) {//GEN-END:|115-getter|0|115-preInit
            // write pre-init user code here
            siguientePaginaCommand = new Command("Siguiente", Command.ITEM, 0);//GEN-LINE:|115-getter|1|115-postInit
            // write post-init user code here
        }//GEN-BEGIN:|115-getter|2|
        return siguientePaginaCommand;
    }
    //</editor-fold>//GEN-END:|115-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: buscarForm ">//GEN-BEGIN:|106-getter|0|106-preInit
    /**
     * Returns an initiliazed instance of buscarForm component.
     * @return the initialized component instance
     */
    public Form getBuscarForm() {
        if (buscarForm == null) {//GEN-END:|106-getter|0|106-preInit
            // write pre-init user code here
            buscarForm = new Form("Buscar", new Item[] { getBuscarTF() });//GEN-BEGIN:|106-getter|1|106-postInit
            buscarForm.addCommand(getBuscarContenidoCommand());
            buscarForm.addCommand(getBuscarTagCommand());
            buscarForm.addCommand(getBuscarAutorCommand());
            buscarForm.addCommand(getBackCommand());
            buscarForm.setCommandListener(this);//GEN-END:|106-getter|1|106-postInit
            // write post-init user code here
        }//GEN-BEGIN:|106-getter|2|
        return buscarForm;
    }
    //</editor-fold>//GEN-END:|106-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: buscarTF ">//GEN-BEGIN:|114-getter|0|114-preInit
    /**
     * Returns an initiliazed instance of buscarTF component.
     * @return the initialized component instance
     */
    public TextField getBuscarTF() {
        if (buscarTF == null) {//GEN-END:|114-getter|0|114-preInit
            // write pre-init user code here
            buscarTF = new TextField("Buscar", "", 140, TextField.ANY);//GEN-LINE:|114-getter|1|114-postInit
            // write post-init user code here
        }//GEN-BEGIN:|114-getter|2|
        return buscarTF;
    }
    //</editor-fold>//GEN-END:|114-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: backCommand ">//GEN-BEGIN:|124-getter|0|124-preInit
    /**
     * Returns an initiliazed instance of backCommand component.
     * @return the initialized component instance
     */
    public Command getBackCommand() {
        if (backCommand == null) {//GEN-END:|124-getter|0|124-preInit
            // write pre-init user code here
            backCommand = new Command("Back", Command.BACK, 0);//GEN-LINE:|124-getter|1|124-postInit
            // write post-init user code here
        }//GEN-BEGIN:|124-getter|2|
        return backCommand;
    }
    //</editor-fold>//GEN-END:|124-getter|2|
    //</editor-fold>
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: resultadosList ">//GEN-BEGIN:|120-getter|0|120-preInit
    /**
     * Returns an initiliazed instance of resultadosList component.
     * @return the initialized component instance
     */
    public List getResultadosList() {
        if (resultadosList == null) {//GEN-END:|120-getter|0|120-preInit
            // write pre-init user code here
            resultadosList = new List("Resultados", Choice.MULTIPLE);//GEN-BEGIN:|120-getter|1|120-postInit
            resultadosList.addCommand(getSiguientePaginaCommand());
            resultadosList.addCommand(getReTweetCommand());
            resultadosList.addCommand(getBackCommand());
            resultadosList.addCommand(getMailTweetCommand());
            resultadosList.setCommandListener(this);//GEN-END:|120-getter|1|120-postInit
            // write post-init user code here
        }//GEN-BEGIN:|120-getter|2|
        return resultadosList;
    }
    //</editor-fold>//GEN-END:|120-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: resultadosListAction ">//GEN-BEGIN:|120-action|0|120-preAction
    /**
     * Performs an action assigned to the selected list element in the resultadosList component.
     */
    public void resultadosListAction() {//GEN-END:|120-action|0|120-preAction
        // enter pre-action user code here
        String __selectedString = getResultadosList().getString(getResultadosList().getSelectedIndex());//GEN-LINE:|120-action|1|120-postAction
        // enter post-action user code here
    }//GEN-BEGIN:|120-action|2|
    //</editor-fold>//GEN-END:|120-action|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: reTweetCommand ">//GEN-BEGIN:|126-getter|0|126-preInit
    /**
     * Returns an initiliazed instance of reTweetCommand component.
     * @return the initialized component instance
     */
    public Command getReTweetCommand() {
        if (reTweetCommand == null) {//GEN-END:|126-getter|0|126-preInit
            // write pre-init user code here
            reTweetCommand = new Command("ReTweet", Command.ITEM, 0);//GEN-LINE:|126-getter|1|126-postInit
            // write post-init user code here
        }//GEN-BEGIN:|126-getter|2|
        return reTweetCommand;
    }
    //</editor-fold>//GEN-END:|126-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: tweetsPendientesList ">//GEN-BEGIN:|143-getter|0|143-preInit
    /**
     * Returns an initiliazed instance of tweetsPendientesList component.
     * @return the initialized component instance
     */
    public List getTweetsPendientesList() {
        if (tweetsPendientesList == null) {//GEN-END:|143-getter|0|143-preInit
            // write pre-init user code here
            tweetsPendientesList = new List("list", Choice.IMPLICIT);//GEN-BEGIN:|143-getter|1|143-postInit
            tweetsPendientesList.addCommand(getBackCommand());
            tweetsPendientesList.addCommand(getTweetPendienteCommand());
            tweetsPendientesList.addCommand(getEditarCommand());
            tweetsPendientesList.addCommand(getEliminarCommand());
            tweetsPendientesList.setCommandListener(this);//GEN-END:|143-getter|1|143-postInit
            // write post-init user code here
        }//GEN-BEGIN:|143-getter|2|
        return tweetsPendientesList;
    }
    //</editor-fold>//GEN-END:|143-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: tweetsPendientesListAction ">//GEN-BEGIN:|143-action|0|143-preAction
    /**
     * Performs an action assigned to the selected list element in the tweetsPendientesList component.
     */
    public void tweetsPendientesListAction() {//GEN-END:|143-action|0|143-preAction
        // enter pre-action user code here
        String __selectedString = getTweetsPendientesList().getString(getTweetsPendientesList().getSelectedIndex());//GEN-LINE:|143-action|1|143-postAction
        // enter post-action user code here
    }//GEN-BEGIN:|143-action|2|
    //</editor-fold>//GEN-END:|143-action|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: editarCommand ">//GEN-BEGIN:|159-getter|0|159-preInit
    /**
     * Returns an initiliazed instance of editarCommand component.
     * @return the initialized component instance
     */
    public Command getEditarCommand() {
        if (editarCommand == null) {//GEN-END:|159-getter|0|159-preInit
            // write pre-init user code here
            editarCommand = new Command("Editar", Command.ITEM, 0);//GEN-LINE:|159-getter|1|159-postInit
            // write post-init user code here
        }//GEN-BEGIN:|159-getter|2|
        return editarCommand;
    }
    //</editor-fold>//GEN-END:|159-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: eliminarCommand ">//GEN-BEGIN:|163-getter|0|163-preInit
    /**
     * Returns an initiliazed instance of eliminarCommand component.
     * @return the initialized component instance
     */
    public Command getEliminarCommand() {
        if (eliminarCommand == null) {//GEN-END:|163-getter|0|163-preInit
            // write pre-init user code here
            eliminarCommand = new Command("Eliminar", Command.ITEM, 0);//GEN-LINE:|163-getter|1|163-postInit
            // write post-init user code here
        }//GEN-BEGIN:|163-getter|2|
        return eliminarCommand;
    }
    //</editor-fold>//GEN-END:|163-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: tweetPendienteCommand ">//GEN-BEGIN:|166-getter|0|166-preInit
    /**
     * Returns an initiliazed instance of tweetPendienteCommand component.
     * @return the initialized component instance
     */
    public Command getTweetPendienteCommand() {
        if (tweetPendienteCommand == null) {//GEN-END:|166-getter|0|166-preInit
            // write pre-init user code here
            tweetPendienteCommand = new Command("Tweet", Command.ITEM, 0);//GEN-LINE:|166-getter|1|166-postInit
            // write post-init user code here
        }//GEN-BEGIN:|166-getter|2|
        return tweetPendienteCommand;
    }
    //</editor-fold>//GEN-END:|166-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: editarPendienteForm ">//GEN-BEGIN:|150-getter|0|150-preInit
    /**
     * Returns an initiliazed instance of editarPendienteForm component.
     * @return the initialized component instance
     */
    public Form getEditarPendienteForm() {
        if (editarPendienteForm == null) {//GEN-END:|150-getter|0|150-preInit
            // write pre-init user code here
            editarPendienteForm = new Form("form", new Item[] { getEditarTweetTF() });//GEN-BEGIN:|150-getter|1|150-postInit
            editarPendienteForm.addCommand(getBackCommand());
            editarPendienteForm.addCommand(getPostTweetCommand());
            editarPendienteForm.setCommandListener(this);//GEN-END:|150-getter|1|150-postInit
            // write post-init user code here
        }//GEN-BEGIN:|150-getter|2|
        return editarPendienteForm;
    }
    //</editor-fold>//GEN-END:|150-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: editarTweetTF ">//GEN-BEGIN:|154-getter|0|154-preInit
    /**
     * Returns an initiliazed instance of editarTweetTF component.
     * @return the initialized component instance
     */
    public TextField getEditarTweetTF() {
        if (editarTweetTF == null) {//GEN-END:|154-getter|0|154-preInit
            // write pre-init user code here
            editarTweetTF = new TextField("Tweet", "", 32, TextField.ANY);//GEN-LINE:|154-getter|1|154-postInit
            // write post-init user code here
        }//GEN-BEGIN:|154-getter|2|
        return editarTweetTF;
    }
    //</editor-fold>//GEN-END:|154-getter|2|
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: opcionesCG ">//GEN-BEGIN:|175-getter|0|175-preInit
    /**
     * Returns an initiliazed instance of opcionesCG component.
     * @return the initialized component instance
     */
    public ChoiceGroup getOpcionesCG() {
        if (opcionesCG == null) {//GEN-END:|175-getter|0|175-preInit
            // write pre-init user code here
            opcionesCG = new ChoiceGroup("Opciones", Choice.MULTIPLE);//GEN-BEGIN:|175-getter|1|175-postInit
            opcionesCG.append("Enviar Tweets Automaticamente", null);
            opcionesCG.append("Truncar Tweets de mas de 140 caracteres", null);
            opcionesCG.setSelectedFlags(new boolean[] { false, false });//GEN-END:|175-getter|1|175-postInit
            // write post-init user code here
        }//GEN-BEGIN:|175-getter|2|
        return opcionesCG;
    }
    //</editor-fold>//GEN-END:|175-getter|2|
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: tweetsPorPaginaTF ">//GEN-BEGIN:|178-getter|0|178-preInit
    /**
     * Returns an initiliazed instance of tweetsPorPaginaTF component.
     * @return the initialized component instance
     */
    public TextField getTweetsPorPaginaTF() {
        if (tweetsPorPaginaTF == null) {//GEN-END:|178-getter|0|178-preInit
            // write pre-init user code here
            tweetsPorPaginaTF = new TextField("Tweets por Pagina", "", 6, TextField.NUMERIC);//GEN-LINE:|178-getter|1|178-postInit
            // write post-init user code here
        }//GEN-BEGIN:|178-getter|2|
        return tweetsPorPaginaTF;
    }
    //</editor-fold>//GEN-END:|178-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: salirCommand ">//GEN-BEGIN:|185-getter|0|185-preInit
    /**
     * Returns an initiliazed instance of salirCommand component.
     * @return the initialized component instance
     */
    public Command getSalirCommand() {
        if (salirCommand == null) {//GEN-END:|185-getter|0|185-preInit
            // write pre-init user code here
            salirCommand = new Command("Salir", Command.ITEM, 0);//GEN-LINE:|185-getter|1|185-postInit
            // write post-init user code here
        }//GEN-BEGIN:|185-getter|2|
        return salirCommand;
    }
    //</editor-fold>//GEN-END:|185-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: busquedaAvanzadaCommand ">//GEN-BEGIN:|206-getter|0|206-preInit
    /**
     * Returns an initiliazed instance of busquedaAvanzadaCommand component.
     * @return the initialized component instance
     */
    public Command getBusquedaAvanzadaCommand() {
        if (busquedaAvanzadaCommand == null) {//GEN-END:|206-getter|0|206-preInit
            // write pre-init user code here
            busquedaAvanzadaCommand = new Command("Busqueda avanzada", Command.ITEM, 0);//GEN-LINE:|206-getter|1|206-postInit
            // write post-init user code here
        }//GEN-BEGIN:|206-getter|2|
        return busquedaAvanzadaCommand;
    }
    //</editor-fold>//GEN-END:|206-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: avancedSearchForm ">//GEN-BEGIN:|186-getter|0|186-preInit
    /**
     * Returns an initiliazed instance of avancedSearchForm component.
     * @return the initialized component instance
     */
    public Form getAvancedSearchForm() {
        if (avancedSearchForm == null) {//GEN-END:|186-getter|0|186-preInit
            // write pre-init user code here
            avancedSearchForm = new Form("Busqueda Avanzada", new Item[] { getBuscarAvanzadaTF(), getTipoBusquedaCG(), getTagBusquedaTF(), getDeTF(), getReferenciaTF(), getParaTF(), getDesdeDF(), getHastaDF(), getDesdeHastaCG() });//GEN-BEGIN:|186-getter|1|186-postInit
            avancedSearchForm.addCommand(getBackCommand());
            avancedSearchForm.addCommand(getBuscarAvanzadaCommand());
            avancedSearchForm.setCommandListener(this);//GEN-END:|186-getter|1|186-postInit
            // write post-init user code here
        }//GEN-BEGIN:|186-getter|2|
        return avancedSearchForm;
    }
    //</editor-fold>//GEN-END:|186-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: buscarAvanzadaTF ">//GEN-BEGIN:|187-getter|0|187-preInit
    /**
     * Returns an initiliazed instance of buscarAvanzadaTF component.
     * @return the initialized component instance
     */
    public TextField getBuscarAvanzadaTF() {
        if (buscarAvanzadaTF == null) {//GEN-END:|187-getter|0|187-preInit
            // write pre-init user code here
            buscarAvanzadaTF = new TextField("Buscar", "", 32, TextField.ANY);//GEN-LINE:|187-getter|1|187-postInit
            // write post-init user code here
        }//GEN-BEGIN:|187-getter|2|
        return buscarAvanzadaTF;
    }
    //</editor-fold>//GEN-END:|187-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: tipoBusquedaCG ">//GEN-BEGIN:|188-getter|0|188-preInit
    /**
     * Returns an initiliazed instance of tipoBusquedaCG component.
     * @return the initialized component instance
     */
    public ChoiceGroup getTipoBusquedaCG() {
        if (tipoBusquedaCG == null) {//GEN-END:|188-getter|0|188-preInit
            // write pre-init user code here
            tipoBusquedaCG = new ChoiceGroup("Tipo de Busqueda", Choice.EXCLUSIVE);//GEN-BEGIN:|188-getter|1|188-postInit
            tipoBusquedaCG.append("Todo", null);
            tipoBusquedaCG.append("Cualquiera", null);
            tipoBusquedaCG.append("Exacto", null);
            tipoBusquedaCG.append("Ninguna", null);
            tipoBusquedaCG.setSelectedFlags(new boolean[] { false, true, false, false });//GEN-END:|188-getter|1|188-postInit
            // write post-init user code here
        }//GEN-BEGIN:|188-getter|2|
        return tipoBusquedaCG;
    }
    //</editor-fold>//GEN-END:|188-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: deTF ">//GEN-BEGIN:|194-getter|0|194-preInit
    /**
     * Returns an initiliazed instance of deTF component.
     * @return the initialized component instance
     */
    public TextField getDeTF() {
        if (deTF == null) {//GEN-END:|194-getter|0|194-preInit
            // write pre-init user code here
            deTF = new TextField("De", "", 32, TextField.ANY);//GEN-LINE:|194-getter|1|194-postInit
            // write post-init user code here
        }//GEN-BEGIN:|194-getter|2|
        return deTF;
    }
    //</editor-fold>//GEN-END:|194-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: referenciaTF ">//GEN-BEGIN:|195-getter|0|195-preInit
    /**
     * Returns an initiliazed instance of referenciaTF component.
     * @return the initialized component instance
     */
    public TextField getReferenciaTF() {
        if (referenciaTF == null) {//GEN-END:|195-getter|0|195-preInit
            // write pre-init user code here
            referenciaTF = new TextField("Referencia a", "", 32, TextField.ANY);//GEN-LINE:|195-getter|1|195-postInit
            // write post-init user code here
        }//GEN-BEGIN:|195-getter|2|
        return referenciaTF;
    }
    //</editor-fold>//GEN-END:|195-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: paraTF ">//GEN-BEGIN:|196-getter|0|196-preInit
    /**
     * Returns an initiliazed instance of paraTF component.
     * @return the initialized component instance
     */
    public TextField getParaTF() {
        if (paraTF == null) {//GEN-END:|196-getter|0|196-preInit
            // write pre-init user code here
            paraTF = new TextField("Para", "", 32, TextField.ANY);//GEN-LINE:|196-getter|1|196-postInit
            // write post-init user code here
        }//GEN-BEGIN:|196-getter|2|
        return paraTF;
    }
    //</editor-fold>//GEN-END:|196-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: desdeDF ">//GEN-BEGIN:|197-getter|0|197-preInit
    /**
     * Returns an initiliazed instance of desdeDF component.
     * @return the initialized component instance
     */
    public DateField getDesdeDF() {
        if (desdeDF == null) {//GEN-END:|197-getter|0|197-preInit
            // write pre-init user code here
            desdeDF = new DateField("Desde", DateField.DATE);//GEN-BEGIN:|197-getter|1|197-postInit
            desdeDF.setDate(new java.util.Date(System.currentTimeMillis()));//GEN-END:|197-getter|1|197-postInit
            // write post-init user code here
        }//GEN-BEGIN:|197-getter|2|
        return desdeDF;
    }
    //</editor-fold>//GEN-END:|197-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: hastaDF ">//GEN-BEGIN:|198-getter|0|198-preInit
    /**
     * Returns an initiliazed instance of hastaDF component.
     * @return the initialized component instance
     */
    public DateField getHastaDF() {
        if (hastaDF == null) {//GEN-END:|198-getter|0|198-preInit
            // write pre-init user code here
            hastaDF = new DateField("Hasta:", DateField.DATE);//GEN-BEGIN:|198-getter|1|198-postInit
            hastaDF.setDate(new java.util.Date(System.currentTimeMillis()));//GEN-END:|198-getter|1|198-postInit
            // write post-init user code here
        }//GEN-BEGIN:|198-getter|2|
        return hastaDF;
    }
    //</editor-fold>//GEN-END:|198-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: tagBusquedaTF ">//GEN-BEGIN:|199-getter|0|199-preInit
    /**
     * Returns an initiliazed instance of tagBusquedaTF component.
     * @return the initialized component instance
     */
    public TextField getTagBusquedaTF() {
        if (tagBusquedaTF == null) {//GEN-END:|199-getter|0|199-preInit
            // write pre-init user code here
            tagBusquedaTF = new TextField("Tag", "", 32, TextField.ANY);//GEN-LINE:|199-getter|1|199-postInit
            // write post-init user code here
        }//GEN-BEGIN:|199-getter|2|
        return tagBusquedaTF;
    }
    //</editor-fold>//GEN-END:|199-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: desdeHastaCG ">//GEN-BEGIN:|200-getter|0|200-preInit
    /**
     * Returns an initiliazed instance of desdeHastaCG component.
     * @return the initialized component instance
     */
    public ChoiceGroup getDesdeHastaCG() {
        if (desdeHastaCG == null) {//GEN-END:|200-getter|0|200-preInit
            // write pre-init user code here
            desdeHastaCG = new ChoiceGroup("Fechas", Choice.MULTIPLE);//GEN-BEGIN:|200-getter|1|200-postInit
            desdeHastaCG.append("Desde", null);
            desdeHastaCG.append("Hasta", null);
            desdeHastaCG.setSelectedFlags(new boolean[] { false, false });//GEN-END:|200-getter|1|200-postInit
            // write post-init user code here
        }//GEN-BEGIN:|200-getter|2|
        return desdeHastaCG;
    }
    //</editor-fold>//GEN-END:|200-getter|2|
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: buscarAvanzadaCommand ">//GEN-BEGIN:|211-getter|0|211-preInit
    /**
     * Returns an initiliazed instance of buscarAvanzadaCommand component.
     * @return the initialized component instance
     */
    public Command getBuscarAvanzadaCommand() {
        if (buscarAvanzadaCommand == null) {//GEN-END:|211-getter|0|211-preInit
            // write pre-init user code here
            buscarAvanzadaCommand = new Command("Buscar", Command.ITEM, 0);//GEN-LINE:|211-getter|1|211-postInit
            // write post-init user code here
        }//GEN-BEGIN:|211-getter|2|
        return buscarAvanzadaCommand;
    }
    //</editor-fold>//GEN-END:|211-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: alerta ">//GEN-BEGIN:|214-getter|0|214-preInit
    /**
     * Returns an initiliazed instance of alerta component.
     * @return the initialized component instance
     */
    public Alert getAlerta() {
        if (alerta == null) {//GEN-END:|214-getter|0|214-preInit
            // write pre-init user code here
            alerta = new Alert("alert", "<null>", null, null);//GEN-BEGIN:|214-getter|1|214-postInit
            alerta.setTimeout(2000);//GEN-END:|214-getter|1|214-postInit
            // write post-init user code here
        }//GEN-BEGIN:|214-getter|2|
        return alerta;
    }
    //</editor-fold>//GEN-END:|214-getter|2|



    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: mailTweetCommand ">//GEN-BEGIN:|221-getter|0|221-preInit
    /**
     * Returns an initiliazed instance of mailTweetCommand component.
     * @return the initialized component instance
     */
    public Command getMailTweetCommand() {
        if (mailTweetCommand == null) {//GEN-END:|221-getter|0|221-preInit
            // write pre-init user code here
            mailTweetCommand = new Command("Enviar por mail", Command.ITEM, 0);//GEN-LINE:|221-getter|1|221-postInit
            // write post-init user code here
        }//GEN-BEGIN:|221-getter|2|
        return mailTweetCommand;
    }
    //</editor-fold>//GEN-END:|221-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: enviarMailForm ">//GEN-BEGIN:|225-getter|0|225-preInit
    /**
     * Returns an initiliazed instance of enviarMailForm component.
     * @return the initialized component instance
     */
    public Form getEnviarMailForm() {
        if (enviarMailForm == null) {//GEN-END:|225-getter|0|225-preInit
            // write pre-init user code here
            enviarMailForm = new Form("Enviar por Mail", new Item[] { getEMailTF() });//GEN-BEGIN:|225-getter|1|225-postInit
            enviarMailForm.addCommand(getEnviarMailCommand());
            enviarMailForm.addCommand(getBackCommand());
            enviarMailForm.setCommandListener(this);//GEN-END:|225-getter|1|225-postInit
            // write post-init user code here
        }//GEN-BEGIN:|225-getter|2|
        return enviarMailForm;
    }
    //</editor-fold>//GEN-END:|225-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: enviarMailCommand ">//GEN-BEGIN:|227-getter|0|227-preInit
    /**
     * Returns an initiliazed instance of enviarMailCommand component.
     * @return the initialized component instance
     */
    public Command getEnviarMailCommand() {
        if (enviarMailCommand == null) {//GEN-END:|227-getter|0|227-preInit
            // write pre-init user code here
            enviarMailCommand = new Command("Enviar", Command.ITEM, 0);//GEN-LINE:|227-getter|1|227-postInit
            // write post-init user code here
        }//GEN-BEGIN:|227-getter|2|
        return enviarMailCommand;
    }
    //</editor-fold>//GEN-END:|227-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: eMailTF ">//GEN-BEGIN:|226-getter|0|226-preInit
    /**
     * Returns an initiliazed instance of eMailTF component.
     * @return the initialized component instance
     */
    public TextField getEMailTF() {
        if (eMailTF == null) {//GEN-END:|226-getter|0|226-preInit
            // write pre-init user code here
            eMailTF = new TextField("eMail", "", 32, TextField.ANY);//GEN-LINE:|226-getter|1|226-postInit
            // write post-init user code here
        }//GEN-BEGIN:|226-getter|2|
        return eMailTF;
    }
    //</editor-fold>//GEN-END:|226-getter|2|

    /**
     * Returns a display instance.
     * @return the display instance.
     */
    public Display getDisplay() {
        return Display.getDisplay(this);
    }

    /**
     * Exits MIDlet.
     */
    public void exitMIDlet() {
        switchDisplayable(null, null);
        destroyApp(true);
        notifyDestroyed();
    }

    /**
     * Called when MIDlet is started.
     * Checks whether the MIDlet have been already started and initialize/starts or resumes the MIDlet.
     */
    public void startApp() {
        if (facade == null) {
            facade = new TweeterFacade();
          
        }
        if (midletPaused) {
            resumeMIDlet();
        } else {
            initialize();
            startMIDlet();
        }
        midletPaused = false;
        ItemStateListener itmListener = new ItemStateListener() {

            public void itemStateChanged(Item item) {
                try {
                    getCaracteresSI().setText(Integer.toString(tweetTF.getString().length()));
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        };
        getTweetFrom().setItemStateListener(itmListener);

    }

    /**
     * Called when MIDlet is paused.
     */
    public void pauseApp() {
        midletPaused = true;
        facade = null;
      
    }

    /**
     * Called to signal the MIDlet to terminate.
     * @param unconditional if true, then the MIDlet has to be unconditionally terminated and all resources has to be released.
     */
    public void destroyApp(boolean unconditional) {
        facade.cerrarConfiguracion();
        facade = null;
    }
    /*
     * *********METODOS MIOS******************
     */
    private TweeterFacade facade;
    private Tweet[] resultados;
    private dbtweets.Tweet[] pendientes;
    private Tweet[] tweetsMail;
    private int editando;
  

    public void tweet() {

        boolean b = facade.tweet(tweetTF.getString());
        System.out.println("*************" + b + "*********************");

    }

    public void login() {
        if (!facade.credencialesValidas()) {
            //  while(!facade.setCredenciales(userTF.getString(),passTF.getString())){
            // }
        }
    }

    public void buscarAutor() {
        resultados = facade.buscarAutor(getBuscarTF().getString());
        this.switchDisplayable(null, armarListaBuscar(resultados));

    }

    public void buscarContenido() {
        resultados = facade.buscarContenido(getBuscarTF().getString());
        this.switchDisplayable(null, armarListaBuscar(resultados));

    }

    public void buscarTag() {
        resultados = facade.buscarTag(getBuscarTF().getString());
        this.switchDisplayable(null, armarListaBuscar(resultados));

    }

    public void buscarAvanzada() {
        Object[] criteria = new Object[10];
        boolean[] flags = new boolean[4];

        getTipoBusquedaCG().getSelectedFlags(flags);
        for (int i = 0; i < flags.length; i++) {
            switch (i) {
                case 0:
                    if(flags[i]){
                    criteria[0] = getBuscarAvanzadaTF().getString();
                    }
                    break;
                case 1:
                    if(flags[i]){
                    criteria[1] = getBuscarAvanzadaTF().getString();
                    }
                    break;
                case 2:
                    if(flags[i]){
                    criteria[2] = getBuscarAvanzadaTF().getString();
                    }
                    break;
                case 3:
                    if(flags[i]){
                    criteria[4] = getBuscarAvanzadaTF().getString();
                    }
                    break;
            }
        }
        criteria[3] = getTagBusquedaTF().getString();
        criteria[5] = getDeTF().getString();
        criteria[6] = getReferenciaTF().getString();
        criteria[8] = getParaTF().getString();
        flags = new boolean[2];
        getDesdeHastaCG().getSelectedFlags(flags);
        if (flags[0]) {
            criteria[7] = getDesdeDF().getDate();
        }
        if (flags[1]) {
            criteria[9] = getHastaDF().getDate();
        }
        resultados = facade.buscarAvanzada(criteria);
        this.switchDisplayable(null, armarListaBuscar(resultados));

    }

    public void buscarSiguientePagina() {
        resultados = facade.buscarSiguientePagina();
        this.switchDisplayable(null, armarListaBuscar(resultados));
    }

    private List armarListaBuscar(Tweet[] tweets) {
        List l = getResultadosList();
        l.deleteAll();
        for (int i = 0; i < tweets.length; i++) {
            l.append(tweets[i].getString(MetadataSet.TWEET_AUTHOR_USERNAME) + ": " + tweets[i].getString(MetadataSet.TWEET_CONTENT), null);
        }

        return l;

    }

    public void verTweetsPendientes() {
        pendientes = facade.getTweetsSalvados();
        this.switchDisplayable(null, armarListaPendientes(pendientes));
    }

    private List armarListaPendientes(dbtweets.Tweet[] tweets) {
        List l = getTweetsPendientesList();
        l.deleteAll();
        for (int i = 0; i < tweets.length; i++) {
            l.append((i + 1) + ". " + tweets[i].getContenido(), null);
        }

        return l;

    }

    public void reTweet() {
        try {
            boolean[] selecteds = new boolean[resultados.length];
            getResultadosList().getSelectedFlags(selecteds);
            for (int i = 0; i < resultados.length; i++) {
                if (selecteds[i]) {
                    facade.reTweet(resultados[i]);
                }
            }

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    public void marcarTweetParaMail() {
        try {
            int cant=0;
            boolean[] selecteds = new boolean[resultados.length];
            getResultadosList().getSelectedFlags(selecteds);
            for (int i = 0; i < resultados.length; i++) {
                if (selecteds[i]) {
                    cant ++;
                }
            }
           tweetsMail= new Tweet[cant];
           cant=0;
           for (int i = 0; i < resultados.length; i++) {
                if (selecteds[i]) {
                    tweetsMail[cant]=resultados[i];
                    cant ++;
                }
            }

            switchDisplayable(null, getEnviarMailForm());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    public void enviarTweetPorMail() {
       boolean ret=true;
           for (int i = 0; i < tweetsMail.length; i++) {
              ret&= facade.enviarCorreo(tweetsMail[i],getEMailTF().getString());

            }
       String msg;
            if(ret){
                msg="Los mensajes se enviaron correctamente";
            }else{
                msg="Los mensajes no se enviaron correctamente";
            }
            switchDisplayable(alertar("eMail", msg), getEnviarMailForm());

    }

    public void tweetPendiente() {
        facade.eliminarTweetSalvado(pendientes[getTweetsPendientesList().getSelectedIndex()]);
        facade.tweet(pendientes[getTweetsPendientesList().getSelectedIndex()].getContenido());
        verTweetsPendientes();
    }

    public void eliminarPendiente() {
        facade.eliminarTweetSalvado(pendientes[getTweetsPendientesList().getSelectedIndex()]);
        verTweetsPendientes();
    }

    public void editarPendiente() {
        editando = getTweetsPendientesList().getSelectedIndex();
        getEditarTweetTF().setString(pendientes[editando].getContenido());
        this.switchDisplayable(null, getEditarPendienteForm());

    }

    public void salvarPendienteYVolver() {
        pendientes[editando].setContenido(getEditarTweetTF().getString());
        facade.salvarTweetEditado(pendientes[editando]);
        verTweetsPendientes();
    }

    public void enviarTweetEditado() {
        facade.eliminarTweetSalvado(pendientes[editando]);
        facade.tweet(pendientes[editando].getContenido());
        verTweetsPendientes();
    }

    public void salvarConfiguracion() {
        facade.setUsuario(getUserTF().getString());
        facade.setContrasena(getPassTF().getString());
        boolean[] sf = new boolean[2];
        getOpcionesCG().getSelectedFlags(sf);
        facade.setAutoSend(sf[0]);
        facade.setTruncarTweets(sf[1]);

        facade.setTweetsPagina(Integer.parseInt(getTweetsPorPaginaTF().getString()));
        facade.guardarConfiguracion();
        this.switchDisplayable(alertar("Configuracion", "La configuracion se ha guardado correctamente"), getInicialForm());
    }
    private Alert alertar(String titulo, String contenido){
        getAlerta().setTitle(titulo);
        getAlerta().setString(contenido);
        return alerta;
    }
}
TOP

Related Classes of midlets.TwiterMidlet

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.