Package javax.microedition.lcdui

Examples of javax.microedition.lcdui.Gauge


    final private void initializeBookmarkList() {
    //#ifdef DTEST
    System.gc();
    long beginMem = Runtime.getRuntime().freeMemory();
    //#endif
    Gauge gauge = new Gauge(ResourceProviderME.get("label.init.b"),
        false, m_settings.MAX_REGIONS, 0);
    int pl = m_loadForm.append(gauge);
        try {
            m_bookmarkList = new PromptList(this, "Bookmarks", List.IMPLICIT);
      updBookmarkList();
            m_bookmarkList.setCommandListener( this );
      //#ifdef DTEST
      System.gc();
      System.out.println("empty bookmarkList size=" + (beginMem - Runtime.getRuntime().freeMemory()));
      //#endif
           
            int i = 1;
           
            final boolean saveMemoryEnabled =
          m_appSettings.getSaveMemoryEnabled();
            m_rssFeeds = new RssFeedStore(saveMemoryEnabled);
      for (int ic = 1; ic < m_settings.MAX_REGIONS; ic++) {
        boolean stop = false;
        final String vers = m_settings.getStringProperty(ic,
            m_settings.SETTINGS_NAME, "");
        final boolean firstSettings =
           vers.equals(m_settings.FIRST_SETTINGS_VERS);
        final boolean itunesCapable = ((vers.length() > 0) &&
           (vers.compareTo(m_settings.ITUNES_CAPABLE_VERS) >= 0));
        final boolean latestSettings = vers.equals(
            m_settings.ENCODING_VERS);
        final boolean itemsEncoded =
          m_settings.getBooleanProperty(m_settings.ITEMS_ENCODED,
              true);
        final long storeDate = m_settings.getLongProperty(
            m_settings.STORE_DATE, 0L);
        final char feedSeparator =
          latestSettings ? CFEED_SEPARATOR : OLD_FEED_SEPARATOR;
        //#ifdef DLOGGING
        if (fineLoggable) {logger.fine("Settings region,vers,firstSettings,itunescapable,latestSettings,itemsEncoded,storeDate=" + ic + "," + vers + "," + firstSettings + "," + itunesCapable + "," + latestSettings + "," + itemsEncoded + "," + storeDate);}
        //#endif
        //#ifdef DTEST
        if (m_debugOutput) System.out.println("Settings region,vers,firstSettings,itunescapable,latestSettings,itemsEncoded,storeDate=" + ic + "," + vers + "," + firstSettings + "," + itunesCapable + "," + latestSettings + "," + itemsEncoded + "," + storeDate);
        //#endif
        String bms = m_settings.getStringProperty(ic, "bookmarks", "");
        //#ifdef DLOGGING
        if (fineLoggable) {logger.fine("bms.length()=" + bms.length());}
        //#endif
        // Save memory by setting bookmarks to "" now that
        // we will convert them to objects.
        m_settings.setStringProperty("bookmarks", "");
       
        if(bms.length()>0) {
          do{
           
            String part = "";
            int pos = bms.indexOf(feedSeparator);
            if(pos > 0) {
              part = bms.substring(0, pos);
            }
            bms = bms.substring(pos+1);
            if(part.length()>0) {
              RssStoreInfo rsi = null;
              //#ifdef DCOMPATIBILITY1
              RssFeed bm1 = new CompatibilityRssFeed1( part );
              RssItunesFeed bm = new RssItunesFeed( bm1 );
              //#elifdef DCOMPATIBILITY2
              RssFeed bm2 = new CompatibilityRssFeed2( part );
              RssItunesFeed bm = new RssItunesFeed( bm2 );
              //#elifdef DCOMPATIBILITY3
              RssItunesFeed bm2 =
                CompatibilityRssItunesFeed3.deserialize3(
                true, part );
              RssItunesFeed bm = new RssItunesFeed( bm2 );
              //#else
              RssItunesFeed bm = null;
              if (itunesCapable) {
                if (saveMemoryEnabled) {
                  rsi = RssItunesFeed.getStoreStringInfo(
                      true, false, part, itemsEncoded );
                } else {
                  bm = RssItunesFeed.deserialize(
                      itemsEncoded, part );
                }
              } else {
                bm = new RssItunesFeed(new RssFeed(
                      firstSettings, itemsEncoded, part ));
              }

              //#endif
              if((bm != null) && (bm.getName().length()>0)){
                final String fname = bm.getName();
                m_bookmarkList.append(fname,null);
                m_rssFeeds.put(fname, bm);
              } else {
                final String fname = rsi.getName();
                m_bookmarkList.append(fname,null);
                m_rssFeeds.put(fname,
                    rsi.getStoreString(), false);
              }
            }
            if( part.length()==0)
              stop = true;
          }while(!stop);
        }
        gauge.setValue(ic);
            }
      pl = -1;
      gauge.setValue(m_settings.MAX_REGIONS);
      //#ifdef DTEST
      System.gc();
      System.out.println("full bookmarkList size=" + (beginMem - Runtime.getRuntime().freeMemory()));
      //#endif
    } catch(CauseRecStoreException e) {
View Full Code Here


          /* Updating all or modified feeds... */
          initializeLoadingFormRsc((m_refreshUpdFeeds ?
                "text.um.feed" : "text.ua.feed"),
              m_bookmarkList);
          /* Updating all (modified) feeds...*/
          Gauge gauge = new Gauge(ResourceProviderME.get(
                m_refreshAllFeeds ? "text.ua.feed" :
                "text.um.feed"),
              false, m_rssFeeds.size(), 0);
          int pl = m_loadForm.append(gauge);
                    try{
            boolean errFound = false;
                        final int maxItemCount =
                m_appSettings.getMaximumItemCountInFeed();
            final boolean convHtml =
              !m_appSettings.getHtmlEnabled();
                        Enumeration keyEnum = m_rssFeeds.keys();
            int ic = 1;
                        while(keyEnum.hasMoreElements()) {
                            final String fname =
                (String)keyEnum.nextElement();
                            RssItunesFeed feed =
                (RssItunesFeed)m_rssFeeds.get(fname);
                            try{
                                m_loadForm.appendMsg(fname + "...");
                                RssFeedParser parser = new RssFeedParser( feed );
                                parser.parseRssFeed( m_refreshUpdFeeds,
                    convHtml, maxItemCount);
                m_rssFeeds.put( fname, feed );
                                m_loadForm.appendMsg("ok\n");
                            } catch(CauseMemoryException ex) {
                throw ex;
                            } catch(Exception ex) {
                recordExcForm("Error parsing feed " +
                    feed.getName(), ex);
                errFound = true;
                            }
              gauge.setValue(ic);
              ic++;
                        }
            if (errFound) {
              setLoadingFinished(
                  /* Finished with one or more exceptions */
 
View Full Code Here

      final long storeDate,
      final boolean saveHdr,
      final boolean saveItems, final String mkey,
      final boolean releaseMemory)
  throws RecordStoreFullException, Throwable {
    Gauge gauge = new Gauge(ResourceProviderME.get(mkey),
        false, m_settings.MAX_REGIONS + 1, 0);
    int pl = m_loadForm.append(gauge);
    try {
      try {
        m_settings.setStringProperty("bookmarks","");
        //#ifndef DCOMPATIBILITY
        m_settings.setLongProperty(m_settings.STORE_DATE, storeDate);
        m_settings.setBooleanProperty(m_settings.ITEMS_ENCODED, true);
        //#endif
        //#ifdef DTEST
                long lngStart = System.currentTimeMillis();
        //#endif
        m_settings.save(0, false);
        gauge.setValue(1);
        //#ifdef DTEST
                m_loadForm.appendMsg("Save time=" +
            (System.currentTimeMillis()-lngStart));
        //#endif
        for (int ic = 1; ic < m_settings.MAX_REGIONS; ic++) {
          saveBookmarks(saveMemoryEnabled, storeDate, saveHdr,
              saveItems, ic, releaseMemory);
          //#ifdef DTEST
          lngStart = System.currentTimeMillis();
          //#endif
          m_settings.save(ic, false);
          //#ifdef DTEST
          m_loadForm.appendMsg("Save time=" +
              (System.currentTimeMillis()-lngStart));
          //#endif
          gauge.setValue(ic + 1);
        }
        // Set internal region back to 0.
        m_settings.setStringProperty("bookmarks","");
        gauge.setValue(m_settings.MAX_REGIONS + 1);
        pl = -1;
      } catch(OutOfMemoryError e) {
        /* Error during save out of memory. */
        throw new CauseMemoryException(ResourceProviderME.get("exc.sv.om"), e);
      }
View Full Code Here

   */
  public void createGauge(final String aGauge, final int aValue) {
    if (aValue<0 || aValue>100) {
      throw new RuntimeException("Wrong parameters for Gauge constructor");
    }
    gauge = new Gauge(ResourceProviderME.get(aGauge), true, 100, 0);
    super.append(gauge);
        gauge.setValue(aValue);
    display.setCurrent(this);
  }
View Full Code Here

    smiles.setSelectedIndex(0, j.getSmiles()!=0);

                useMyServer = new ChoiceGroup("GTalk - Use alternative server for Google authorization", ChoiceGroup.MULTIPLE, s, null);
    useMyServer.setSelectedIndex(0, j.getUseMyServer()!=0);

    volume = new Gauge("Set initial volume", true, 10, j.getVolume()/10);
   
    f.append(name);
    f.append(user);
    f.append(pass);
    f.append(host);
View Full Code Here

    super();
    this.d = d;
    this.list = list;
   
    form = new Form("Volume control");
    volume = new Gauge("Set current volume", true, 10, list.getProfile().getVolume()/10);
    form.append(volume);
    ok = new Command("Set", Command.BACK, 0);
    cancel = new Command("Cancel", Command.BACK, 1);
    form.addCommand(ok);
    form.addCommand(cancel);
View Full Code Here

    final private void initializeBookmarkList() {
    //#ifdef DTEST
//@    System.gc();
//@    long beginMem = Runtime.getRuntime().freeMemory();
    //#endif
    Gauge gauge = new Gauge(ResourceProviderME.get("label.init.b"),
        false, m_settings.MAX_REGIONS, 0);
    int pl = m_loadForm.append(gauge);
        try {
            m_bookmarkList = new PromptList(this, "Bookmarks", List.IMPLICIT);
      updBookmarkList();
            m_bookmarkList.setCommandListener( this );
      //#ifdef DTEST
//@      System.gc();
//@      System.out.println("empty bookmarkList size=" + (beginMem - Runtime.getRuntime().freeMemory()));
      //#endif
           
            int i = 1;
           
            final boolean saveMemoryEnabled =
          m_appSettings.getSaveMemoryEnabled();
            m_rssFeeds = new RssFeedStore(saveMemoryEnabled);
      for (int ic = 1; ic < m_settings.MAX_REGIONS; ic++) {
        boolean stop = false;
        final String vers = m_settings.getStringProperty(ic,
            m_settings.SETTINGS_NAME, "");
        final boolean firstSettings =
           vers.equals(m_settings.FIRST_SETTINGS_VERS);
        final boolean itunesCapable = ((vers.length() > 0) &&
           (vers.compareTo(m_settings.ITUNES_CAPABLE_VERS) >= 0));
        final boolean latestSettings = vers.equals(
            m_settings.ENCODING_VERS);
        final boolean itemsEncoded =
          m_settings.getBooleanProperty(m_settings.ITEMS_ENCODED,
              true);
        final long storeDate = m_settings.getLongProperty(
            m_settings.STORE_DATE, 0L);
        final char feedSeparator =
          latestSettings ? CFEED_SEPARATOR : OLD_FEED_SEPARATOR;
        //#ifdef DLOGGING
//@        if (fineLoggable) {logger.fine("Settings region,vers,firstSettings,itunescapable,latestSettings,itemsEncoded,storeDate=" + ic + "," + vers + "," + firstSettings + "," + itunesCapable + "," + latestSettings + "," + itemsEncoded + "," + storeDate);}
        //#endif
        //#ifdef DTEST
//@        if (m_debugOutput) System.out.println("Settings region,vers,firstSettings,itunescapable,latestSettings,itemsEncoded,storeDate=" + ic + "," + vers + "," + firstSettings + "," + itunesCapable + "," + latestSettings + "," + itemsEncoded + "," + storeDate);
        //#endif
        String bms = m_settings.getStringProperty(ic, "bookmarks", "");
        //#ifdef DLOGGING
//@        if (fineLoggable) {logger.fine("bms.length()=" + bms.length());}
        //#endif
        // Save memory by setting bookmarks to "" now that
        // we will convert them to objects.
        m_settings.setStringProperty("bookmarks", "");
       
        if(bms.length()>0) {
          do{
           
            String part = "";
            int pos = bms.indexOf(feedSeparator);
            if(pos > 0) {
              part = bms.substring(0, pos);
            }
            bms = bms.substring(pos+1);
            if(part.length()>0) {
              RssStoreInfo rsi = null;
              //#ifdef DCOMPATIBILITY1
//@              RssFeed bm1 = new CompatibilityRssFeed1( part );
//@              RssItunesFeed bm = new RssItunesFeed( bm1 );
              //#elifdef DCOMPATIBILITY2
//@              RssFeed bm2 = new CompatibilityRssFeed2( part );
//@              RssItunesFeed bm = new RssItunesFeed( bm2 );
              //#elifdef DCOMPATIBILITY3
//@              RssItunesFeed bm2 =
//@                CompatibilityRssItunesFeed3.deserialize3(
//@                true, part );
//@              RssItunesFeed bm = new RssItunesFeed( bm2 );
              //#else
              RssItunesFeed bm = null;
              if (itunesCapable) {
                if (saveMemoryEnabled) {
                  rsi = RssItunesFeed.getStoreStringInfo(
                      true, false, part, itemsEncoded );
                } else {
                  bm = RssItunesFeed.deserialize(
                      itemsEncoded, part );
                }
              } else {
                bm = new RssItunesFeed(new RssFeed(
                      firstSettings, itemsEncoded, part ));
              }

              //#endif
              if((bm != null) && (bm.getName().length()>0)){
                final String fname = bm.getName();
                m_bookmarkList.append(fname,null);
                m_rssFeeds.put(fname, bm);
              } else {
                final String fname = rsi.getName();
                m_bookmarkList.append(fname,null);
                m_rssFeeds.put(fname,
                    rsi.getStoreString(), false);
              }
            }
            if( part.length()==0)
              stop = true;
          }while(!stop);
        }
        gauge.setValue(ic);
            }
      pl = -1;
      gauge.setValue(m_settings.MAX_REGIONS);
      //#ifdef DTEST
//@      System.gc();
//@      System.out.println("full bookmarkList size=" + (beginMem - Runtime.getRuntime().freeMemory()));
      //#endif
    } catch(CauseRecStoreException e) {
View Full Code Here

          /* Updating all or modified feeds... */
          initializeLoadingFormRsc((m_refreshUpdFeeds ?
                "text.um.feed" : "text.ua.feed"),
              m_bookmarkList);
          /* Updating all (modified) feeds...*/
          Gauge gauge = new Gauge(ResourceProviderME.get(
                m_refreshAllFeeds ? "text.ua.feed" :
                "text.um.feed"),
              false, m_rssFeeds.size(), 0);
          int pl = m_loadForm.append(gauge);
                    try{
            boolean errFound = false;
                        final int maxItemCount =
                m_appSettings.getMaximumItemCountInFeed();
            final boolean convHtml =
              !m_appSettings.getHtmlEnabled();
                        Enumeration keyEnum = m_rssFeeds.keys();
            int ic = 1;
                        while(keyEnum.hasMoreElements()) {
                            final String fname =
                (String)keyEnum.nextElement();
                            RssItunesFeed feed =
                (RssItunesFeed)m_rssFeeds.get(fname);
                            try{
                                m_loadForm.appendMsg(fname + "...");
                                RssFeedParser parser = new RssFeedParser( feed );
                                parser.parseRssFeed( m_refreshUpdFeeds,
                    convHtml, maxItemCount);
                m_rssFeeds.put( fname, feed );
                                m_loadForm.appendMsg("ok\n");
                            } catch(CauseMemoryException ex) {
                throw ex;
                            } catch(Exception ex) {
                recordExcForm("Error parsing feed " +
                    feed.getName(), ex);
                errFound = true;
                            }
              gauge.setValue(ic);
              ic++;
                        }
            if (errFound) {
              setLoadingFinished(
                  /* Finished with one or more exceptions */
 
View Full Code Here

      final long storeDate,
      final boolean saveHdr,
      final boolean saveItems, final String mkey,
      final boolean releaseMemory)
  throws RecordStoreFullException, Throwable {
    Gauge gauge = new Gauge(ResourceProviderME.get(mkey),
        false, m_settings.MAX_REGIONS + 1, 0);
    int pl = m_loadForm.append(gauge);
    try {
      try {
        m_settings.setStringProperty("bookmarks","");
        //#ifndef DCOMPATIBILITY
        m_settings.setLongProperty(m_settings.STORE_DATE, storeDate);
        m_settings.setBooleanProperty(m_settings.ITEMS_ENCODED, true);
        //#endif
        //#ifdef DTEST
//@                long lngStart = System.currentTimeMillis();
        //#endif
        m_settings.save(0, false);
        gauge.setValue(1);
        //#ifdef DTEST
//@                m_loadForm.appendMsg("Save time=" +
//@            (System.currentTimeMillis()-lngStart));
        //#endif
        for (int ic = 1; ic < m_settings.MAX_REGIONS; ic++) {
          saveBookmarks(saveMemoryEnabled, storeDate, saveHdr,
              saveItems, ic, releaseMemory);
          //#ifdef DTEST
//@          lngStart = System.currentTimeMillis();
          //#endif
          m_settings.save(ic, false);
          //#ifdef DTEST
//@          m_loadForm.appendMsg("Save time=" +
//@              (System.currentTimeMillis()-lngStart));
          //#endif
          gauge.setValue(ic + 1);
        }
        // Set internal region back to 0.
        m_settings.setStringProperty("bookmarks","");
        gauge.setValue(m_settings.MAX_REGIONS + 1);
        pl = -1;
      } catch(OutOfMemoryError e) {
        /* Error during save out of memory. */
        throw new CauseMemoryException(ResourceProviderME.get("exc.sv.om"), e);
      }
View Full Code Here

    private Timer timer;
    private WaitFormTimerTask waitFormTimerTask;

    public WaitingForm(String title) {
        super(title);
        gauge = new Gauge("Proszę czekać", false, 100, 0);
        timer = new Timer();
        waitFormTimerTask = new WaitFormTimerTask(gauge);
        append(gauge);
    }
View Full Code Here

TOP

Related Classes of javax.microedition.lcdui.Gauge

Copyright © 2018 www.massapicom. 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.