Java Code Examples for com.google.gwt.user.client.Timer.scheduleRepeating()

The following are Jave code examples for showing how to use scheduleRepeating() of the com.google.gwt.user.client.Timer class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: listmaker   File: ItemsTable.java   View Source Code Vote up 6 votes
protected void expando(final FlowPanel div2, final DivElement[] notes)
{
	Timer t = new Timer()
	{
		int i = 0;
		final int last = notes.length;

		@Override
		public void run()
		{
			if (i >= last)
				this.cancel();
			else
				div2.getElement().appendChild(notes[i++]);
		}
	};
	// Eye candy
	t.scheduleRepeating(10);
}
 
Example 2
Project: gwt-material-demo   File: MaterialBarChart.java   View Source Code Vote up 6 votes
private void setLoop() {

		Timer timer = new Timer() {

			public void run() {
				if (isLoop) {
					drawChart(values);
					isLoop = false;
				}
				else {
					drawChart(valuesInitial);
					isLoop = true;
				}

			}
		};
		timer.scheduleRepeating(1000);
	}
 
Example 3
Project: firefly   File: CollapsiblePanel.java   View Source Code Vote up 6 votes
private void handleCallback() {
        if (disclosurePanel.isAnimationEnabled()) {
            if (disclosurePanel.getContent() != null && disclosurePanel.getContent().getParent() != null) {
                Timer t = new Timer(){
                    int tries = 0;
                    public void run() {
                            tries++;
                            String h = DOM.getStyleAttribute(disclosurePanel.getContent().getParent().getElement(), "height");
                            if (tries > 20 || h == null || h.equals("auto") || h.equals("")) {
                                postAction();
//                        GWT.log("#tries: " + tries, null);
                                cancel();
                            }
                        }
                };
                t.scheduleRepeating(250);
                return;
            }
        }
        postAction();
    }
 
Example 4
Project: umlet   File: Notification.java   View Source Code Vote up 6 votes
private static void fade(final Element element, final float startOpacity, final float endOpacity, final int totalTimeMillis) {
	final int numberOfSteps = 30;
	int stepLengthMillis = totalTimeMillis / numberOfSteps;
	stepCount = 0;
	final float deltaOpacity = (endOpacity - startOpacity) / numberOfSteps;
	timerFader = new Timer() {
		@Override
		public void run() {
			float opacity = startOpacity + stepCount * deltaOpacity;
			DOM.setStyleAttribute(element, "opacity", Float.toString(opacity));

			stepCount++;
			if (stepCount == numberOfSteps) {
				DOM.setStyleAttribute(element, "opacity", Float.toString(endOpacity));
				cancel();
			}
		}
	};
	timerFader.scheduleRepeating(stepLengthMillis);
}
 
Example 5
Project: appformer   File: ProgressBar.java   View Source Code Vote up 6 votes
private void progress() {
    timer = new Timer() {
        @Override
        public void run() {
            if (!isInfinite()) {
                hide();
            }
            progressWidth++;
            if (progressWidth > substrateWidth - 4) {
                this.cancel();
            }
            progressPercentage.setText((int) progressWidth / 3 + " %");
            setProgressWidth(progressWidth);
            layer.batch();
        }
    };
    timer.scheduleRepeating(1);
}
 
Example 6
Project: google-apis-explorer   File: PrettyDate.java   View Source Code Vote up 6 votes
/**
 * Schedules a repeating timer to continually update the text with the
 * pretty-date, every minute until the text is more than an hour old, at which
 * point it stops. The assumption is that nobody will wait for 60+ minutes for
 * "one hour ago" to turn into "2 hours ago"
 */
public static void keepMakingPretty(final Date date, final String prefix, final Element element) {
  makePretty(date, prefix, element);
  if (!TIMERS.containsKey(element)) {
    Timer timer = new Timer() {
      @Override
      public void run() {
        makePretty(date, prefix, element);
        if (element.getInnerText().contains("hour")) {
          stopMakingPretty(element);
        }
      }
    };
    timer.scheduleRepeating(60000);
    TIMERS.put(element, timer);
  }
}
 
Example 7
Project: naacl-bea2016-writing-study   File: VersionManagement.java   View Source Code Vote up 5 votes
public void startAnalysis() {
	timer = new Timer() {
		@Override
		public void run() {
			analyse();
		}
	};
	timer.scheduleRepeating(Constants.SHARED.VERSION.VERION_UPDATE_INTERVAL_MILLIS);
}
 
Example 8
Project: document-management-system   File: Dashboard.java   View Source Code Vote up 5 votes
/**
 * startRefreshingDashboard
 *
 * @param scheduleTime
 */
public void startRefreshingDashboard(double scheduleTime) {
	dashboardRefreshing = new Timer() {
		public void run() {
			refreshAll();
		}
	};

	dashboardRefreshing.scheduleRepeating(new Double(scheduleTime).intValue());
}
 
Example 9
Project: document-management-system   File: StartUp.java   View Source Code Vote up 5 votes
/**
 * startKeepAlive
 */
public void startKeepAlive(double scheduleTime) {
	// KeepAlieve thread
	keepAlive = new Timer() {
		public void run() {
			authService.keepAlive(callbackKeepAlive);
		}
	};

	keepAlive.scheduleRepeating(new Double(scheduleTime).intValue()); // 15 min
}
 
Example 10
Project: document-management-system   File: MainMenu.java   View Source Code Vote up 5 votes
/**
 * startRefreshingMenus
 */
public void startRefreshingMenus(double scheduleTime) {
	menusRefreshing = new Timer() {
		@Override
		public void run() {
			refreshAvailableTemplates();
		}
	};

	menusRefreshing.scheduleRepeating(new Double(scheduleTime).intValue());
}
 
Example 11
Project: scheduling-portal   File: SchedulerController.java   View Source Code Vote up 5 votes
private void tryToLoginIfLoggedInRm() {
    autoLoginTimer = new Timer() {
        @Override
        public void run() {
            String session = Settings.get().getSetting(SESSION_SETTING);
            if (session != null) {
                tryLogin(session, null);
            }
        }
    };
    autoLoginTimer.scheduleRepeating(AUTO_LOGIN_TIMER_PERIOD_IN_MS);
}
 
Example 12
Project: scheduling-portal   File: RMController.java   View Source Code Vote up 5 votes
private void tryToLoginIfLoggedInScheduler() {
    autoLoginTimer = new Timer() {
        @Override
        public void run() {
            String session = Settings.get().getSetting(SESSION_SETTING);
            if (session != null) {
                tryLogin(session, null);
            }
        }
    };
    autoLoginTimer.scheduleRepeating(AUTO_LOGIN_TIMER_PERIOD_IN_MS);
}
 
Example 13
Project: gwt-material-demo   File: MaterialAreaChart.java   View Source Code Vote up 5 votes
private void setLoop() {
	Timer timer = new Timer() {
	  public void run() {
		  if(isLoop) {
			  drawChart(values);
			  isLoop = false;
		  } else {
			  drawChart(valuesInitial);
			  isLoop = true;
		  }
	  }
	};
	timer.scheduleRepeating(1000);
}
 
Example 14
Project: firefly   File: SearchSummaryPanel.java   View Source Code Vote up 5 votes
private void layout(final SearchSummaryItem ssi, final int depth) {

        final int row = table.getRowCount();
        final Image loading = new Image(GwtUtil.LOADING_ICON_URL);
        ssi.checkUpdate();

        table.setWidget(row, iconColIdx, loading);

        if (ssi.isLoaded()) {
            ssi.renderItem(table, row, curGroupByName);
            GwtUtil.setStyles(loading, "visibility", "hidden");
        } else {
            ssi.checkUpdate();
            table.setWidget(row, iconColIdx, loading);
            Timer timer = new Timer() {
                public void run() {
                    ssi.checkUpdate();
                    ssi.renderItem(table, row, curGroupByName);
                    if (ssi.isLoaded()) {
                        cancel();
                        GwtUtil.setStyles(loading, "visibility", "hidden");
                    }
                }
            };
            bgList.add(timer);
            timer.scheduleRepeating(1000);
        }

        if (ssi.getChildren() != null && ssi.getChildren().size() > 0) {
            for(SearchSummaryItem child : ssi.getChildren()) {
                layout(child, depth+1);
            }
        }
    }
 
Example 15
Project: gerrit   File: PluginLoader.java   View Source Code Vote up 5 votes
private void startTimers() {
  show =
      new Timer() {
        @Override
        public void run() {
          setText(Window.getTitle());
          setWidget(progress);
          setGlassEnabled(true);
          getGlassElement().addClassName(Gerrit.RESOURCES.css().errorDialogGlass());
          hide(true);
          center();
          visible = true;
        }
      };
  show.schedule(500);

  update =
      new Timer() {
        private int cycle;

        @Override
        public void run() {
          progress.setValue(100 * ++cycle * 250 / loadTimeout);
        }
      };
  update.scheduleRepeating(250);

  timeout =
      new Timer() {
        @Override
        public void run() {
          finish();
        }
      };
  timeout.schedule(loadTimeout);
}
 
Example 16
Project: dhcalc   File: Service.java   View Source Code Vote up 5 votes
private Service() {
	newsTimer = new Timer(){

		@Override
		public void run() {
			checkNews(null);
		}};

	checkNews(null);
	newsTimer.scheduleRepeating(30000);
}
 
Example 17
Project: OSWf-OSWorkflow-fork   File: SimulatorPresenter.java   View Source Code Vote up 4 votes
private Timer createTimer(int seconds) {
    
    Timer timer = new Timer() {
        public void run() { fetchWorkflowOverview(); }
    };

    timer.scheduleRepeating(seconds * 1000);
        
    return timer;
}