Java Code Examples for org.apache.wicket.ajax.attributes.AjaxRequestAttributes#setChannel()

The following examples show how to use org.apache.wicket.ajax.attributes.AjaxRequestAttributes#setChannel() . 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: WidgetTabs.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
{
	super.updateAjaxAttributes(attributes);
	
	attributes.setChannel(new AjaxChannel(getId()));
}
 
Example 2
Source File: SakaiSpinningSelectOnChangeBehavior.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
{
	super.updateAjaxAttributes(attributes);
	attributes.setChannel(new AjaxChannel("blocking", AjaxChannel.Type.ACTIVE));

	AjaxCallListener listener = new SakaiSpinningSelectAjaxCallListener(getComponent().getMarkupId(), false);
	attributes.getAjaxCallListeners().add(listener);
}
 
Example 3
Source File: SakaiAjaxButton.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
{
	super.updateAjaxAttributes(attributes);
	attributes.setChannel(new AjaxChannel("blocking", AjaxChannel.Type.ACTIVE));

	AjaxCallListener listener = new SakaiSpinnerAjaxCallListener(getMarkupId(), willRenderOnClick);
	attributes.getAjaxCallListeners().add(listener);
}
 
Example 4
Source File: AjaxLazyLoadImage.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
private void init() {
	setOutputMarkupId(true);	
	
	// render chart by ajax, uppon request
	chartRenderAjaxBehavior = new AbstractDefaultAjaxBehavior() {
		private static final long	serialVersionUID	= 1L;

		@Override
		protected void respond(AjaxRequestTarget target) {
			//log.debug("chartRenderAjaxBehavior.Responding for "+ getId());
			renderImage(target, true);
		}
		
		@Override
		public boolean isEnabled(Component component) {
			return state < 2;
		}
		
		@Override
		protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
		{
			super.updateAjaxAttributes(attributes);
			
			attributes.setChannel(new AjaxChannel(getId()));
		}
	};
	add(chartRenderAjaxBehavior);
	
	// fields for maximized chart size
	setDefaultModel(new CompoundPropertyModel(this));
	form = new Form("chartForm");
	form.add(new HiddenField("maxWidth"));
	form.add(new HiddenField("maxHeight"));
	add(form);

}
 
Example 5
Source File: WidgetTabs.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
{
	super.updateAjaxAttributes(attributes);
	
	attributes.setChannel(new AjaxChannel(getId()));
}
 
Example 6
Source File: SakaiSpinningSelectOnChangeBehavior.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
{
	super.updateAjaxAttributes(attributes);
	attributes.setChannel(new AjaxChannel("blocking", AjaxChannel.Type.ACTIVE));

	AjaxCallListener listener = new SakaiSpinningSelectAjaxCallListener(getComponent().getMarkupId(), false);
	attributes.getAjaxCallListeners().add(listener);
}
 
Example 7
Source File: SakaiAjaxButton.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
{
	super.updateAjaxAttributes(attributes);
	attributes.setChannel(new AjaxChannel("blocking", AjaxChannel.Type.ACTIVE));

	AjaxCallListener listener = new SakaiSpinnerAjaxCallListener(getMarkupId(), willRenderOnClick);
	attributes.getAjaxCallListeners().add(listener);
}
 
Example 8
Source File: AjaxLazyLoadImage.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
private void init() {
	setOutputMarkupId(true);	
	
	// render chart by ajax, uppon request
	chartRenderAjaxBehavior = new AbstractDefaultAjaxBehavior() {
		private static final long	serialVersionUID	= 1L;

		@Override
		protected void respond(AjaxRequestTarget target) {
			//log.debug("chartRenderAjaxBehavior.Responding for "+ getId());
			renderImage(target, true);
		}
		
		@Override
		public boolean isEnabled(Component component) {
			return state < 2;
		}
		
		@Override
		protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
		{
			super.updateAjaxAttributes(attributes);
			
			attributes.setChannel(new AjaxChannel(getId()));
		}
	};
	add(chartRenderAjaxBehavior);
	
	// fields for maximized chart size
	setDefaultModel(new CompoundPropertyModel(this));
	form = new Form("chartForm");
	form.add(new HiddenField("maxWidth"));
	form.add(new HiddenField("maxHeight"));
	add(form);

}
 
Example 9
Source File: InputAssistBehavior.java    From onedev with MIT License 4 votes vote down vote up
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
	super.updateAjaxAttributes(attributes);
	attributes.setChannel(new AjaxChannel("input-assist", AjaxChannel.Type.DROP));
}
 
Example 10
Source File: AjaxLazyLoadImage.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
public void setAutoDetermineChartSizeByAjax(final String jquerySelectorForContainer) {
	autoDetermineChartSizeByAjax = true;
	AbstractDefaultAjaxBehavior determineChartSizeBehavior = new AbstractDefaultAjaxBehavior() {
		private static final long	serialVersionUID	= 1L;

		@Override
		protected void respond(AjaxRequestTarget target) {
			// parse desired image size
			Request req = RequestCycle.get().getRequest();

			selectedWidth = req.getQueryParameters().getParameterValue("width").toInt(400);					

			selectedHeight = req.getQueryParameters().getParameterValue("height").toInt(200);
			if(selectedHeight < 200)
			{
				selectedHeight = 200;
			}
			// render chart image
			renderImage(target, true);
		}

		@Override
		public void renderHead(Component component, IHeaderResponse response) {
			
			super.renderHead(component, response);
			response.render(OnDomReadyHeaderItem.forScript(getCallbackScript(component)));
		}
		
		@Override
		protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
		{
			super.updateAjaxAttributes(attributes);
			
			attributes.setChannel(new AjaxChannel(getId()));
			
			String dynamicExtraParams = "return { 'height': jQuery('" + jquerySelectorForContainer
					+ "').height(), 'width': jQuery('" + jquerySelectorForContainer + "').width() }";
			attributes.getDynamicExtraParameters().add(dynamicExtraParams);
		}
	};	
	
	add(determineChartSizeBehavior);
}
 
Example 11
Source File: GbAjaxLink.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
@Override
protected void updateAjaxAttributes(final AjaxRequestAttributes attributes) {
	super.updateAjaxAttributes(attributes);
	attributes.setChannel(new AjaxChannel("blocking", AjaxChannel.Type.ACTIVE));
}
 
Example 12
Source File: AjaxLazyLoadImage.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
public void setAutoDetermineChartSizeByAjax(final String jquerySelectorForContainer) {
	autoDetermineChartSizeByAjax = true;
	AbstractDefaultAjaxBehavior determineChartSizeBehavior = new AbstractDefaultAjaxBehavior() {
		private static final long	serialVersionUID	= 1L;

		@Override
		protected void respond(AjaxRequestTarget target) {
			// parse desired image size
			Request req = RequestCycle.get().getRequest();

			selectedWidth = req.getQueryParameters().getParameterValue("width").toInt(400);					

			selectedHeight = req.getQueryParameters().getParameterValue("height").toInt(200);
			if(selectedHeight < 200)
			{
				selectedHeight = 200;
			}
			// render chart image
			renderImage(target, true);
		}

		@Override
		public void renderHead(Component component, IHeaderResponse response) {
			
			super.renderHead(component, response);
			response.render(OnDomReadyHeaderItem.forScript(getCallbackScript(component)));
		}
		
		@Override
		protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
		{
			super.updateAjaxAttributes(attributes);
			
			attributes.setChannel(new AjaxChannel(getId()));
			
			String dynamicExtraParams = "return { 'height': jQuery('" + jquerySelectorForContainer
					+ "').height(), 'width': jQuery('" + jquerySelectorForContainer + "').width() }";
			attributes.getDynamicExtraParameters().add(dynamicExtraParams);
		}
	};	
	
	add(determineChartSizeBehavior);
}
 
Example 13
Source File: GbAjaxLink.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
@Override
protected void updateAjaxAttributes(final AjaxRequestAttributes attributes) {
	super.updateAjaxAttributes(attributes);
	attributes.setChannel(new AjaxChannel("blocking", AjaxChannel.Type.ACTIVE));
}