Re: Wicket JQuery drag and drop behaviors

2010-11-10 Thread armandoxxx

And I don't .. and that was my main problem :( .. but I got links now ;) 

I tried to find wicket jquery project on wicket stuff and no luck with that
either .. so that's how it all happened :D 

why don't you guys that work on wicket + jquery projects get together and
make one project ? That would make it a lot easier for all of you since
you're making same thing. 

Regards

Armando
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-JQuery-drag-and-drop-behaviors-tp3033676p3035898.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Wicket JQuery drag and drop behaviors

2010-11-10 Thread Ernesto Reinaldo Barreiro
Armando,

Yes maybe you are right... but if type "wicket jquery " on google on
the first page I get references both jWicket and wiQuery and you can
always resort to ask questions on this list;-)

Ernesto

On Wed, Nov 10, 2010 at 8:44 AM, armandoxxx  wrote:
>
> Just a thought for all you posters that provided wicket + jquery project
> links. These links should also be available on wicket pages .. I googled for
> wicket + jquery implementations before I started to implement my own tiny
> little DnD behaviors, but found only wicket + "other JS libs" pages, so
> these links need to be put somewhere on more visible place ... or be more
> promoted ...
>
> Regards
>
> Armando
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Wicket-JQuery-drag-and-drop-behaviors-tp3033676p3035616.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



RE: Wicket JQuery drag and drop behaviors

2010-11-09 Thread armandoxxx

Just a thought for all you posters that provided wicket + jquery project
links. These links should also be available on wicket pages .. I googled for
wicket + jquery implementations before I started to implement my own tiny
little DnD behaviors, but found only wicket + "other JS libs" pages, so
these links need to be put somewhere on more visible place ... or be more
promoted ... 

Regards

Armando
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-JQuery-drag-and-drop-behaviors-tp3033676p3035616.html
Sent from the Users forum mailing list archive at Nabble.com.

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



RE: Wicket JQuery drag and drop behaviors

2010-11-09 Thread armandoxxx

Hey ...

No I haven't. 

Regards

Armando
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-JQuery-drag-and-drop-behaviors-tp3033676p3035602.html
Sent from the Users forum mailing list archive at Nabble.com.

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



RE: Wicket JQuery drag and drop behaviors

2010-11-09 Thread Stefan Lindner
Did you take a look at jWicket 
(http://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-core/jdk-1.5-parent/jwicket-parent/jwicket-ui/jwicket-ui-dragdrop)?

-Ursprüngliche Nachricht-
Von: armandoxxx [mailto:armando@dropchop.com] 
Gesendet: Dienstag, 9. November 2010 14:08
An: users@wicket.apache.org
Betreff: Wicket JQuery drag and drop behaviors


Hey 

Just needed this so I wrote a simple implementation of Drag and Drop for JQuery 
javascript lib. 

So if anyone needs it .. be my guest to comment (and/or diSS) on it  

Put on your page, app or anywhere else cause you need this !!!








DraggableBehavior.java

/**
 *
 */
package org.dropchop.jop.dnd.behaviors.draggable;

import java.util.HashMap;
import java.util.Map;

import org.apache.wicket.Component;
import org.apache.wicket.behavior.AbstractAjaxBehavior;
import org.apache.wicket.markup.html.CSSPackageResource;
import org.apache.wicket.markup.html.IHeaderResponse;
import org.apache.wicket.util.template.PackagedTextTemplate;
import org.apache.wicket.util.template.TextTemplate;
import org.dropchop.jop.dnd.behaviors.droppable.DroppableBehavior;


/**
 * @author armando 
 *
 */
public class DraggableBehavior extends AbstractAjaxBehavior {

private static final long serialVersionUID = -4879330165262306147L;

//JQuery options
private DragType dragType   = DragType.ORIGINAL;



/**
 * Drag type for jQuery helper.
 * CLONE - clones panel and after panel is droped cloned panel
dissapears.
 * ORIGINAL  - moves the original panel through the page.
 * @author armando 
 */
public enum DragType {
ORIGINAL("original"), CLONE("clone");

private String type = null;

/**
 * Private constructor.
 * @param theType  jquery constant string
 */
private DragType(final String theType) {
this.type   = theType;
} 


/**
 * Gets JQuery drag type constant.
 * @return string.
 */
public String getType() {
return this.type;
}
}


/**
 * Sets drag type for draggable component
 * @param theType
 * @return  reference to itself for chaining.
 */
public DraggableBehavior setDragType(final DragType theType) {
this.dragType   = theType;
return this;
}


@Override
public void renderHead(final IHeaderResponse theResponse) {
super.renderHead(theResponse);

theResponse.renderOnDomReadyJavascript(this.getJavaScriptCode(this.getComponent()));
} 


@Override
protected void onBind() {
getComponent().setOutputMarkupId(true);
//uncomment this if you need styles for draggable component!

//getComponent().add(CSSPackageResource.getHeaderContribution(DroppableBehavior.class,
"css/styles.css"));
}


/**
 * Uses js file as a template and returns parsed output.
 * 
 * @param theComponentId  id of date time field component.
 * @return javascript code string.
 * 
 * Note: this might be a performance issue ... figure and test it 
out!!! 
 */
private String getJavaScriptCode(final Component theComponent) {
PackagedTextTemplate template = new 
PackagedTextTemplate(getClass(), "js/DraggableBehavior.js", "text/javascript");
Map params = new HashMap();
params.put("componentId", theComponent.getMarkupId());
params.put("helper", this.dragType.getType());
params.put("wicketPath", theComponent.getPageRelativePath());
TextTemplate interpolated = template.interpolate(params);
return interpolated.asString();
}


/* (non-Javadoc)
 * @see org.apache.wicket.behavior.IBehaviorListener#onRequest()
 */
@Override
public void onRequest() {}


}




DraggableBehavior.js << servers as a template for javascript code


$("#${componentId}").draggable(
{
cursor  : 'pointer',
helper  : '${helper}'
}
);
$('#${componentId}').data('wicketPath', '${wicketPath}');



DroppableBehavior.java

package org.dropchop.jop.dnd.behaviors.droppable;

import java.util.HashMap;
import java.util.Map;

import org.apache.wicket.Component;
import org.apache.wicket.Request;
import org.apache.wicket.RequestCycle;
import org.apache.wicke

Re: Wicket JQuery drag and drop behaviors

2010-11-09 Thread Ernesto Reinaldo Barreiro
Armando,

Thanks for sharing. Did you know about [1] and [2]?

Regards,

Ernesto

1-http://code.google.com/p/wiquery/source/browse/trunk/src/main/java/org/odlabs/wiquery/ui/draggable/DraggableAjaxBehavior.java
2-http://code.google.com/p/wiquery/source/browse/trunk/src/main/java/org/odlabs/wiquery/ui/droppable/DroppableAjaxBehavior.java


On Tue, Nov 9, 2010 at 2:30 PM, armandoxxx  wrote:
>
> Just to let everyone know, this is just a simple imeplementation, there are
> no events triggered on draggable and therefore no methods called, so if
> anyone needs it just implement it ..
> So all the NPE checks and that kinda  stuff is still needed !
> All I needed for my case was to get the dropped component and I needed it to
> be done with JQuery.
>
> Regards
>
> Armando
>
>
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Wicket-JQuery-drag-and-drop-behaviors-tp3033676p3033703.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



Re: Wicket JQuery drag and drop behaviors

2010-11-09 Thread Martin Makundi
Nice.

**
Martin

2010/11/9 armandoxxx :
>
>
> /**
>         * Notification method that a drop happened on this component.
>         * @param theComponent  reference to dropped component.
>         */
>        protected void onDrop(final AjaxRequestTarget theTarget, final 
> Component
> theComponent) {
>                System.out.println("Dropped:" + 
> theComponent.getClass().getName());
>        }
>
>
> you get the draggable component that was dropped.
>
> Regards
>
> Armando
>
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Wicket-JQuery-drag-and-drop-behaviors-tp3033676p3033686.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



Re: Wicket JQuery drag and drop behaviors

2010-11-09 Thread julien roche AKA indiana_jules
Hi Armandoxxx,

If you want, you have too an implementation for your case with wiQuery (see:
http://wiquery-examples-1-1-x.appspot.com/?wicket:bookmarkablePage=:org.odlabs.wiquery.examples.droppable.DroppablePage).
But your approach is very ligthweight !!

Regards

Julien


On Tue, Nov 9, 2010 at 2:30 PM, armandoxxx  wrote:

>
> Just to let everyone know, this is just a simple imeplementation, there are
> no events triggered on draggable and therefore no methods called, so if
> anyone needs it just implement it ..
> So all the NPE checks and that kinda  stuff is still needed !
> All I needed for my case was to get the dropped component and I needed it
> to
> be done with JQuery.
>
> Regards
>
> Armando
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Wicket-JQuery-drag-and-drop-behaviors-tp3033676p3033703.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Wicket JQuery drag and drop behaviors

2010-11-09 Thread armandoxxx

Hey guys .. 

10x for sharing .. 
Was looking for it .. but didn't find anything so I implemented it on my
own;) 

Regards

Armando


-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-JQuery-drag-and-drop-behaviors-tp3033676p3034347.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Wicket JQuery drag and drop behaviors

2010-11-09 Thread armandoxxx


/**
 * Notification method that a drop happened on this component.
 * @param theComponent  reference to dropped component.
 */
protected void onDrop(final AjaxRequestTarget theTarget, final Component
theComponent) {
System.out.println("Dropped:" + 
theComponent.getClass().getName());
}


you get the draggable component that was dropped. 

Regards

Armando


-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-JQuery-drag-and-drop-behaviors-tp3033676p3033686.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Wicket JQuery drag and drop behaviors

2010-11-09 Thread Martin Makundi
Can it automatically detect which draggable dropped on droppable landing spot?

**
Martin

2010/11/9 armandoxxx :
>
> Hey
>
> Just needed this so I wrote a simple implementation of Drag and Drop for
> JQuery javascript lib.
>
> So if anyone needs it .. be my guest to comment (and/or diSS) on it
>
> Put on your page, app or anywhere else cause you need this !!!
>
> 
>  href="css/jquery/smoothness/jquery-ui-1.8.2.custom.css" />
>                 src="js/jquery-1.4.3.min.js">
>                 src="js/jquery-ui-1.8.2.custom.min.js">
> 
>
>
> DraggableBehavior.java
>
> /**
>  *
>  */
> package org.dropchop.jop.dnd.behaviors.draggable;
>
> import java.util.HashMap;
> import java.util.Map;
>
> import org.apache.wicket.Component;
> import org.apache.wicket.behavior.AbstractAjaxBehavior;
> import org.apache.wicket.markup.html.CSSPackageResource;
> import org.apache.wicket.markup.html.IHeaderResponse;
> import org.apache.wicket.util.template.PackagedTextTemplate;
> import org.apache.wicket.util.template.TextTemplate;
> import org.dropchop.jop.dnd.behaviors.droppable.DroppableBehavior;
>
>
> /**
>  * @author armando 
>  *
>  */
> public class DraggableBehavior extends AbstractAjaxBehavior {
>
>        private static final long serialVersionUID = -4879330165262306147L;
>
>        //JQuery options
>        private DragType dragType       = DragType.ORIGINAL;
>
>
>
>        /**
>         * Drag type for jQuery helper.
>         * CLONE     - clones panel and after panel is droped cloned panel
> dissapears.
>         * ORIGINAL  - moves the original panel through the page.
>         * @author armando 
>         */
>        public enum DragType {
>                ORIGINAL("original"), CLONE("clone");
>
>                private String type     = null;
>
>                /**
>                 * Private constructor.
>                 * @param theType  jquery constant string
>                 */
>                private DragType(final String theType) {
>                        this.type       = theType;
>                }
>
>
>                /**
>                 * Gets JQuery drag type constant.
>                 * @return string.
>                 */
>                public String getType() {
>                        return this.type;
>                }
>        }
>
>
>        /**
>         * Sets drag type for draggable component
>         * @param theType
>         * @return  reference to itself for chaining.
>         */
>        public DraggableBehavior setDragType(final DragType theType) {
>                this.dragType   = theType;
>                return this;
>        }
>
>
>       �...@override
>        public void renderHead(final IHeaderResponse theResponse) {
>                super.renderHead(theResponse);
>
> theResponse.renderOnDomReadyJavascript(this.getJavaScriptCode(this.getComponent()));
>        }
>
>
>       �...@override
>        protected void onBind() {
>                getComponent().setOutputMarkupId(true);
>                //uncomment this if you need styles for draggable component!
>
> //getComponent().add(CSSPackageResource.getHeaderContribution(DroppableBehavior.class,
> "css/styles.css"));
>        }
>
>
>        /**
>         * Uses js file as a template and returns parsed output.
>         *
>         * @param theComponentId  id of date time field component.
>         * @return javascript code string.
>         *
>         * Note: this might be a performance issue ... figure and test it 
> out!!!
>         */
>        private String getJavaScriptCode(final Component theComponent) {
>                PackagedTextTemplate template = new 
> PackagedTextTemplate(getClass(),
> "js/DraggableBehavior.js", "text/javascript");
>                Map params = new HashMap();
>                params.put("componentId", theComponent.getMarkupId());
>                params.put("helper", this.dragType.getType());
>                params.put("wicketPath", theComponent.getPageRelativePath());
>                TextTemplate interpolated = template.interpolate(params);
>                return interpolated.asString();
>        }
>
>
>        /* (non-Javadoc)
>         * @see org.apache.wicket.behavior.IBehaviorListener#onRequest()
>         */
>       �...@override
>        public void onRequest() {}
>
>
> }
>
>
>
>
> DraggableBehavior.js << servers as a template for javascript code
>
>
> $("#${componentId}").draggable(
>        {
>                cursor          : 'pointer',
>                helper          : '${helper}'
>        }
> );
> $('#${componentId}').data('wicketPath', '${wicketPath}');
>
>
>
> DroppableBehavior.java
>
> package org.dropchop.jop.dnd.behaviors.droppable;
>
> import java.util.HashMap;
> import java.util.Map;
>
> import org.apache.wicket.Component;
> import org.apache.wicket.Request;
> import org.apache.wicket.RequestCycle;
> import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior;
> import org.apache.wicket.ajax.AjaxRequestTarget;
> import org.apache.wicket.markup.html.CSSPackageResource;

Re: Wicket JQuery drag and drop behaviors

2010-11-09 Thread armandoxxx

Just to let everyone know, this is just a simple imeplementation, there are
no events triggered on draggable and therefore no methods called, so if
anyone needs it just implement it .. 
So all the NPE checks and that kinda  stuff is still needed ! 
All I needed for my case was to get the dropped component and I needed it to
be done with JQuery.

Regards

Armando



-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-JQuery-drag-and-drop-behaviors-tp3033676p3033703.html
Sent from the Users forum mailing list archive at Nabble.com.

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