Re: Best practice on i18n

2011-01-30 Thread Hans Lesmeister


The only relevant technical point here is Inheritance. If  
Component A
inherits Component B, then the properties would have to be repeated  
in the
property file corresponding to the inherited Component as i don't  
think

properties follow inheritance rules (imo).


Component B inherits the resources of Component A as well. You do  
not have to repeat A's properties.


Cheers




Hans

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



Re: User configuration files

2011-01-30 Thread Christian Grobmeier
Igor,

thanks for your excellent tipps.

 the application settings are meant there for you to configure wicket,
 not your own application.

If ApplicationSettings is not to store settings for your application,
then I feel this name confusing. In the past years the name webapp
referred to my own webapplication, not the underlying framework.


 simply expose the properties in the application and then your
 components can get them like this:

 MyApplication.get().getProperty(foo);

 not so bad.

Yes, but I need to expose my applications class to the components,
which is not very generic and lets me create non-reusable stuff.
However, it is possible for prototyping or trivial apps.

 write a IComponentInstantiationListener and inject the properties, so
 you can have

 @Properties Properties props; fields in your component that are
 magically populated.

This is great thanks. I will use this now.

 there is no one way to do this, and its certainly not the job of the
 UI layer to handle it for you. thus we do not do it.

I understand there are hundreds of ways to go. But there should be at
least one standard way. Configuration of a web app is so basic. Even
UI frameworks need to be configured, at least when they are small
(prototyping). There are thousand ways for doing i18n, but wicket has
provided one way which can be extended.

 as a last note, you can leverage wicket's i18n to load properties
 stored in your MyApplication.properties.
 getString(myproperty) is all you need.

It feels a bit weird to use i18n for my configuration :-) But good to know :-)

Cheers + thanks for the conversation, I have learned much of it.
Christian


 -igor


 On Sat, Jan 29, 2011 at 11:02 AM, Christian Grobmeier
 grobme...@gmail.com wrote:
 On Sat, Jan 29, 2011 at 6:27 PM, Igor Vaynberg igor.vaynb...@gmail.com 
 wrote:
 that actually looks pretty simple to me...

 On first glance yes. But bringing the application parameters into
 another component or api will become complicated.

 WIth this code I can only extend my Application with a new method
 (getProperties). I have to introduce a new interface to make my
 components generic, otherwise I need casting.

 I looked at the ApplicationSettings and I am wondering why this class
 does not provide the functionality to set user defined parameters in
 key/value manner. Are there any reasons against this? I can imagine a
 loadUserProperties which does what I wrote below and stores the
 key/values in ApplicationSettings.getValue( String key)

 -
 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





-- 
http://www.grobmeier.de

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



Re: Adding attribute to selected menu item

2011-01-30 Thread msj121

Well there are a couple ways of doing this I recently dealt with this
same problem. You can in fact use some Javascript on the onClick of your
item (or onHover) to add to the affect, but either way you will want to have
your default menu item selected from the get go when they are on that page
(ie: they clicked on the blog section, that link in the menu should be
highlighted now without clicking). So unless its all one page and your using
ajax(I'll stop droning) The following should help:

Link link = new Link(menuLink) { 
@Override
protected void onComponentTag(ComponentTag tag) {
if()
 tag.put(id,curent_menu);
}
}

In Theory you can simply add the AttributeAppender from the get go depending
on which page you are on, so when it reloads, it will be reloaded with a
component.

Now I take it you are using onclick to keep track of your page. Either you
have to store a local variable that will record the page onClick, you have
to have a method that each page overrides telling you the current page, or
what I do is simply look at the PageParameters of my page.

So as follows: params.getString(key); //the key depends on how you build
your urls.
This only works if every time a link is clicked it actually goes to another
page with a different url.

So as of now, in your onclick record the name of the menu clicked, then in
the building section automaticlally add the appender This is what I mean
(notice the unqouted changes):


String selected = ;

 ListView lv = new ListView(mainMenu, menuList) {
@Override
protected void populateItem(final ListItem item) {
Menu menuItem = (Menu) item.getModelObject();
Link link = new Link(menuLink) {
@Override
public void onClick() {
  selected = item.getPath();
System.out.println(item was clicked  +
 item.getPath());
}

};
  if(item.getPath().equals(selected))
   item.add(new AttributeAppender(id, new
Model(current_menu), ;));
link.add(new Label(menuCaption,
 menuItem.getMenuNameDe()));
item.add(link);
}
};
add(lv);
 

Try the above. Notice the selected variable is now global and the if
statement can be used to whatever will stay constant. I have never used
getPath() before not sure what it returns, you might need the name of the
menu which doesn't change etc no idea.

Good Luck, 
   Matthew
 Hello to all,

 i am trying to build a dynamic menu based on data from a database. So i
 thought i could build it like my code shows it. To highlight the selected
 menu i try to dynamically add an attribute to the li tag in the onClick
 method. I would also want to load and repaint other panels (for example
 loading sub menus ), when the user clicks a menu link. But it is not
 working. What am i doing wrong?

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Adding-attribute-to-selected-menu-item-tp3244327p3247201.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



Wicket Tutorial Videos

2011-01-30 Thread msj121

I was making some Wicket Tutorial Videos on youtube.com/programjava

Just curious if there are very common questions with Wicket that appear on
the boards a lot, maybe I should make some quick video tutorials for them to
make people's lives a little easier. You can check what I already have,
standard videos like getting started, it is all pretty much in Netbeans
though it is all standard. Using EJB3 with Wicket etc
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-Tutorial-Videos-tp3247603p3247603.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



Strange Serialization Error

2011-01-30 Thread Michael Laccetti
Pastebin link to the stack: http://pastebin.com/NGzaaVTg

I've done as much searching online to see if anybody else had this error, but 
I've come up empty.  I was originally using 1.4.14 but have switched to see if 
1.4.15 fixed it (nope).  Anybody have any ideas?

Michael

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



Re: Strange Serialization Error

2011-01-30 Thread Pedro Santos
The error is in PivotConfiguration equals method implementation. It is
possible trying to convert the object being tested to an
PivotConfiguration to test its properties, but you can't assume that
only PivotConfiguration objects will to be tested on this method.

On Sun, Jan 30, 2011 at 6:42 PM, Michael Laccetti mich...@limone.me wrote:

 Pastebin link to the stack: http://pastebin.com/NGzaaVTg

 I've done as much searching online to see if anybody else had this error,
 but I've come up empty.  I was originally using 1.4.14 but have switched to
 see if 1.4.15 fixed it (nope).  Anybody have any ideas?

 Michael

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




-- 
Pedro Henrique Oliveira dos Santos


RE: Strange Serialization Error

2011-01-30 Thread Michael Laccetti
Yup - very true; I hadn't noticed that.  All sorts of casts in the .equals that 
didn't validate that the inbound object was even of the same type.  Fixed that 
and magically it went away.  Thanks!

-Original Message-
From: Pedro Santos [mailto:pedros...@gmail.com] 
Sent: January-30-11 8:28 PM
To: users@wicket.apache.org
Subject: Re: Strange Serialization Error

The error is in PivotConfiguration equals method implementation. It is possible 
trying to convert the object being tested to an PivotConfiguration to test its 
properties, but you can't assume that only PivotConfiguration objects will to 
be tested on this method.

On Sun, Jan 30, 2011 at 6:42 PM, Michael Laccetti mich...@limone.me wrote:

 Pastebin link to the stack: http://pastebin.com/NGzaaVTg

 I've done as much searching online to see if anybody else had this 
 error, but I've come up empty.  I was originally using 1.4.14 but have 
 switched to see if 1.4.15 fixed it (nope).  Anybody have any ideas?

 Michael

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




--
Pedro Henrique Oliveira dos Santos

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



Re: How to do setResponsePage after alert message pressed ok?

2011-01-30 Thread rolandpeng

This is what I have done and that works fine.Thank you for your hint!

new AjaxCallDecorator() {
   @Override
   public CharSequence decorateScript(CharSequence script) {
return if(!confirm('確定返回嗎?')){return false;};
+ script;
}

@Override
public CharSequence decorateOnSuccessScript(CharSequence script) {
return script + alert('返回成功!');
+ window.location.href='
+ RequestCycle.get().urlFor(getBackPage())+ ';;
}
};

//getBackPage() is customized method by myself.
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-do-setResponsePage-after-alert-message-pressed-ok-tp3225482p3248008.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