image from data

2011-07-02 Thread Miroslav F.
Hi folks,

I have images in database as BLOBs and retrieving it with JDBC (not good
code, just test at the moment)
with this (just snip of the code):

conn = Utils.makeConnection();//make connection with JDBC
try
{
conn.setAutoCommit(false);
st = conn.createStatement();
rs = st.executeQuery(SELECT * FROM testdatabase.images);
LargeObjectManager lobj = ((org.postgresql.PGConnection)
conn).getLargeObjectAPI();
while(rs.next())
{
Long oid = rs.getLong(7);
LargeObject obj = lobj.open(oid, LargeObjectManager.READ);
byte buf[] = new byte[obj.size()];
obj.read(buf, 0, obj.size());
//--now I have image data in buf[], how can I put them into
html?
obj.close();
}
rs.close();
st.close();
conn.commit();
}
catch(SQLException e)
{
e.printStackTrace();
}

How can I put this image data into html page? Save it as file onto file
system and then
insert in src atribute of img tag? Or something else? Example is welcome.

Thanks in advance,

Miro


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



Re: ResourceReference.getResource() returns NULL ?

2011-07-02 Thread Jim Pinkham
Search for Dynamically loading image for good examples of how to do this.

Basically, you do not put the image data directly into HTML.  Instead, you
make your page.html  with some table perhaps, and a series of links to your
images.  So you would need one method to list the ids of your images to put
as a parameters into your links.   Then, you will 'mount' the resource in
your application class at app init time, which will allow your app to serve
up the image data for each img src=mountpoint?id=123 tag.

Good luck
Jim

On Tue, Feb 22, 2011 at 8:00 AM, smallufo small...@gmail.com wrote:

 I want to build a DynamicImageResource which can scale internal (packaged)
 images (with name : {index}.gif ) .
 In getImageData() , I try to load a truly existing image , but cannot
 getResource() , it returns null !

 Here is my code :

 public class ScaledImageResource extends DynamicImageResource
 {
  private ThreadLocalInteger index = new ThreadLocalInteger();
  private ThreadLocalInteger width = new ThreadLocalInteger();
  private ThreadLocalInteger height = new ThreadLocalInteger();

  @Override
  public IResourceStream getResourceStream()
  {
ValueMap map = getParameters();
index .set(map.getAsInteger(index ,  1));
width .set(map.getAsInteger(width , 50));
height.set(map.getAsInteger(height, 50));
return super.getResourceStream();
  }

  @Override
  protected byte[] getImageData()
  {
ResourceReference imageResource = new ResourceReference(MyPage.class ,
 icons/byIndex/+index.get()+.gif);
http://foobar.com/app/resources/foo.bar.MyPage/icons/byIndex/1.gif does
 exist !

try
{
  System.out.println(imageResource.getResource() =  +
 imageResource.getResource()); // returns NULL
  InputStream is =
 imageResource.getResource().getResourceStream().getInputStream();
  BufferedImage bufferedImage = ImageIO.read(is);
  BufferedImage scaledImage = BufferedImageTools.getImage(bufferedImage,
 width.get() , height.get());

  byte[] bytes = null;
  //scale image , build bytes  , skipped here.
  return bytes;
}
catch (Exception e)
{
}
return null;
  }
 }

 And in Application's init():
 getSharedResources().add(IMG_KEY, new ScaledImageResource());
 mountSharedResource(/scaledImage, new
 ResourceReference(IMG_KEY).getSharedResourceKey());

 Note , the image file does exist there ,
 and http://foobar.com/app/resources/foo.bar.MyPage/icons/byIndex/1.gifdoes
 browsable !

 But why cannot I getResource() of the imageResource ?



replace panel in dialog box

2011-07-02 Thread ruchi
Hi,

im trying to replace panels inside a dialog box, but it wroks only first
time.
i have a page which contains a dialog box, when i initially create the page
i put a blank panel inside the dialog box, the page also has one link on
click of which i want to replace the panel inside the dialog box.
1st time it works but when i again click on the link it shows the blank
panel inside the dislog box.

pls let me know wat im doing wrong, here's the code snippet:

Dialog modifyDialog = new Dialog(modifyDialogPanel);
modifyDialog.setCssClass(noTitleDialog);
modifyDialog.setModal(true).setWidth(850).setHeight(475)
.setOutputMarkupId(true).setMarkupId(modify);
modifyDialog.setAutoOpen(false);
modifyPanel = new BlankAdminPanel(modifyAATemplatePanel);
modifyDialog.add(modifyPanel);

on click of link i do:

WebMarkupContainer tmp = new ModifyAATemplate(modifyAATemplatePanel, aat);
modifyPanel.replaceWith(tmp);
modifyPanel = tmp;
tmp.setOutputMarkupId(true);
target.addComponent(tmp);

modifyDialog.remove(modifyPanel);
modifyDialog.add(tmp);

target.addComponent(modifyDialog.setOutputMarkupId(true));

modifyDialog.open(target);


thanks in advance

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/replace-panel-in-dialog-box-tp3640377p3640377.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: image from data

2011-07-02 Thread Adam Gray
Perhaps check out DynamicImageResource?

On Sat, Jul 2, 2011 at 7:39 AM, Miroslav F. mir...@seznam.cz wrote:

 Hi folks,

 I have images in database as BLOBs and retrieving it with JDBC (not good
 code, just test at the moment)
 with this (just snip of the code):

 conn = Utils.makeConnection();//make connection with JDBC
 try
 {
conn.setAutoCommit(false);
st = conn.createStatement();
rs = st.executeQuery(SELECT * FROM testdatabase.images);
LargeObjectManager lobj = ((org.postgresql.PGConnection)
 conn).getLargeObjectAPI();
while(rs.next())
{
Long oid = rs.getLong(7);
LargeObject obj = lobj.open(oid, LargeObjectManager.READ);
byte buf[] = new byte[obj.size()];
obj.read(buf, 0, obj.size());
//--now I have image data in buf[], how can I put them into
 html?
obj.close();
}
rs.close();
st.close();
conn.commit();
 }
 catch(SQLException e)
 {
e.printStackTrace();
 }

 How can I put this image data into html page? Save it as file onto file
 system and then
 insert in src atribute of img tag? Or something else? Example is welcome.

 Thanks in advance,

 Miro


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




resetting form components

2011-07-02 Thread ruchi
Hi, 

im taking input from user in the form components and trying to reset them
when they are shown next time, i have tried doing form.clearInput(), i have
also set model values to blank, and also done form.modelChanged() after
setting the default model. 
i have also specifically set the nameField.setModelValue(new String[] {});
but nothings working. 
please could somebdy tell me what im doing wrong, here's the code snippet: 

im doing the following on button submit after my all other processing: 

model.setName(); 
model.setDesc(); 
model.getProducts().clear(); 
createTemplateForm.clearInput(); 
reateTemplateForm.setDefaultModelObject(new CreateTemplateModel()); 
createTemplateForm.modelChanged(); 
nameField.setModelValue(new String[] {}); 
descField.setModelValue(new String[] {}); 

thanks in advance 

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/resetting-form-components-tp3640382p3640382.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



ajax GET stopped because of precondition check

2011-07-02 Thread Kurt Sys
Hey all,

In IE, I can't get lazyloadpanels to load. I have a webapp with some
lazyloadpanels, and none of them loads in IE - in other browsers, there is
no problem. (Also, the content of an iframe doesn't load, which seems to be
related, since it is also an ajax-request.) I've been trying both IE 8 and
IE 9 on three different pc's. Can someone give me a clue why it won't work
in IE? (IE security settings are set to low, scripts etc are
enabled/allowed, so I suppose ajax-requests can be performed... if not, I
have no clue how to allow ajax in IE.) You may check it out:
http://www.tinyleaps.be

I've been checking on similar problems with lazyloadpanel in ie, and the
problem was known in 2008 (if it's the same, but it looks really similar):
http://www.mail-archive.com/users@wicket.apache.org/msg18815.html
There seems to be a bug report and a 'fixed' status, although it doesn't
seem to work out fine for me - the last comment states that the fix is not
confirmed. Or I am  missing something, which wouldn't really surprise me :),
or there still something wrong with the precondition stuff and loading the
panel in IE:
https://issues.apache.org/jira/browse/WICKET-1653


Ajax debug window (only these three lines):
--
INFO: Ajax GET stopped because of precondition check,
url:?wicket:interface=:3:mainpanel:bloglist:1:commentaar::IBehaviorListener:0:
INFO: Ajax GET stopped because of precondition check,
url:?wicket:interface=:3:mainpanel:bloglist:2:commentaar::IBehaviorListener:0:
INFO: Ajax GET stopped because of precondition check,
url:?wicket:interface=:3:weer::IBehaviorListener:0:
--

HomePage.html:
--
[...]
body
wicket:extend
[...]
  div wicket:id=route /
[...]
div wicket:id=mainpanel /
[...]
div wicket:id=weer class=weer nbsp;
/div
[...]
  /div
/wicket:extend
/body
/html
--

HomePage.java:
--
[...]

public class HomePage
  extends BasePage {

   Panel mainPanel;
   Label linktekst;


   public HomePage() {
  this(null);
   }


   public HomePage(PageParameters pars) {
[...]
  add(new RoutePanel(route));


  if (pars != null) {
 mainPanel = new BlogPanel(mainpanel, pars.getAsInteger(id));
  }
  else {
 mainPanel = new BlogPanel(mainpanel);
  }

  add(mainPanel);
[...]
  add(new AjaxLazyLoadPanel(weer) {

 @Override
 public Component getLazyLoadComponent(String markupId) {
return new WeerPanel(markupId,
reis.getBlogitemList().get(0).getLocation().getName());
 }

  });
   }

}
--

BlogPanel.html
--
[...]
  wicket:panel
[...]
 ul class=bloglist
li wicket:id=bloglist class=blogitem
[...]
   div wicket:id=commentaar /
 /div
[...]
/li
 /ul
[...]
  /wicket:panel
   /body
/html
--

BlogPanel.java:
--
[...]
public final class BlogPanel
  extends Panel {

   private static final int ITEMSPERPAGE = 3;

   public BlogPanel(String id) {
  this(id, 0);
   }


   public BlogPanel(final String id, final int blogid) {
  super(id);

  setOutputMarkupId(true);

[...]
  ListBlogitem blogitemList =
Q.EM.createNamedQuery(Blogitem.findAll, Blogitem.class).
setHint(QueryHints.REFRESH, HintValues.TRUE).getResultList();

  BlogListView blogListView = new BlogListView(
bloglist,
new ListDataProvider(blogitemList),
ITEMSPERPAGE) {

 @Override
 protected void populateItem(final ItemBlogitem item) {

[...]
item.add(new AjaxLazyLoadPanel(commentaar) {

   @Override
   public Component getLazyLoadComponent(String markupId) {
  return new CommentaarPanel(markupId,
item.getModelObject());
   }

});
[...]
 }

  };

[...]
  add(blogListView);

[...]
}

abstract class BlogListView
  extends DataViewBlogitem {

   BlogListView(String id, ListDataProvider ldp, int i) {
  super(id, ldp, i);
   }

[...]
   }
}
--

CommentaarPanel.html:
--
[...]
   body
  wicket:panel
 div wicket:id=commentaarToevoegen /
 ul
li wicket:id=commentaarList class=commentaar
   p class=zegtspan wicket:id=tijdstip / - span
wicket:id=commentator class=schrift commentator / laat weten:/p
   p wicket:id=tekst class=schrift /
/li
div wicket:id=commentaarNav class=navigator navigatordown
/
 /ul
  /wicket:panel
   /body
/html
--

CommentaarPanel.java:
--
[...]
public final class CommentaarPanel
  extends Panel {

   private Blogitem blog;
   private ListComment commentList;
   private DataViewComment commentListView;


   public CommentaarPanel(String id, Blogitem blog) {
  super(id);

  this.blog = blog;

  setOutputMarkupId(true);

  commentList = blog.getCommentList();
  Collections.sort(commentList);
  commentListView =
new 

inmethod-grid generics

2011-07-02 Thread Duy Do


Hi wicketers,

I found inmethod-gric generics for wicket 1.5 on wicketstuff but can not 
find one for wicket 1.4.x. Is there any maven repo for 1.4.x?


Thanks,
Duy

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



Re: ajaxlazyloadpanel and ie

2011-07-02 Thread Kurt Sys
updated info and code in 
http://apache-wicket.1842946.n4.nabble.com/ajax-GET-stopped-because-of-precondition-check-td3640560.html
new thread 

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/ajaxlazyloadpanel-and-ie-tp3637730p3640599.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: resetting form components

2011-07-02 Thread Andrea Del Bene

HI,

are you sure that button submit is executed? Have you debugged it? Maybe 
the code is not executed because form has some validation errors...

Hi,

im taking input from user in the form components and trying to reset them
when they are shown next time, i have tried doing form.clearInput(), i have
also set model values to blank, and also done form.modelChanged() after
setting the default model.
i have also specifically set the nameField.setModelValue(new String[] {});
but nothings working.
please could somebdy tell me what im doing wrong, here's the code snippet:

im doing the following on button submit after my all other processing:

model.setName();
model.setDesc();
model.getProducts().clear();
createTemplateForm.clearInput();
reateTemplateForm.setDefaultModelObject(new CreateTemplateModel());
createTemplateForm.modelChanged();
nameField.setModelValue(new String[] {});
descField.setModelValue(new String[] {});

thanks in advance

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/resetting-form-components-tp3640382p3640382.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: replace panel in dialog box

2011-07-02 Thread Andrea Del Bene

Hi,

on click of link try to replace your code with this one:

WebMarkupContainer tmp = new ModifyAATemplate(modifyAATemplatePanel, aat);
modifyPanel.replaceWith(tmp);
modifyPanel = tmp;
tmp.setOutputMarkupId(true);

target.addComponent(modifyDialog);
modifyDialog.open(target);





Hi,

im trying to replace panels inside a dialog box, but it wroks only first
time.
i have a page which contains a dialog box, when i initially create the page
i put a blank panel inside the dialog box, the page also has one link on
click of which i want to replace the panel inside the dialog box.
1st time it works but when i again click on the link it shows the blank
panel inside the dislog box.

pls let me know wat im doing wrong, here's the code snippet:

Dialog modifyDialog = new Dialog(modifyDialogPanel);
modifyDialog.setCssClass(noTitleDialog);
modifyDialog.setModal(true).setWidth(850).setHeight(475)
.setOutputMarkupId(true).setMarkupId(modify);
modifyDialog.setAutoOpen(false);
modifyPanel = new BlankAdminPanel(modifyAATemplatePanel);
modifyDialog.add(modifyPanel);

on click of link i do:

WebMarkupContainer tmp = new ModifyAATemplate(modifyAATemplatePanel, aat);
modifyPanel.replaceWith(tmp);
modifyPanel = tmp;
tmp.setOutputMarkupId(true);
target.addComponent(tmp);

modifyDialog.remove(modifyPanel);
modifyDialog.add(tmp);

target.addComponent(modifyDialog.setOutputMarkupId(true));

modifyDialog.open(target);


thanks in advance

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/replace-panel-in-dialog-box-tp3640377p3640377.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: Application with name 'xxxx' already exists.

2011-07-02 Thread Marc Ende
Hmm... there is just one, no more. :(

Am 30.06.2011 10:23, schrieb Martin Grigorov:
 This can happen when you have two WicketFilter declarations in web.xml
 with the same name.

 On Thu, Jun 30, 2011 at 9:00 AM, me mli...@e-beyond.de wrote:
 Hi,

 the last hours I wanted to give the 1.5-RC a try. But there is one
 Exception which doesn't have
 an effect but it's just irritating:
 After deploying a Web-Application (The Hello-World-Example) on a GF 3.1.
 I'll receive this error:

 SCHWERWIEGEND: WebModule[/X-web]PWC1270: Exception starting filter
 xxx
 java.lang.InstantiationException
at
 org.apache.catalina.core.ApplicationFilterConfig.init(ApplicationFilterConfig.java:124)
at
 org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4625)
at
 org.apache.catalina.core.StandardContext.start(StandardContext.java:5316)
at com.sun.enterprise.web.WebModule.start(WebModule.java:500)
at
 org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:917)
at
 org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:901)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:755)
at
 com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1980)
at
 com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1630)
at com.sun.enterprise.web.WebApplication.start(WebApplication.java:100)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:130)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269)
at
 org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:286)
at
 com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461)
at
 com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
at
 org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:370)
at
 com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:355)
at
 com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:370)
at
 com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1067)
at
 com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:96)
at
 com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1247)
at
 com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1235)
at
 com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:465)
at
 com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:222)
at
 com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:168)
at
 com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
at
 com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:234)
at
 com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:822)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:719)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1013)
at
 com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
at
 com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at
 com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at
 com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at
 com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at
 com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at
 com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at
 com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at
 com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:662)
 Caused by: java.lang.IllegalStateException: Application with name
 'X' already exists.'
at org.apache.wicket.Application.setName(Application.java:847)
at
 org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:307)
at
 org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:284)
at
 org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:266)
at
 org.apache.catalina.core.ApplicationFilterConfig.init(ApplicationFilterConfig.java:120)
... 40 more

 It doesn't affect the functionality of the web-page. It's served as
 usual. On the GF is nothing else
 deployed (Ok. Just one Database Pool).

 Yours

 marc

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







Re: inmethod-grid generics

2011-07-02 Thread Attila Király
Hi Duy,

Generics were added only to the 1.5 branch of inmethod-grid. There is no
plan to backport this to the 1.4 branch.

Attila

2011/7/2 Duy Do doquoc...@gmail.com


 Hi wicketers,

 I found inmethod-gric generics for wicket 1.5 on wicketstuff but can not
 find one for wicket 1.4.x. Is there any maven repo for 1.4.x?

 Thanks,
 Duy

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




form component that is rendered as select or read-only input

2011-07-02 Thread kamiseq
hej,
Im creating a component that is a panel - part of a form. I pass a
LoadableDetachableModel to it with a list of items.
when list size is greater then 1 I display a select html component to render
all choices. but when list contains only one item I would like to show read
only input because at this time user will not be able to choose another item
anyway.

but when I close a page with form and update list (ie item was added so
there is more than one or items was removed so there is only one item) and
reopen the page with the form again I will see form with wrong component
(right?) as whole page was saved and panel with form components will not be
created again (right?).

how can I design this panel so it is more dynamic? should I use repeaters?
or something like that?
thanks for any help

pozdrawiam
Paweł Kamiński

kami...@gmail.com
pkaminski@gmail.com
__


Re: form component that is rendered as select or read-only input

2011-07-02 Thread Igor Vaynberg
panel {
 onconfigure() {
if (items1) { addorreplace(foo, new dropdownchoice(); }
else { addorreplace(foo, new textfield().setenabled(false); }
  }}

-igor

On Sat, Jul 2, 2011 at 12:00 PM, kamiseq kami...@gmail.com wrote:
 hej,
 Im creating a component that is a panel - part of a form. I pass a
 LoadableDetachableModel to it with a list of items.
 when list size is greater then 1 I display a select html component to render
 all choices. but when list contains only one item I would like to show read
 only input because at this time user will not be able to choose another item
 anyway.

 but when I close a page with form and update list (ie item was added so
 there is more than one or items was removed so there is only one item) and
 reopen the page with the form again I will see form with wrong component
 (right?) as whole page was saved and panel with form components will not be
 created again (right?).

 how can I design this panel so it is more dynamic? should I use repeaters?
 or something like that?
 thanks for any help

 pozdrawiam
 Paweł Kamiński

 kami...@gmail.com
 pkaminski@gmail.com
 __


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



Re: WicketFilter.init() called twice with Glassfish

2011-07-02 Thread Bertrand Guay-Paquet
Thanks for your answer Harald. I had taken a look at that bug as well, 
but this is not my case. I don't even have to access a web page to see 
the initialization problem.


Wicket logs show the following on startup:
INFO: init: DevUtils DebugBar Initializer
INFO: init: DevUtils DebugBar Initializer
INFO: init: Wicket extensions initializer
INFO: init: Wicket core library initializer
INFO: init: Wicket extensions initializer
INFO: init: Wicket core library initializer

After more investigation, it seems I was wrong and WicketFilter.init() 
is only called once. Therefore the problem seems to lie inside Wicket.


DefaultClassResolver.getResources(String) returns a list of resources 
that has each resource twice. This is the root cause of the double 
initialization of some resources.


The first set of resource URLs is returned by:
// Try the classloader for the wicket jar/bundle
EnumerationURL resources = 
Application.class.getClassLoader().getResources(name);

loadResources(resources, loadedFiles);

The second identical set of resource URLs is returned by:
// Try the classloader for the user's application jar/bundle
resources = 
Application.get().getClass().getClassLoader().getResources(name);

loadResources(resources, loadedFiles);

Here is the set of unique URLs:
jar:file:/C:/glassfish3/glassfish/domains/domain1/applications/MyEAR/lib/wicket-devutils-1.5-SNAPSHOT.jar!/wicket.properties
jar:file:/C:/glassfish3/glassfish/domains/domain1/applications/MyEAR/lib/wicket-extensions-1.5-SNAPSHOT.jar!/wicket.properties
jar:file:/C:/glassfish3/glassfish/domains/domain1/applications/MyEAR/lib/wicket-core-1.5-SNAPSHOT.jar!/wicket.properties

My EAR archive is the one containing the Wicket libraries in its lib/ 
folder. My WAR archive inside the EAR is a skinny WAR without 3rd 
party libs.


I strongly suspect that the class loader hierarchy of an EAR deployment 
is not appropriate for the way DefaultClassResolver.getResources() 
operates, but I haven't dug deep enough into it yet to understand it fully.


If anybody could shed more light on this that would be great. Also, 
maybe a Wicket dev could give more explanation as to why 
DefaultClassResolver tries multiple class loaders to load resources?


I guess I could override DefaultClassResolver.getResources() for my case 
and only load from one location, but there might be other similar issues 
elsewhere.


Bertrand

On 01/07/2011 12:54 PM, Harald Wellmann wrote:

Am 01.07.2011 18:30, schrieb Bertrand Guay-Paquet:

Hello,

I am deploying a Wicket 1.5 application inside an EAR on Glassfish 3.1.

I noticed that the debug bar was doubled at the top of the browser
window (2 full debug bars). After investigation, the problem is that
WicketFIlter.init() is being called twice each time I start the server.
This causes the debug bar contributors to register twice.

My web.xml contains only Wicket and only once. Roughly the same code did
not behave like this when I used an embedded jetty server and no EJBs or
EAR (single WAR).

I'm trying to set up an environment to step inside Glassfish and see why
the filter is initialized twice. In the meantime, I ask has anybody seen
this double-init behavior before?


Yes, I've seen this on Glassfish 3.0, and the problem was reported as 
fixed:

http://java.net/jira/browse/GLASSFISH-11979

Maybe there's a regression?

Regards,
Harald



-
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: form component that is rendered as select or read-only input

2011-07-02 Thread kamiseq
hym ;]

thanks;]

pozdrawiam
Paweł Kamiński

kami...@gmail.com
pkaminski@gmail.com
__


Wicket/Spring/Junit/Maven - Don't understand what's going on.

2011-07-02 Thread Niranjan Rao
Hi,

I am a new user of wicket and new member of this list.Actually this is
my first post to this mailing list.

I am trying to make Wicket/Spring/Junit/Maven combo work. To make life
more interesting, I have multi module project and one module (WebApp)
depends upon DAL module.

I followed the tutorial at
http://comsysto.wordpress.com/2010/06/04/test-driven-development-with-apache-wicket-and-spring-framework/
 and it works - at least in eclipse. I have imported the project in eclipse 
using m2eclipse/import existing maven file. All the unit tests pass when 
executed in eclipse.

However when I try to test using maven command line, tests do fail. I
have no idea why - as same tests run in eclipse. To make sure, I have
created a new workspace, imported the projects again, and all tests
still pass in eclipse. 

Failing point is clear, spring is not auto wiring the application as
mentioned in above post. As a result wicket tester fails with null
pointer exception. 

As a last resort I added printlns for classpath. In eclipse, I do see
all the expected entries. Same test when executed in maven, just
prints /tmp/surefirebooter8162555418175145722.jar. Not sure if
maven/surefire is combining all jars in one jar and that's causing
problem. 

Any help is greatly appreciated. I can include code also, but not sure
what's the protocol here.

Regards,

- Niranjan


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