1. #1
    Sencha User
    Join Date
    Feb 2013
    Location
    Russian federation, Smolensk
    Posts
    38
    Answers
    5
    Vote Rating
    0
    Mike_javaJunior is on a distinguished road

      0  

    Default Answered: Waitng

    Answered: Waitng


    I need to repeat a small amount of code with 1 second delay
    here is my code
    Code:
    public class ExampleChart extends ContentPanel{
    
        ArrayList<String> timeList = new ArrayList<String>();
        ArrayList<Long> queueSize = new ArrayList<Long>();
        private final ServerManagementAsync serverManagementSvc = GWT.create(ServerManagement.class);
    
    
       public ContentPanel createChart(final String customerId, boolean warrant){
    
    
           setHeading("Messages by domain");
           setFrame(true);
           setSize(550, 400);
           setLayout(new FitLayout());
    
    
           String url = "/gxt/chart/open-flash-chart.swf";
           final Chart chart = new Chart(url);
    
    
           chart.setBorders(true);
    timeList = getTimeList(timeList);       
    while (warrant){
               Timer t = new Timer(){
                   public void run(){
                       ExampleChart ec = new ExampleChart();
                       AsyncCallback<Long> ac = new AsyncCallback<Long>() {
                           @Override
                           public void onFailure(Throwable throwable) {
                               //To change body of implemented methods use File | Settings | File Templates.
                           }
    
    
                           @Override
                           public void onSuccess(Long integer) {
                               timeList = getTimeList(timeList);
                               if (queueSize.size()<11){
                                   queueSize.add(integer);
                               } else{
                                   for (int i = 0; i<queueSize.size()-1; i++){
                                       queueSize.set(i,queueSize.get(i+1));
                                   }
                               }
                               chart.setChartModel(getAreaChart(timeList, queueSize));
                               add(chart);
                               repaint();
                           }
                       };
                       serverManagementSvc.getMessageQueueSize(customerId, ac);
                   }
               };
               t.schedule(2000);
           }
           chart.setChartModel(getAreaChart(timeList, queueSize));
           add(chart);
           repaint();
           return this;
    
    
        }
    
    
        public ArrayList<String> getTimeList(ArrayList<String> TimeList){
            ArrayList<String> timeList = TimeList;
            if (timeList.size() < 11){
                timeList.add(getCurrentTime());
            } else {
                for (int i = 0; i<timeList.size()-1; i++){
                    timeList.set(i, timeList.get(i+1));
                }
                timeList.set(10, getCurrentTime());
            }
            return timeList;
        }
    
    
        public String getCurrentTime(){
            Date date = new Date();
            String hrs = Integer.toString(date.getHours());
            String min = Integer.toString(date.getMinutes());
            String sec = Integer.toString(date.getSeconds());
            return hrs + ":" + min + ":" + sec;
        }
        public ChartModel getAreaChart(ArrayList<String> dateList, ArrayList<Long> queueSize)
        {
            ChartModel cm = new ChartModel("Messages per domain", "font-size: 14px; font-family: Verdana;");
            cm.setBackgroundColour("#ffffff");
            XAxis xa = new XAxis();
            xa.setLabels(dateList);
            cm.setXAxis(xa);
            AreaChart area1 = new AreaChart();
            area1.setFillAlpha(0.3f);
            area1.setColour("#ff0000");
            area1.setFillColour("#ff0000");
            for (int n = 0; n<queueSize.size(); n++){
                    area1.addValues(queueSize.get(n));
            }
            cm.addChartConfig(area1);
     return cm;
        }
    
    
    }
    first problem is that I can't post repeat to the cycle, and so it will not be redrawed in this content panel both with the panel I add this to.

    the second problem is that this code make my app is looping

    I really need help.

  2. Thank you all.))) I've found the solution. to repeat somthing in gwt use timer.scheduleRepeating()

  3. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    Russian federation, Smolensk
    Posts
    38
    Answers
    5
    Vote Rating
    0
    Mike_javaJunior is on a distinguished road

      0  

    Default


    Thank you all.))) I've found the solution. to repeat somthing in gwt use timer.scheduleRepeating()

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."