org.apache.wicket.ajax.AjaxSelfUpdatingTimerBehavior Java Examples

The following examples show how to use org.apache.wicket.ajax.AjaxSelfUpdatingTimerBehavior. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractTableTreePage.java    From JPPF with Apache License 2.0 6 votes vote down vote up
/**
 * 
 * @param viewType the type of tree this page holds.
 * @param namePrefix the name prefix for the toolbar and table tree.
 */
public AbstractTableTreePage(final TreeViewType viewType, final String namePrefix) {
  this.viewType = viewType;
  this.namePrefix = namePrefix;
  add(getOrCreateToolbar());
  final TableTreeData data = JPPFWebSession.get().getTableTreeData(viewType);
  treeModel = data.getModel();
  selectionHandler = data.getSelectionHandler();
  tableTree = createTableTree("jppf." + namePrefix + ".visible.columns");
  tableTree.add(new WindowsTheme()); // adds windows-style handles on nodes with children
  final int interval = JPPFWebConsoleApplication.get().getRefreshInterval();
  refreshTimer = new AjaxSelfUpdatingTimerBehavior(Duration.seconds(interval));
  tableTree.add(refreshTimer);
  tableTree.addUpdateTarget(toolbar);
  data.selectionChanged(selectionHandler);
  if (debugEnabled) log.debug("table tree created");
  add(tableTree);
  if (debugEnabled) log.debug("table tree added to page");
}
 
Example #2
Source File: MonitorPanel.java    From nextreports-server with Apache License 2.0 6 votes vote down vote up
public MonitorPanel(String id) {
	super(id);

	jobsTable = createJobsTable(new ReportJobInfoDataProvider());
	jobsTable.setOutputMarkupId(true);
	add(jobsTable);

	schedulerJobsTable = createSchedulerJobsTable(new ActiveSchedulerJobDataProvider());
	schedulerJobsTable.setOutputMarkupId(true);
	add(schedulerJobsTable);

	RunHistoryPanel runHistoryPanel = new RunHistoryPanel("runHistoryPanel", null);
	runHistoryTable = runHistoryPanel.getRunHistoryTable();
	runHistoryTable.setOutputMarkupId(true);
	add(runHistoryPanel);

	Settings settings = storageService.getSettings();
	int updateInterval = settings.getUpdateInterval();

	if (updateInterval > 0) {
		jobsTable.add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(updateInterval)));
		schedulerJobsTable.add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(updateInterval)));
		runHistoryTable.add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(updateInterval)));
	}
}
 
Example #3
Source File: DashboardColumnPanel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
private WidgetPanel createWidgetPanel(String id, Widget widget, WidgetModel widgetModel) {
	WidgetPanel widgetPanel = new WidgetPanel(id, widgetModel);		
	int refreshTime = WidgetUtil.getRefreshTime(dashboardService, widget);
       if (refreshTime > 0) {
           widgetPanel.add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(refreshTime)));                    
       }        
       return widgetPanel;
}
 
Example #4
Source File: AbstractTableTreePage.java    From JPPF with Apache License 2.0 4 votes vote down vote up
@Override
public AjaxSelfUpdatingTimerBehavior getRefreshTimer() {
  return refreshTimer;
}
 
Example #5
Source File: DashboardPanel.java    From nextreports-server with Apache License 2.0 4 votes vote down vote up
private void changeGlobalSettings(WidgetRuntimeModel runtimeModel, AjaxRequestTarget target) {
	ModalWindow.closeCurrent(target);
			
	WidgetPanelVisitor visitor = new WidgetPanelVisitor();
	visitChildren(WidgetPanel.class, visitor);				
	
	for (WidgetPanel widgetPanel : visitor.getWidgetPanels()) {			
		Widget widget = widgetPanel.getWidget();
		if (widget == null) {
			continue;
		}
		int oldRefreshTime = widget.getRefreshTime();
		WidgetRuntimeModel storedRuntimeModel = ChartUtil.getRuntimeModel(storageService.getSettings(), (EntityWidget)widget, reportService, dataSourceService, true);
		ChartUtil.updateGlobalWidget(widget, storedRuntimeModel, runtimeModel);
		try {				
			dashboardService.modifyWidget(getDashboard().getId(), widget);
		} catch (NotFoundException e) {
			// never happening
			throw new RuntimeException(e);
		}
		int refreshTime = widget.getRefreshTime();
		if (oldRefreshTime != refreshTime) {
			for (Behavior behavior : widgetPanel.getBehaviors()) {
				if (behavior instanceof AjaxSelfUpdatingTimerBehavior) {
					((AjaxSelfUpdatingTimerBehavior) behavior).stop(target);
					// do not remove the behavior : after changing , the
					// event is called one more
					// time on the client so it has to be present ...
				}
			}
			if (refreshTime > 0) {
				widgetPanel.add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(refreshTime)));
			}
		}
	}
       
	/*
       for (int i = 0; i < getDashboard().getColumnCount(); i++) {
       	target.add(getColumnPanel(i));
       }
       */
	target.add(this);
}
 
Example #6
Source File: RefreshTimerHolder.java    From JPPF with Apache License 2.0 2 votes vote down vote up
/**
 * @return the refresh timer.
 */
AjaxSelfUpdatingTimerBehavior getRefreshTimer();