You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Kai Mütz <km...@googlemail.com> on 2010/05/24 01:34:28 UTC

Veil behavior of wicketstuff-minis

Hi,

is there an example of the veil behavior of wicketstuff-minis. I want to try
it but am not sure how to use it.

Thanks, Kai


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Veil behavior of wicketstuff-minis

Posted by matteus <ma...@hotmail.com>.
I succeeded to solve my problem. I found the site
https://cwiki.apache.org/WICKET/generic-busy-indicator-for-both-ajax-and-non-ajax-submits.html 
where shows an example of ajax and non ajax button to put the veil . Then I
created the files. Css and. Js with these samples and placed in the same
directory of my. Java. Then in my java page I added this:

private static final CompressedResourceReference MYPAGE_JS = new
CompressedResourceReference (Index.class, "veil.js");

private static final CompressedResourceReference MYPAGE_CSS = new
CompressedResourceReference (Index.class, "veil.css");

To reference the css and javascript.

Then just add it to your page

add (JavascriptPackageResource.getHeaderContribution (MYPAGE_JS));
    
     add (CSSPackageResource.getHeaderContribution (MYPAGE_CSS));

and this html:

<div id="bysy_indicator"> </ div>

works for ajax and non ajax Button



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Veil-behavior-of-wicketstuff-minis-tp2228127p4395959.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Veil behavior of wicketstuff-minis

Posted by matteus <ma...@hotmail.com>.
Someone can help with the veil behavior, because until now I could not make
it works.

Thankss.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Veil-behavior-of-wicketstuff-minis-tp2228127p4352522.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Veil behavior of wicketstuff-minis

Posted by matteus <ma...@hotmail.com>.
In my method I call this

protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
				form.add(new Veil());
				target.addComponent(form);
				
			--	method to be execute ---

				form.add(new DisabledVeil());
				target.addComponent(form);

The class viel :

public class Veil extends VeilResources {
	private static final long serialVersionUID = 8017992550548909810L;
	private Component component;
	private String cssClassName;

	public Veil() {
	}

	public Veil(String cssClassName) {
		if (!Strings.isEmpty(cssClassName))
			this.cssClassName = cssClassName;
	}

	public void bind(Component component) {
		super.bind(component);
		if (this.component != null) {
			throw new IllegalStateException(
					"This behavior is already bound to component. An instance of this
behavior cannot be reused between components. Bound component: "
							+ this.component.toString());
		}

		this.component = component;
	}

	private String getCssClassName() {
		return (this.cssClassName != null) ? this.cssClassName : "wicket-veil";
	}

	public void renderHead(IHeaderResponse response) {
		super.renderHead(response);
	
response.renderOnDomReadyJavascript(VeilResources.Javascript.show(this.component));
	}

The class disable viel
public class DisabledVeil extends Veil {
	private static final long serialVersionUID = 66447383785577749L;

	public DisabledVeil() {
	}

	public DisabledVeil(String cssClassName) {
		super(cssClassName);
	}


	public boolean isEnabled(Component component) {
		return (super.isEnabled(component)) && (component.isEnabled()) &&
(component.isEnableAllowed());
	}
}


the class resource:

public class VeilResources extends AbstractBehavior implements
IHeaderContributor {
	private static final long serialVersionUID = -4054673989711649496L;

	private static final ResourceReference JS = new
JavascriptResourceReference(VeilResources.class, "wicket-veil.js");

	private static final ResourceReference CSS = new
ResourceReference(VeilResources.class, "wicket-veil.css");
	public static final String DEFAULT_CSS_CLASS_NAME = "wicket-veil";

	@Override
	public void bind(Component component) {
		super.bind(component);
		component.setOutputMarkupId(true);
	}

	@Override
	public void renderHead(IHeaderResponse response) {
		super.renderHead(response);
		response.renderJavascriptReference(JS);
		response.renderCSSReference(CSS);
	}

	public static class Javascript {
		public static String hide(Component component) {
			return Generic.hide(component.getMarkupId());
		}

		public static String show(Component component) {
			return Generic.show(component.getMarkupId());
		}

		public static String show(Component component, String className) {
			return Generic.show(component.getMarkupId(), className);
		}

		public static String toggle(Component component) {
			return Generic.toggle(component.getMarkupId());
		}

		public static String toggle(Component component, String className) {
			return Generic.toggle(component.getMarkupId(), className);
		}

		public static class Generic {
			public static String hide(String markupId) {
				return "Wicket.Veil.toggle('" + markupId + "');";
			}

			public static String show(String markupId) {
				return show(markupId, "wicket-veil");
			}

			public static String show(String markupId, String className) {
				return "Wicket.Veil.show('" + markupId + "', {className:'" + className +
"'});";
			}

			public static String toggle(String markupId) {
				return toggle(markupId, "wicket-veil");
			}

			public static String toggle(String markupId, String className) {
				return "Wicket.Veil.toggle('" + markupId + "', {className:'" + className
+ "'});";
			}
		}
	}
}

when i call the class disable viel its not work..


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Veil-behavior-of-wicketstuff-minis-tp2228127p4330145.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Veil behavior of wicketstuff-minis

Posted by Martin Grigorov <mg...@apache.org>.
Show us how you use it.

On Thu, Jan 26, 2012 at 12:39 PM, matteus <ma...@hotmail.com> wrote:
> Hi, I managed to put the veil on my page after I execute a method, but I can
> not remove the veil.
>
> I used the class shown on the site
> http://grepcode.com/file/repo1.maven.org/maven2/org.wicketstuff/minis/1.4.17.1/org/wicketstuff/minis/veil/VeilResources.java
>
> and I can not remove. Someone could help me with this case?
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Veil-behavior-of-wicketstuff-minis-tp2228127p4330008.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Veil behavior of wicketstuff-minis

Posted by matteus <ma...@hotmail.com>.
Hi, I managed to put the veil on my page after I execute a method, but I can
not remove the veil.

I used the class shown on the site 
http://grepcode.com/file/repo1.maven.org/maven2/org.wicketstuff/minis/1.4.17.1/org/wicketstuff/minis/veil/VeilResources.java

and I can not remove. Someone could help me with this case?

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Veil-behavior-of-wicketstuff-minis-tp2228127p4330008.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Veil behavior of wicketstuff-minis

Posted by nmetzger <nm...@odu.edu>.
This is pretty easy to do. I added a veil to my page by implementing
IAjaxIndicatorAware, adding the method getAjaxIndicatorMarkupId() and
providing style definitions on the html side. Like this:

public class MyPage extends WebPage implements IAjaxIndicatorAware{
     public MyPage(){
              //Do what ever you need to do in your contructor
     }

    public String getAjaxIndicatorMarkupId() {
        return "veil";
    }
}

<div id="veil" style="display:none;position:absolute;top:0;left:0;
                             z-index=99999;background-color:grey;
                             width:100%;height:100%;color:white;
                             opacity:0.4;filter:alpha(opacity=40)">
            <h1 style="position:absolute;top:25%;left:25%">Loading ...</h1>
</div>

Hope this helps,

Natalie

-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Veil-behavior-of-wicketstuff-minis-tp2228127p2231564.html
Sent from the Wicket - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org