Re: Good way to remove validation globally from a page or panel

2011-03-05 Thread Martin Grigorov
When you are in View mode then either your components are not form
components (e.g. input is replaced with label/span/...) or as you said
they are disabled. Form submit will not send name/value pair for disabled
form elements.

I think the first approach is better regarding user experience.
See visural's view or edit components for example.

On Sat, Mar 5, 2011 at 1:32 AM, Brown, Berlin [GCG-PFS] 
berlin.br...@primerica.com wrote:

 If I am using AbstractFormValidator and in some places, I am using
 setRequired, default validation on components.  What is the best way to
 remove the validation temporarily  Let's say I am in a view only mode
 and fields are disabled, I want to remove validation.  And then later
 on, may add back that validation.  I guess I Could remove and add
 onBeforeRender or initialize or configure and then add the validators
 back.  I was trying to avoid doin that.   I would have to remove
 validation on all the components on those particular pages.  Also, I was
 thinking of just exiting early in the validation methods?

 Also, let's say I have some fields that are disabled and some that
 aren't.  I am using abstractformvalidator and throwing an error if those
 fields are empty.  They are empty but disabled.  Is there a way to treat
 disabled fields differently in validation modes..



Re: Page#onInitialize is final in 1.5RC2 ?

2011-03-05 Thread Martin Grigorov
https://issues.apache.org/jira/browse/WICKET-3218
There is a thread in the mailing list. Search in Nabble.

On Sat, Mar 5, 2011 at 7:00 AM, Joe Fawzy joewic...@gmail.com wrote:

 Hi
 Page#onInitialize is final in 1.5RC2
 i think this method ment to be overridden?
 am i missing something?
 Thanks



Re: DropDown replacing text field

2011-03-05 Thread Martin Grigorov
Use two wicket:fragments - one with input inside, and one with select
Swap the fragments

On Sat, Mar 5, 2011 at 9:10 AM, Arjun Dhar dhar...@yahoo.com wrote:

 Hi,
  i have a markup (Loop) for a couple of fields. Its a dynamic form and all
 the fields are text except one or two,
 Sample Markup:












 Now in the Java code, for the exceptional case I want to replace that
 'input' with 'select', so I did:

 field = new DropDownChoice(value, new Model(myBooleanvar),
Arrays.asList(Boolean.FALSE,
 Boolean.TRUE)) {
//Default is text type,
 change to select
@Override
public void
 onComponentTag(ComponentTag tag) {

  tag.setName(select);

  tag.remove(type);

  super.onComponentTag( tag );
  }
};


 ..this results in a Blank Drop Down Box withotu any values.

 In the markup if I make it select it obviously works.
 What else do I need to to do to get the options, in the list in such a
 case?



 -
 Don't take life too seriously, your'e not getting out it alive anyway!
 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/DropDown-replacing-text-field-tp3336347p3336347.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: DropDown replacing text field

2011-03-05 Thread Arjun Dhar
Thanks...but curiosity : why wont that work in the first place?

-
Don't take life too seriously, your'e not getting out it alive anyway!
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/DropDown-replacing-text-field-tp3336347p3336426.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: DropDown replacing text field

2011-03-05 Thread Arjun Dhar
(And whats wrong with Nabble ..its got this annoying Ajax interface) :(
Ugh!!!

-
Don't take life too seriously, your'e not getting out it alive anyway!
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/DropDown-replacing-text-field-tp3336347p3336427.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: Good way to remove validation globally from a page or panel

2011-03-05 Thread Brown, Berlin [GCG-PFS]
I should have clarified.

Yea, if you have input fields with a dozen or so fields and you have 50%
disabled.  But you are using the AbstractFormValidator validate() {
get(field1).getInput; get(field2).getInput ... And doing validation
checks, I guess this isn't a good approach.

I have to keep the fields disabled and can't use true/read only spans.

I could visit each field and check if the component is enabled or not,
but I was trying to see if there is a one liner, easy solution that I
could remove validation in a disabled state...if I use the validation
approach I mention above.

-Original Message-
From: Martin Grigorov [mailto:mgrigo...@apache.org] 
Sent: Saturday, March 05, 2011 3:59 AM
To: users@wicket.apache.org
Subject: Re: Good way to remove validation globally from a page or panel

When you are in View mode then either your components are not form
components (e.g. input is replaced with label/span/...) or as you
said they are disabled. Form submit will not send name/value pair for
disabled form elements.

I think the first approach is better regarding user experience.
See visural's view or edit components for example.

On Sat, Mar 5, 2011 at 1:32 AM, Brown, Berlin [GCG-PFS] 
berlin.br...@primerica.com wrote:

 If I am using AbstractFormValidator and in some places, I am using 
 setRequired, default validation on components.  What is the best way 
 to remove the validation temporarily  Let's say I am in a view only 
 mode and fields are disabled, I want to remove validation.  And then 
 later on, may add back that validation.  I guess I Could remove and 
 add onBeforeRender or initialize or configure and then add the
validators
 back.  I was trying to avoid doin that.   I would have to remove
 validation on all the components on those particular pages.  Also, I 
 was thinking of just exiting early in the validation methods?

 Also, let's say I have some fields that are disabled and some that 
 aren't.  I am using abstractformvalidator and throwing an error if 
 those fields are empty.  They are empty but disabled.  Is there a way 
 to treat disabled fields differently in validation modes..



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



Servlet Mapping Expectations

2011-03-05 Thread devush
Hi,
 I have following settings in web.xml

   servlet-mapping
servlet-namemyserv/servlet-name
url-pattern/app/*/url-pattern
  /servlet-mapping


I expect that all requests such as:
/app
/app/abc
/app/xyz

should come to the servlet. But only /app currently works.

Moreover, I want to access the getRequestURL part from the servlet API
also, so that i can use the  information in the application logic.

I am able to do this in the normal servlet and then forward the
request to the wicket but in that case the URL at the client remains
the same and causes problems later in the application.


thanks
devush

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



Re: Servlet Mapping Expectations

2011-03-05 Thread Martin Grigorov
Hi,

On Sat, Mar 5, 2011 at 4:03 PM, devush devushan...@gmail.com wrote:

 Hi,
  I have following settings in web.xml

   servlet-mapping
servlet-namemyserv/servlet-name
url-pattern/app/*/url-pattern
  /servlet-mapping


 I expect that all requests such as:
 /app
 /app/abc
 /app/xyz


should come to the servlet. But only /app currently works.

 They actually come but since you don't have mounts at /abc or /xyz Wicket
decides there is nothing to do for them.
/app matches on the App's home page.


 Moreover, I want to access the getRequestURL part from the servlet API
 also, so that i can use the  information in the application logic.

 I am able to do this in the normal servlet and then forward the
 request to the wicket but in that case the URL at the client remains
 the same and causes problems later in the application.

 See if Wicket's Request#getPath() (Wicket 1.4.x) or #getUrl() (Wicket
1.5.x) returns what you need.
Otherwise you can always use the underlying HttpServletRequest:
- 1.4.x - WebRequest#getHttpServletRequest()
- 1.5.x - (HttpServletRequest) Request#getContainerRequest()


 thanks
 devush

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




Re: Panel factories and @SpringBean

2011-03-05 Thread Igor Vaynberg
http://wicketinaction.com/2008/10/creating-pluggable-applications-with-wicket-and-spring/

-igor

2011/3/4 Leszek Gawron lgaw...@apache.org:
 Hello,

 Let's say I want to write some UI to edit some complicated configuration
 split into multiple entities in multiple maven modules. The UI needs to have
 one entry point though. So:

 Let's create the UI based on TabbedPanel. Each of the tabs will be provided
 by different maven modules by the means of factories:

   public interface JukeboxConfigPanelFactory extends Ordered {

        public IModelString getPanelTitle();

        public Panel getPanel( String id, IModelJukebox jukeboxModel );
 }



 Provided that I have a list of all panel factories (that is an actual
 problem!) I can do that:


                ListITab tabs = new ArrayListITab();

                for ( JukeboxConfigPanelFactory factory :
 getPanelFactories() ) {
                        tabs.add( new
 JukeboxConfigPanelFactoryAwareAbstractTab( factory, getJukeboxModel() ) );
                }

                add( new AjaxTabbedPanel( tabs, tabs ) );

 The problem is: HOW do I get all the panel factories defined in Spring
 context?

 I cannot do :

 @SpringBean
 private ListJukeboxConfigPanelFactory factories;

 because this is not supported by
 org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.

 I could create another spring bean:

 public interface JukeboxConfigPanelFactoryManager {
        public ListJukeboxConfigPanelFactory getPanelFactoryList();
 }


 @Component
 public class JukeboxConfigPanelFactoryManagerImpl implements
 JukeboxConfigPanelFactoryManager, InitializingBean {
        private ListJukeboxConfigPanelFactory factoryList;

        @Autowired
        public JukeboxConfigPanelFactoryManagerImpl(
 ListJukeboxConfigPanelFactory factoryList ) {
                this.factoryList = factoryList;
        }

        @Override
        public ListJukeboxConfigPanelFactory getPanelFactoryList() {
                return Collections.unmodifiableList( factoryList );
        }

        @Override
        public void afterPropertiesSet() throws Exception {
                Collections.sort(       factoryList,
                                                        new
 OrderComparator() );
        }
 }

 so now I am able to get all factory implementations in one place:

                ListITab tabs = new ArrayListITab();

                for ( JukeboxConfigPanelFactory factory :
 panelFactoryManager.getPanelFactoryList() ) {
                        tabs.add( new
 JukeboxConfigPanelFactoryAwareAbstractTab( factory, getJukeboxModel() ) );
                }

                add( new AjaxTabbedPanel( tabs, tabs ) );

 But now the JukeboxConfigPanelFactoryAwareAbstractTab will fail miserably at
 serializing as only the manager has been wrapped with a proxy and not the
 factories underneath.

 How can I approach the problem using current state of wicket-spring module?
 I haven't found a way to wrap the factory beans with proxy manually.

 --
 Leszek Gawron                              http://lgawron.blogspot.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: DiskPageStore - Error FileNotFoundException

2011-03-05 Thread Igor Vaynberg
something else, other then wicket, may be eating up your filehandles.
just because wicket gets the exception doesnt mean its causing it. ask
your admin to list the files that are held open to see what they are.
and, yes, also upgrade to latest ver.

-igor

On Fri, Mar 4, 2011 at 7:53 AM, Jeffrey Schneller
jeffrey.schnel...@envisa.com wrote:
 Hi...  my site in production has been running and after our latest code
 change we started to get the error below after a few days.  It appears
 it is something to do with wicket's PageMap.  In the past this error
 would come up after weeks or months of the app running [we were
 re-starting tomcat fairly regularly back then].  The sys-admin of the
 box said he increased the open file limit from 1024 to 65535 per the
 following thread
 [http://osdir.com/ml/users-wicket.apache.org/2009-09/msg00674.html ].
 However this seems like a hack and not solving the underlying problem.
 In fact we got the exception thrown even quicker after the file limit
 change was made.



 We are running wicket 1.4.3 [yes, it is an outdated version and moving
 to 1.4.16 *may* solve the problem.]



 Any ideas?  What can we be doing wrong?





 2011-03-03 15:42:26,681 | [] | ERROR (DiskPageStore.java:930) Error
 flushing page

 java.lang.RuntimeException: java.io.FileNotFoundException:
 /usr/share/apache-tomcat-6.0.20/work/Catalina/localhost/_/wicket-spring-
 hibernate-filestore/7815/9545/64D2A385CF347B9FF9074C8345CA99FB/pm-null
 (Too many open files)

        at
 org.apache.wicket.protocol.http.pagestore.FileChannelPool.newFileChannel
 (FileChannelPool.java:103)

        at
 org.apache.wicket.protocol.http.pagestore.FileChannelPool.getFileChannel
 (FileChannelPool.java:170)

        at
 org.apache.wicket.protocol.http.pagestore.DiskPageStore$SessionEntry.sav
 ePage(DiskPageStore.java:241)

        at
 org.apache.wicket.protocol.http.pagestore.DiskPageStore.flushPagesToSave
 List(DiskPageStore.java:924)

        at
 org.apache.wicket.protocol.http.pagestore.DiskPageStore$PageSavingThread
 .run(DiskPageStore.java:996)

        at java.lang.Thread.run(Thread.java:619)

 Caused by: java.io.FileNotFoundException:
 /usr/share/apache-tomcat-6.0.20/work/Catalina/localhost/_/wicket-spring-
 hibernate-filestore/7815/9545/64D2A385CF347B9FF9074C8345CA99FB/pm-null
 (Too many open files)

        at java.io.RandomAccessFile.open(Native Method)

        at java.io.RandomAccessFile.init(RandomAccessFile.java:212)

        at
 org.apache.wicket.protocol.http.pagestore.FileChannelPool.newFileChannel
 (FileChannelPool.java:98)

        ... 5 more









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



Re: Servlet Mapping Expectations

2011-03-05 Thread devush
Hi,
 I am able to get the request related information from both Request
and WebRequest. Thanks for that. This i am able to do in the WebPage.
My WebApplication getHomePage is called when ever I call /app or
/app/, so I have to intercept the request before that.

I am trying with mount(String, Package), but that lead to the specific
URL only. This is in the init() method of WebApplication.
My basic requirement is to serve pages like /app/user1 /app/user2
/app/user2/profile etc.

Do i have to create new* methods as described at
https://cwiki.apache.org/WICKET/request-processing-overview.html

Do I have to implement IRequestCodingStrategy and attach it to Request Cycle?
thanks
devush



On 05/03/2011, Martin Grigorov mgrigo...@apache.org wrote:
 Hi,

 On Sat, Mar 5, 2011 at 4:03 PM, devush devushan...@gmail.com wrote:

 Hi,
  I have following settings in web.xml

   servlet-mapping
servlet-namemyserv/servlet-name
url-pattern/app/*/url-pattern
  /servlet-mapping


 I expect that all requests such as:
 /app
 /app/abc
 /app/xyz


 should come to the servlet. But only /app currently works.

 They actually come but since you don't have mounts at /abc or /xyz Wicket
 decides there is nothing to do for them.
 /app matches on the App's home page.


 Moreover, I want to access the getRequestURL part from the servlet API
 also, so that i can use the  information in the application logic.

 I am able to do this in the normal servlet and then forward the
 request to the wicket but in that case the URL at the client remains
 the same and causes problems later in the application.

 See if Wicket's Request#getPath() (Wicket 1.4.x) or #getUrl() (Wicket
 1.5.x) returns what you need.
 Otherwise you can always use the underlying HttpServletRequest:
 - 1.4.x - WebRequest#getHttpServletRequest()
 - 1.5.x - (HttpServletRequest) Request#getContainerRequest()


 thanks
 devush

 -
 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