You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Lucio Crusca <lu...@sulweb.org> on 2014/01/04 18:17:40 UTC

Make a Panel draggable

Hi everybody,

I have a panel that contains a RepeatingView, which in turns generates a 
number of links. The links are generated based on the context (defined as 
current page and previous user actions).

Just now the panel shows up in the top right corner of my webapp and it's 
above other things, and I'd like to let users move it where they want.

My code now is:

public class DataContextPanel extends Panel
{ 
  public DataContextPanel(String id)
  {
    super(id);

    add(new Label("contextTitle", "Context"));

    RepeatingView sels = new RepeatingView("repeating");
    fill(sels);
    add(sels);
...

    <wicket:panel>
      <span wicket:id="contextTitle" ></span>
      <table cellspacing="0" class="dataview">
        <tr>
            <th>Type</th>
            <th>Value</th>
            <th>Inhibit</th>
            <th>Forget</th>
        </tr>
        <tr wicket:id="repeating">
          <td><span wicket:id="tablename">Ditta</span><a href="#" 
wicket:id="openDetail">&rArr;</a></td>
          <td><span wicket:id="selectedrow"></span></td>
          <td><a href="#" wicket:id="inhibit">&empty;</a></td>
          <td><a href="#" wicket:id="forget">&timesb;</a></td>
        </tr>
      </table>
    </wicket:panel>

and, in the page, I have a simple <div> as placeholder for it.

I've tried to change the class and make it extend Draggable from 
wicket-jquery-ui instead of Panel, and changed wicket:panel to wicket:extend, 
but I got the following exception:

org.apache.wicket.WicketRuntimeException: The component(s) below failed to 
render. Possible reasons could be that: 1) you have added a component in code 
but forgot to reference it in the markup (thus the component will never be 
rendered), 2) if your components were added in a parent container then make 
sure the markup for the child container includes them in <wicket:extend>.

1. [Component id = contextTitle]
2. [RepeatingView [Component id = repeating]]

at org.apache.wicket.Page.checkRendering(Page.java:661)
at org.apache.wicket.Page.onAfterRender(Page.java:818)
at org.apache.wicket.markup.html.WebPage.onAfterRender(WebPage.java:215)
at org.apache.wicket.Component.afterRender(Component.java:892)
at org.apache.wicket.Component.render(Component.java:2319)
at org.apache.wicket.Page.renderPage(Page.java:1010)
...





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


Re: Make a Panel draggable

Posted by Martin Grigorov <mg...@apache.org>.
https://github.com/sebfz1/wicket-jquery-ui/blob/master/wicket-jquery-ui/src/main/java/com/googlecode/wicket/jquery/ui/interaction/draggable/DraggableBehavior.java?source=cc

Martin Grigorov
Wicket Training and Consulting


On Sat, Jan 4, 2014 at 8:40 PM, Ernesto Reinaldo Barreiro <
reiern70@gmail.com> wrote:

> wiquery provides draggable as a behavior: which would solve your problem.
>
>
> On Sat, Jan 4, 2014 at 6:17 PM, Lucio Crusca <lu...@sulweb.org> wrote:
>
> > Hi everybody,
> >
> > I have a panel that contains a RepeatingView, which in turns generates a
> > number of links. The links are generated based on the context (defined as
> > current page and previous user actions).
> >
> > Just now the panel shows up in the top right corner of my webapp and it's
> > above other things, and I'd like to let users move it where they want.
> >
> > My code now is:
> >
> > public class DataContextPanel extends Panel
> > {
> >   public DataContextPanel(String id)
> >   {
> >     super(id);
> >
> >     add(new Label("contextTitle", "Context"));
> >
> >     RepeatingView sels = new RepeatingView("repeating");
> >     fill(sels);
> >     add(sels);
> > ...
> >
> >     <wicket:panel>
> >       <span wicket:id="contextTitle" ></span>
> >       <table cellspacing="0" class="dataview">
> >         <tr>
> >             <th>Type</th>
> >             <th>Value</th>
> >             <th>Inhibit</th>
> >             <th>Forget</th>
> >         </tr>
> >         <tr wicket:id="repeating">
> >           <td><span wicket:id="tablename">Ditta</span><a href="#"
> > wicket:id="openDetail">&rArr;</a></td>
> >           <td><span wicket:id="selectedrow"></span></td>
> >           <td><a href="#" wicket:id="inhibit">&empty;</a></td>
> >           <td><a href="#" wicket:id="forget">&timesb;</a></td>
> >         </tr>
> >       </table>
> >     </wicket:panel>
> >
> > and, in the page, I have a simple <div> as placeholder for it.
> >
> > I've tried to change the class and make it extend Draggable from
> > wicket-jquery-ui instead of Panel, and changed wicket:panel to
> > wicket:extend,
> > but I got the following exception:
> >
> > org.apache.wicket.WicketRuntimeException: The component(s) below failed
> to
> > render. Possible reasons could be that: 1) you have added a component in
> > code
> > but forgot to reference it in the markup (thus the component will never
> be
> > rendered), 2) if your components were added in a parent container then
> make
> > sure the markup for the child container includes them in <wicket:extend>.
> >
> > 1. [Component id = contextTitle]
> > 2. [RepeatingView [Component id = repeating]]
> >
> > at org.apache.wicket.Page.checkRendering(Page.java:661)
> > at org.apache.wicket.Page.onAfterRender(Page.java:818)
> > at org.apache.wicket.markup.html.WebPage.onAfterRender(WebPage.java:215)
> > at org.apache.wicket.Component.afterRender(Component.java:892)
> > at org.apache.wicket.Component.render(Component.java:2319)
> > at org.apache.wicket.Page.renderPage(Page.java:1010)
> > ...
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
>
> --
> Regards - Ernesto Reinaldo Barreiro
>

Re: Make a Panel draggable

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
wiquery provides draggable as a behavior: which would solve your problem.


On Sat, Jan 4, 2014 at 6:17 PM, Lucio Crusca <lu...@sulweb.org> wrote:

> Hi everybody,
>
> I have a panel that contains a RepeatingView, which in turns generates a
> number of links. The links are generated based on the context (defined as
> current page and previous user actions).
>
> Just now the panel shows up in the top right corner of my webapp and it's
> above other things, and I'd like to let users move it where they want.
>
> My code now is:
>
> public class DataContextPanel extends Panel
> {
>   public DataContextPanel(String id)
>   {
>     super(id);
>
>     add(new Label("contextTitle", "Context"));
>
>     RepeatingView sels = new RepeatingView("repeating");
>     fill(sels);
>     add(sels);
> ...
>
>     <wicket:panel>
>       <span wicket:id="contextTitle" ></span>
>       <table cellspacing="0" class="dataview">
>         <tr>
>             <th>Type</th>
>             <th>Value</th>
>             <th>Inhibit</th>
>             <th>Forget</th>
>         </tr>
>         <tr wicket:id="repeating">
>           <td><span wicket:id="tablename">Ditta</span><a href="#"
> wicket:id="openDetail">&rArr;</a></td>
>           <td><span wicket:id="selectedrow"></span></td>
>           <td><a href="#" wicket:id="inhibit">&empty;</a></td>
>           <td><a href="#" wicket:id="forget">&timesb;</a></td>
>         </tr>
>       </table>
>     </wicket:panel>
>
> and, in the page, I have a simple <div> as placeholder for it.
>
> I've tried to change the class and make it extend Draggable from
> wicket-jquery-ui instead of Panel, and changed wicket:panel to
> wicket:extend,
> but I got the following exception:
>
> org.apache.wicket.WicketRuntimeException: The component(s) below failed to
> render. Possible reasons could be that: 1) you have added a component in
> code
> but forgot to reference it in the markup (thus the component will never be
> rendered), 2) if your components were added in a parent container then make
> sure the markup for the child container includes them in <wicket:extend>.
>
> 1. [Component id = contextTitle]
> 2. [RepeatingView [Component id = repeating]]
>
> at org.apache.wicket.Page.checkRendering(Page.java:661)
> at org.apache.wicket.Page.onAfterRender(Page.java:818)
> at org.apache.wicket.markup.html.WebPage.onAfterRender(WebPage.java:215)
> at org.apache.wicket.Component.afterRender(Component.java:892)
> at org.apache.wicket.Component.render(Component.java:2319)
> at org.apache.wicket.Page.renderPage(Page.java:1010)
> ...
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Regards - Ernesto Reinaldo Barreiro