wicketstuff-jmx-panel in Wicket 1.4, missing a MarkupContainer.add(Component) ?

2009-03-18 Thread Trent Larson
I'm trying to use the wicketstuff-jmx-panel component as simply as possible:

   add(new JmxPanel("jmx"));

But I get a strange error about a method that doesn't exist:


Caused by: java.lang.NoSuchMethodError:
org.wicketstuff.jmx.markup.html.tree.JmxTreePanel.add(Lorg/apache/wicket/Component;)Lorg/apache/wicket/MarkupContainer;
at
org.wicketstuff.jmx.markup.html.tree.JmxTreePanel.(JmxTreePanel.java:33)
at org.wicketstuff.jmx.markup.html.JmxPanel.(JmxPanel.java:113)
at org.wicketstuff.jmx.markup.html.JmxPanel.(JmxPanel.java:94)


I call it strange because I'm using 1.4-m3, which appears to have the
MarkupContainer.add(Component...) method, so I cannot figure out what it's
trying to tell me.

So is anyone using this in 1.4?  Any idea why it's complaining about "no
such method"?

Thanks!
Trent


Re: How can I share text resources with multiple web applications?

2009-03-18 Thread Trent Larson
Thanks for the suggestion.

For posterity's sake: my problem was actually with the Maven 2 build, where
it ignored the properties file (located in with the Java files) when it
built the jar project.

Trent


On Mon, Mar 16, 2009 at 5:02 PM, Igor Vaynberg wrote:

> see iresourcesettings#addstringresourceloader()
>
> make one that loads your properties from some file you keep on the
> classpath
>
> -igor
>
> On Mon, Mar 16, 2009 at 4:00 PM, Trent Larson 
> wrote:
> > I have 2 web applications, and I would like to allow them to share the
> same
> > text files.  The only way I've found is to make each WebApplication class
> > extend a common ParentApplication class and make a
> > ParentApplication.properties file to contain the common text; then I
> package
> > the common ParentApplication class and properties in a separate jar
> project
> > and include that in each of the web projects.  This works great in
> Eclipse
> > in an exploded environment; unfortunately, it looks like it does not work
> > when I include the ParentApplication artifacts inside a separate jar.  I
> get
> > the following error:
> >
> > Caused by: java.util.MissingResourceException: Unable to find property: '
> > squeeze.presented.by' for component:
>  [class=com.max.web.page.bizopp1Page]
> >at org.apache.wicket.Localizer.getString(Localizer.java:269)
> >.
> >
> >
> > Is there any way to make this work?  Is there another approach where I
> can
> > share the text between these projects?
> >
> > Thanks for any suggestions.
> > Trent
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


How can I share text resources with multiple web applications?

2009-03-16 Thread Trent Larson
I have 2 web applications, and I would like to allow them to share the same
text files.  The only way I've found is to make each WebApplication class
extend a common ParentApplication class and make a
ParentApplication.properties file to contain the common text; then I package
the common ParentApplication class and properties in a separate jar project
and include that in each of the web projects.  This works great in Eclipse
in an exploded environment; unfortunately, it looks like it does not work
when I include the ParentApplication artifacts inside a separate jar.  I get
the following error:

Caused by: java.util.MissingResourceException: Unable to find property: '
squeeze.presented.by' for component:  [class=com.max.web.page.bizopp1Page]
at org.apache.wicket.Localizer.getString(Localizer.java:269)
.


Is there any way to make this work?  Is there another approach where I can
share the text between these projects?

Thanks for any suggestions.
Trent


DatePicker configuration isn't always working

2009-02-19 Thread Trent Larson
We are trying to use the DatePicker, only allowing the selection of days
5-25 of each month.

We've tried adding the following renderer to work with the OutOfBoundsDate,
but it doesn't work when the calendar is initially shown.  For example, if
the pageDate of the calendar is set to 03/2009, the 1st through the 4th of
April and May will be disabled as expected, but the 1st through the 4th of
March will be enabled.  When navigating back to March, the 1st through the
4th are then disabled, as expected!  Also, closing the calendar and
reopening it disables the 1st through the 4th, which is what we want... but
we want it to start out with those dates disabled.

for ( int i = minCal.get(Calendar.*MONTH*); i <= maxCal.get(Calendar.MONTH);
i++){
 javascript += "${calendar}.addRenderer(\"" + (i + 1) + "/1\",
${calendar}.renderOutOfBoundsDate);";
 javascript += "${calendar}.addRenderer(\"" + (i + 1) + "/2\",
${calendar}.renderOutOfBoundsDate);";
 javascript += "${calendar}.addRenderer(\"" + (i + 1) + "/3\",
${calendar}.renderOutOfBoundsDate);";
 javascript += "${calendar}.addRenderer(\"" + (i + 1) + "/4\",
${calendar}.renderOutOfBoundsDate);";
 


We also thought we might do something special on the 'init' method, and we
noticed an old 'appendToInit' method, but it's deprecated.

Thanks for any ideas.
Trent


Re: Anyone have idea on ofbiz framework

2009-02-14 Thread Trent Larson
I've used an old version of it.  It works fairly well, and they work to keep
up with standard interfaces.  However, be prepared for a learning curve with
anything you have to customize; many of the pieces (at least with my
version) are non-standard.  If you anticipate limited customizations and you
want a wide range of its features, it could work well; if you plan much
customization for multiple developers, then I would recommend instead taking
a more standard framework (eg. Seam or Spring) and integrate other standard
projects aimed at your needs... and definitely try to use Wicket for your
view technology!
Trent



On Fri, Feb 13, 2009 at 6:20 PM, Swapna Rachamalla <
swapna.rachama...@gmail.com> wrote:

> Hi
>
> Anyone have any idea on ofbiz framework
>
> Thanks
> Swapna
>
>
>
> On Fri, Feb 13, 2009 at 10:04 AM, Igor Vaynberg  >wrote:
>
> > in your form.onsubmit() you can check the value of the model - which
> > will give you the selected option.
> >
> > -igor
> >
> > On Fri, Feb 13, 2009 at 9:54 AM, Swapna Rachamalla
> >  wrote:
> > > Hi All
> > >
> > > I have a Radio button group For eg imagine
> > >
> > > Country:
> > >
> > >   - USA
> > >   - UK
> > >   - etc
> > >
> > > If one of the country is selected i want to write logic( if any one of
> > the
> > > option is selected.)
> > > which method i have to override for this.( For eg if we have a link
> then
> > we
> > > override the method onClick() and if it is a form we override
> onSubmit()
> > )..
> > >
> > > Thanks
> > > Swapna
> > >
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
>


Re: How to execute Wicket project in Eclipse

2009-02-06 Thread Trent Larson
You will have to run your Wicket application with a J2EE application server.

I've found Run-Jetty-Run to be extremely easy-to-use:

http://code.google.com/p/run-jetty-run/

Trent

On Fri, Feb 6, 2009 at 2:43 PM, Swapna Rachamalla <
swapna.rachama...@gmail.com> wrote:

> Hi All
>
> I have installed Apache wicket plug-ins in Eclipse.
>
> Now iam able to create Wicket Project from File->New->Other->Wicket->Wicket
> Project.
>
> Then it is asking for Project name. So gave some name..
>
> Then it is creating MyApplication which extends WebApplication and
> configured in the web.xml file.
>
> then i created HelloWorld.java
>
> package com.example;
> import org.apache.wicket.markup.html.WebPage;
> import org.apache.wicket.markup.html.basic.Label;
>
>
> public class HelloWorld extends WebPage {
>
>HelloWorld()
>{
>add(new Label("msg","sfjhdsjfdhjdjkf"));
>}
>
> }
>
> and modified MyApplication.java file
>
> public class MyApplication extends WebApplication {
>public MyApplication() {
>
>}
>
>public void init() {
>
>}
>
>@Override
>public Class getHomePage() {
>// TODO Auto-generated method stub
>return HelloWorld.class;
>}
> }
>
> and created HelloWorld.html
>
> 
> 
> Insert title here
> 
> 
> Message goes here
> 
> 
>
> Now Iam unable deploy and run the application.
> can u Plz suggest me how to run this application.
> Iam not using Maven for building the files and i configured Apache Geronimo
> 2.0 Server in Eclipse
>
> Thanks
> Swapna
>


Re: The same *.css and *.js on multiple pages

2009-02-06 Thread Trent Larson
One solution is the "extend" functionality (eg. "wicket:child" and
"wicket:extend").  We use a "BasePage" that all our pages extend, and it
contains all our javascript.  It doesn't add anything else, so there is
almost no HTML (just the "html", "head", and "body" tags) and the Java file
for that page is just a blank class.  (Just make sure that, if they add
anything else to the header, all the extending pages use a "wicket:head" tag
for the additional content.)

Trent



On Fri, Feb 6, 2009 at 8:36 AM, Vasily Vasilkov wrote:

> Hi
>
> I have a few *.css and javascript files. These files are used by all
> pages of my application. Sometimes, I need to change (add/remove)
> files in header of my pages. So, what is the easiest way to do this?
>
> P.S. Will HeaderContributor help me?
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: JavaScriptReference with TextTemplate only returns the first retrieved value

2009-01-16 Thread Trent Larson
Yes, it sounds like caching.  But it's not my browser: even if someone hits
the page from a totally different computer or another browser, I get the
same results: whatever was served first from that file is stuck, and nobody
ever gets any different result.  (If the first browser was not logged in to
the app, then the value is "${password}" for everyone.)  Yes, I tested my
cache as you say.

We've now tested with Tomcat as well, so it's not caching in the app
server.  We've also done Linux vs Windows servers, and with and without
Apache in the middle, running from Eclipse and from scripted startup.  I'm
fairly sure I'm taking advantage of something in Wicket inadvertently; I've
moved this stuff around into the session and a base page and the page
constructor, and with and without any of the "final" keywords that I had at
the beginning, all to no avail.

My latest guess is that one of my shortcut methods that call a static method
(eg. Session.get()) is getting the same one every time (though that's a
stretch because all other pages show dynamics data correctly.)  It's just
the .js file that's always gives the same result, no matter who hits it and
no matter where they're from.

BTW, the URL of the .js resource is this:
.../resources/com.max.backoffice.page.BasePage/sensitive.js

I must have changed something, because I swear it worked a month ago.  Erg.

I'll try any wild ideas.  Thanks!

Trent

PS: Yes, you're absolutely right about the password security!  It hurts me
to even show this as my example.


On Thu, Jan 15, 2009 at 5:13 PM, Igor Vaynberg wrote:

> sounds like your browser is caching it.
>
> try this:
>
> hit the page
> check the value
> empty browser cache
> refresh the page
> see if the value changed...
>
>
> other then that i hope you know that storing a password in cleartext
> inside a js file might not be the best idea :)
>
> -igor
>
> On Thu, Jan 15, 2009 at 4:02 PM, Trent Larson 
> wrote:
> > Some time ago, I wrote the following code to generate a javascript
> resource
> > with values that are unique to each user.  I would have sworn that it
> > worked, and that it would return a different value depending on which
> user
> > was logged in.  However, I've just found that it is now always returning
> the
> > same value, whichever value was first retrieved.  Any ideas?
> >
> > Here's the javascript file (named "sensitive.js"):
> >
> > function getInfoTraxPassword() {
> >  return "${password}";
> > }
> >
> >
> >
> > Here is the Java code:
> >
> >HashMap vars = new HashMap();
> >vars.put("password", currentUser.getPassword());
> >TextTemplateResourceReference ref =
> >  new TextTemplateResourceReference(
> >  BasePage.class,
> >  "sensitive.js",
> >  "text/javascript",
> >  new Model(vars)){
> >  @Override
> >  public Time lastModifiedTime() { return Time.now(); }
> >};
> >add(new JavaScriptReference("sensitiveJavascript", ref));
> >
> >
> > I'm including it in the HTML HEAD this way:
> >
> >
> >
> >
> > I'm currently running the Java code inside the Page class, and with my
> > debugger I see it getting the right value as it steps through the code.
>  Ask
> > me anything else, I dare you!  I swear I've been through every
> combination
> > of logic, but once I hit that javascript file the first time, I can never
> > get any other value for the ${password}.  I'm currently using Jetty for
> the
> > app server, with nothing (like Apache) in between.
> >
> > Any brainstorms are welcome.  Thanks!
> > Trent
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


JavaScriptReference with TextTemplate only returns the first retrieved value

2009-01-15 Thread Trent Larson
Some time ago, I wrote the following code to generate a javascript resource
with values that are unique to each user.  I would have sworn that it
worked, and that it would return a different value depending on which user
was logged in.  However, I've just found that it is now always returning the
same value, whichever value was first retrieved.  Any ideas?

Here's the javascript file (named "sensitive.js"):

function getInfoTraxPassword() {
  return "${password}";
}



Here is the Java code:

HashMap vars = new HashMap();
vars.put("password", currentUser.getPassword());
TextTemplateResourceReference ref =
  new TextTemplateResourceReference(
  BasePage.class,
  "sensitive.js",
  "text/javascript",
  new Model(vars)){
  @Override
  public Time lastModifiedTime() { return Time.now(); }
};
add(new JavaScriptReference("sensitiveJavascript", ref));


I'm including it in the HTML HEAD this way:




I'm currently running the Java code inside the Page class, and with my
debugger I see it getting the right value as it steps through the code.  Ask
me anything else, I dare you!  I swear I've been through every combination
of logic, but once I hit that javascript file the first time, I can never
get any other value for the ${password}.  I'm currently using Jetty for the
app server, with nothing (like Apache) in between.

Any brainstorms are welcome.  Thanks!
Trent


Re: extra 'onclick' is generated for an image wrapped by a link

2008-12-12 Thread Trent Larson
BTW, I don't want our UI team to have to add a component every time they add
a link, so I'll try to avoid Wicket links altogether and have them use raw
links like "?wicket:bookmarkablePage=:Page" (or maybe play with URL
mounting).




On Fri, Dec 12, 2008 at 11:23 AM, Igor Vaynberg wrote:

> dont use wicket:link, use bookmarkablepagelink component instead.
>
> -igor
>
> On Fri, Dec 12, 2008 at 10:19 AM, Trent Larson 
> wrote:
> > I have the following plain HTML where I want an image to be a link to
> > another Wicket-managed page:
> >
> >  > src="../images/products_welcome.jpg" border="0">
> >
> >
> > The link for that page is generated fine, but then Wicket adds an
> 'onclick'
> > event to the 'img' tag that takes the user directly to the image:
> >
> >  > href="?wicket:bookmarkablePage=:com.max.web.page.ProductPage"> > src="../images/products_welcome.jpg" border="0"
> > onclick="window.location.href='../images/products_welcome.jpg';return
> > false;">
> >
> > This seems absolutely wrong.  The result is that a click on the image
> will
> > take users to directly to that image; sometimes it will then continue on
> to
> > the right (ProductPage) page, so users see the image by itself before
> going
> > to the right page, but often it just stops at the image.
> >
> > There is no Java code associated with this.  I get it in 1.4-rc1 (as well
> as
> > 1.4-m3).
> >
> > What is happening, and how can I stop it from generating the 'onclick'
> > javascript?  Thanks!
> >
> > Trent
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


What are your suggestions to ease separation of UI and dev teams?

2008-12-12 Thread Trent Larson
Please help (documentation references, etc) with good ways to work with
Wicket where we have separate UI and dev teams.  I'm looking for any
practices people have found helpful because of the UI surprises we keep
hitting.

For example, our UI group has been inserting graphics and regular links
between parts of our site.  We're able to work through things fairly well,
but there's a case where Wicket adds behavior and/or styling in unexpected
ways:

http://www.nabble.com/extra-%27onclick%27-is-generated-for-an-image-wrapped-by-a-link-td20980894.html

This is something where I would like the UI people to be able to create
graphics and internal links at will without creating Java components or
involving developers.  (We'll try avoiding wicket:link.)  Another example of
surprise is when UI team creates links and Wicket changes the styling (eg.
disabling self-referential link and adding the "em" tag).  Thankfully we
figured how to turn that off, but it took effort; I'd love to be able to
turn off all special rules like that, or somehow tell Wicket minimize
intervention!

I'm trying to maximize our UI team's ability to work independently on
look-and-feel and only involve developers when the functionality is
obviously dynamic.  Maybe it'll take a few more months of trial and error,
but we appreciate any suggestions to ease this process.  Thanks!

Trent


My first cut at such a list:

   - Emphasize and re-emphasize to UI people NOT to play with wicket:id
   values.  Ever.  :-)
   - Avoid wicket:link.  Try full url "?wicket:bookmarkablePage=:Page"
   instead.  (Other options?)
   -
  
http://www.nabble.com/extra-%27onclick%27-is-generated-for-an-image-wrapped-by-a-link-td20980894.html
   - Disable automatic self-referential link styling, or understand it:
   - http://www.nabble.com/%3Cem%3E-tag-in-Link-td16589772.html#a16589772


Re: extra 'onclick' is generated for an image wrapped by a link

2008-12-12 Thread Trent Larson
OK.  Thanks.

And thanks for the quick response!  I appreciate how responsive this mailing
list has been.



On Fri, Dec 12, 2008 at 11:23 AM, Igor Vaynberg wrote:

> dont use wicket:link, use bookmarkablepagelink component instead.
>
> -igor
>
> On Fri, Dec 12, 2008 at 10:19 AM, Trent Larson 
> wrote:
> > I have the following plain HTML where I want an image to be a link to
> > another Wicket-managed page:
> >
> >  > src="../images/products_welcome.jpg" border="0">
> >
> >
> > The link for that page is generated fine, but then Wicket adds an
> 'onclick'
> > event to the 'img' tag that takes the user directly to the image:
> >
> >  > href="?wicket:bookmarkablePage=:com.max.web.page.ProductPage"> > src="../images/products_welcome.jpg" border="0"
> > onclick="window.location.href='../images/products_welcome.jpg';return
> > false;">
> >
> > This seems absolutely wrong.  The result is that a click on the image
> will
> > take users to directly to that image; sometimes it will then continue on
> to
> > the right (ProductPage) page, so users see the image by itself before
> going
> > to the right page, but often it just stops at the image.
> >
> > There is no Java code associated with this.  I get it in 1.4-rc1 (as well
> as
> > 1.4-m3).
> >
> > What is happening, and how can I stop it from generating the 'onclick'
> > javascript?  Thanks!
> >
> > Trent
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


extra 'onclick' is generated for an image wrapped by a link

2008-12-12 Thread Trent Larson
I have the following plain HTML where I want an image to be a link to
another Wicket-managed page:




The link for that page is generated fine, but then Wicket adds an 'onclick'
event to the 'img' tag that takes the user directly to the image:



This seems absolutely wrong.  The result is that a click on the image will
take users to directly to that image; sometimes it will then continue on to
the right (ProductPage) page, so users see the image by itself before going
to the right page, but often it just stops at the image.

There is no Java code associated with this.  I get it in 1.4-rc1 (as well as
1.4-m3).

What is happening, and how can I stop it from generating the 'onclick'
javascript?  Thanks!

Trent


cannot get ContextImage/Path to create the right path

2008-11-07 Thread Trent Larson
I am trying to access different static images that aren't Wicket resources,
though their path is set programmatically by my Wicket pages; unfortunately
I'm seeing strange behavior.

My wicket app is installed under "/myContext/wicketStuff" (with wicketFilter
url-pattern pointing to 'wicketStuff'), but my images are found at the top
level under "/myContext/images", eg. "images/en_US/junk.gif".  I'm trying to
point to different ones based on Locale (rather than use the nice classpath
resources, at least for now), so I'm trying the following:

String locale = "en_US";
add(new ContextImage("currentJunk", "images/" + locale + "/junk.gif"));

... or:

add(new Image("currentJunk").add(new ContextPathGenerator("images/" + locale
+ "/junk.gif")));

My HTML is simple:


The output is strange: it puts my path argument at the front of the URL, and
then it adds a "/../" at the end:



This seems like a bug; why would it put stuff at the end?  Manually
configuring the context (eg. in web.xml) seems fraught with danger.  I could
probably work with it if it would put that at the beginning or even not put
anything at all, and I could specify the path.

I'm using version 1.4-m3

I appreciate any help or even other suggestions.  Thanks!
Trent