Java Code Examples for org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow#closeCurrent()

The following examples show how to use org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow#closeCurrent() . 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: AnalysisPanel.java    From nextreports-server with Apache License 2.0 6 votes vote down vote up
private AjaxLink<Analysis> getPaginateLink() {
 	return new ToolbarLink<Analysis>("paginate", "PaginatePanel.title", 200) {

@Override
protected FormContentPanel<Analysis> createPanel() {
	return new PaginatePanel(AnalysisPanel.this.getModel()) {
          	
              private static final long serialVersionUID = 1L;

              @Override
              public void onOk(AjaxRequestTarget target) {	                		                	         		                	
              	ModalWindow.closeCurrent(target);	   
              	changeDataProvider(AnalysisPanel.this.getModel(), target);	                	
              }
          };
}			
 	};
 }
 
Example 2
Source File: AnalysisPanel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
private AjaxLink<Analysis> getSelectLink() {
 	return new ToolbarLink<Analysis>("selectColumns", "ColumnsPanel.title", 560) {									

@Override
protected FormContentPanel<Analysis> createPanel() {
	return new ColumnsPanel(AnalysisPanel.this.getModel()) {
          	
              private static final long serialVersionUID = 1L;

              @Override
              public void onOk(AjaxRequestTarget target) {	                	
              	if (getColumns().size() == 0) {	                		
              		error(getString("ColumnsPanel.selectOne"));	    
              		target.add(getFeedbackPanel());
          			return;
          		}	                	
              	
              	ModalWindow.closeCurrent(target);
                  
              	List<String> selectedColumns = getColumns();
              	List<Boolean> sel = new ArrayList<Boolean>();
              	for (String column : getChoices()) {
              		sel.add(selectedColumns.contains(column)); 
              	}	                	
              	AnalysisPanel.this.getModel().getObject().setSelected(sel);	  
              	AnalysisPanel.this.getModel().getObject().setColumns(getChoices()); 
              	
              	// if some columns are deselected and they were used in order by or group by clause, we have to remove
              	// them from sorts and groups
              	DatabaseUtil.removeGroupColumns(selectedColumns, AnalysisPanel.this.getModel().getObject().getGroups());
              	DatabaseUtil.removeSortColumns(selectedColumns, AnalysisPanel.this.getModel().getObject().getSortProperty(), AnalysisPanel.this.getModel().getObject().getAscending());	                	
                
              	changeDataProvider(AnalysisPanel.this.getModel(), target);	                	
              }
          };
}						
 	};
 }
 
Example 3
Source File: AnalysisPanel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
private AjaxLink<Analysis> getSortLink() {
 	return new ToolbarLink<Analysis>("sortRows", "SortPanel.title", 500) {			
			
@Override
protected FormContentPanel<Analysis> createPanel() {
	return new SortPanel(AnalysisPanel.this.getModel()) {
          	
              private static final long serialVersionUID = 1L;

              @Override
              public void onOk(AjaxRequestTarget target) {	  
              	if (isEdit()) {
              		error(getString("editMode"));
              		target.add(getFeedbackPanel());
          			return;
          		}
              	if (getSortProperty().size() == 0) {	                		
              		error(getString("SortPanel.selectOne"));	    
              		target.add(getFeedbackPanel());
          			return;
          		}	 
              	ModalWindow.closeCurrent(target);
                  
              	Analysis analysis = AnalysisPanel.this.getModel().getObject();	                	
              	analysis.setSortProperty(getSortProperty());
              	analysis.setAscending(getAscending());
              	analysis.setFirstSortRemoved(isFirstSortRemoved());
              	analysis.setChangeFirstSortOrder(isChangeFirstSortOrder());
                
              	AnalysisPanel.this.getModel().setObject(analysis);
              	changeDataProvider(AnalysisPanel.this.getModel(), target);
              }
          };
}	
 	};
 }
 
Example 4
Source File: AnalysisPanel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
private AjaxLink<Analysis> getFilterLink() {
 	return new ToolbarLink<Analysis>("filterRows", "FilterPanel.title", 400) {

@Override
protected FormContentPanel<Analysis> createPanel() {
	return  new FilterPanel(AnalysisPanel.this.getModel()) {
          	
              private static final long serialVersionUID = 1L;

              @Override
              public void onOk(AjaxRequestTarget target) {	
              	
              	if (isEdit()) {
              		error(getString("editMode"));
              		target.add(getFeedbackPanel());
          			return;
          		}
              	
              	ModalWindow.closeCurrent(target);	                    
              	Analysis analysis = AnalysisPanel.this.getModel().getObject();
              	analysis.setFilters(getFilters());
              	dataProvider.reset();	                  
                  target.add(AnalysisPanel.this);
              }
          };
}									
 	};
 }
 
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: AnalysisPanel.java    From nextreports-server with Apache License 2.0 4 votes vote down vote up
private AjaxLink<Analysis> getGroupLink() {
 	return new ToolbarLink<Analysis>("groupRows", "GroupPanel.title", 400) {

@Override
protected FormContentPanel<Analysis> createPanel() {
	return new GroupPanel(AnalysisPanel.this.getModel()) {
          	
              private static final long serialVersionUID = 1L;

              @Override
              public void onOk(AjaxRequestTarget target) {	
              	if (isEdit()) {
              		error(getString("editMode"));
              		target.add(getFeedbackPanel());
          			return;
          		}
              	ModalWindow.closeCurrent(target);	                    
              	Analysis analysis = AnalysisPanel.this.getModel().getObject();	                	
              	analysis.setGroups(getGroups());
              	
              	// keep as selected only columns from groups and created columns with aggregate functions
              	if (!getGroups().isEmpty()) {
               	List<String> keptColumns = new ArrayList<String>();
               	for (String col : analysis.getColumns()) {
               		if (getGroups().contains(col) || AnalysisUtil.isAggregateColumn(col)) {
               			keptColumns.add(col);
               		}	                		
               	}	                	
               	List<Boolean> sel = new ArrayList<Boolean>();
               	for (String column : analysis.getColumns()) {
               		sel.add(keptColumns.contains(column)); 
               	}		                	
               	analysis.setSelected(sel);
              	}
              		                	
              	changeDataProvider(AnalysisPanel.this.getModel(), target);	    
              }
          };
}			
 	};
 }
 
Example 7
Source File: FormContentPanel.java    From nextreports-server with Apache License 2.0 4 votes vote down vote up
public void onOk(AjaxRequestTarget target) {
	ModalWindow.closeCurrent(target);
}
 
Example 8
Source File: FormContentPanel.java    From nextreports-server with Apache License 2.0 4 votes vote down vote up
public void onCancel(AjaxRequestTarget target) {
	ModalWindow.closeCurrent(target);
}
 
Example 9
Source File: FormContentPanel.java    From nextreports-server with Apache License 2.0 4 votes vote down vote up
public void onApply(AjaxRequestTarget target) {
	ModalWindow.closeCurrent(target);
}