Re: how to Disable validations dynamically

2007-01-26 Thread Reto Hotz

Hi,

This is how I did it at the end:

In html:

input jwcid=@Submit value=Submit Form
listener=listener:formActionSubmit selected=ognl:selectedSubmit
tag=literal:useValidators/

And then in java:

public abstract String getSelectedSubmit();

public void renderPage(IMarkupWriter writer, IRequestCycle cycle) {
 if ( !useValidators.equals(getSelectedSubmit() ) {
   getValidationDelegate().clearErrors();
 }
}

Greetings
Reto

On 1/24/07, jiju [EMAIL PROTECTED] wrote:


Hi all,
I am also facing the same problem...
is there any way to disable validation for some button clicks ?




Reto Hotz wrote:

 Hello,

 I have a @Form with a validationDelegate. Inside this form there is a
 custom component. There are also several @TextFields with
 validators-rules after the custom-component. The custom component has
 a @Submit button.

 My problem is, when the submit button of that custom component is
 pressed, the validator of the form gets triggered. But at this time
 there shouldn't be a validation at all. The validation should start
 when the submit-button of the form itself is pressed.

 I tried it this way in my component:

 /* submit listener of component */
 public void formActionFindMachine() {
   IValidationDelegate delegate = getForm().getDelegate();
   delegate.clearErrors();
 }

 This works, but if the TextFields are located after the custom
 component, they still record their validation errors.

 I think I oversee something.

 Thank for any help.

 Greetings
 Reto

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




--
View this message in context: 
http://www.nabble.com/ValidationDelegate-and-Form-Component-tf3065098.html#a8560178
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Validation questions: components and messages

2006-10-10 Thread Reto Hotz

Hi,

On 10/10/06, Ron Piterman [EMAIL PROTECTED] wrote:

Dave Rathnow wrote:
 Also, is there an easy way to get the individual error messages from the
 validation delegate?

In such a case you need to create your own class, extending the standard
validation delegate. There are methods which allow the delegate to hook
up into the rendering of fields and their labels, so you can do just
what you described.


We also wrote our own validation delegate with nice error-icons.
Somehow like this:

public class MyValidationDelegate extends ValidationDelegate {

   public void writeAttributes(IMarkupWriter writer, IRequestCycle
cycle, IFormComponent component, IValidator validator) {
   if (isInError())
   writer.attribute(class, validationerror);
   }

   public void writeSuffix(IMarkupWriter writer, IRequestCycle cycle,
IFormComponent component, IValidator validator) {
   if (isInError()) {
   writer.print( );
   writer.beginEmpty(img);
   writer.attribute(src, warning_small.gif);
   }
   }

   public void writeLabelPrefix(IFormComponent component,
IMarkupWriter writer, IRequestCycle cycle) {
   if (isInError(component)) {
   writer.begin(span);
   writer.attribute(class, label-error);
   }
   }

   public void writeLabelSuffix(IFormComponent component,
IMarkupWriter writer, IRequestCycle cycle) {
   if (isInError(component))
   writer.end(); // span
   }
}


HTH

Greetings
Reto

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Manipulate components inside a @For with DirectLink.

2006-08-07 Thread Reto Hotz

Hi,

Thanks for your reply.

Yes, I found a solution:
I created a new wrapper-component who does the for-loop stuff. I
called it TabGroupView. Within this component I can save the
maximize/minimize status of all my TabGroups.
This means I moved my @For loop from the Home.html into this
component. My DirectLink-Listener is now also in the TabGroupView
component so I have full control over all groups.

Some example code:

Home.html:
span jwcid=@Util:TabGroupView source=ognl:items/

TabGroupView.html:
span jwcid=@For source=ognl:source index=ognl:index value=ognl:group
 span jwcid=@TabGroup title=ognl:group.title
minimized=ognl:minimized parameters=ognl:new
java.lang.Object[]{index, minimizedMap}
listener=ognl:listeners.linkActionToggleGroup/
/span

TabGroupView.java:
   public void linkActionToggleGroup(IRequestCycle cycle) {
   Object[] params = cycle.getListenerParameters();
   int index = (Integer) params[0];
   Map minMap = (Map) params[1];
   Boolean oldValue = (Boolean) minMap.get(index);
   minMap.put(index, !oldValue);
   setMinimizedMap(minMap);
   }

   public boolean isMinimized() {
   if (getMinimizedMap().containsKey(getIndex())) {
   return getMinimizedMap().get(getIndex());
   } else {
   getMinimizedMap().put(getIndex(), false);
   return false;
   }
   }

TabGroup.html:
a jwcid=@DirectLink parameters=ognl:parameters listener=ognl:listener
 span jwcid=@Insert value=ognl:title/
/a

TabGroup.java:
@Parameter(name=parameters, required=false)
public abstract Object getParameters();

@Parameter(name=listener, required=false)
public abstract IActionListener getListener();



Not sure if this is the preferred way, but it works. :)

Greetings
Reto


On 8/7/06, Karthik N [EMAIL PROTECTED] wrote:

any luck with this issue?

After some discussions and experimentation with a colleague of mine, it
appears that there is only one component.  that's the nature of the For
loop.   We did this in the listener on the page:

Map comps = this.getComponents();
Set keyMap = comps.keySet();
for (Iterator iter = keyMap.iterator(); iter.hasNext();) {
System.out.println( comps.get(iter.next()));

}

Hence, if a For loop iterates over 'n' elements and writes out a
@Util:TabGroup, there is just one component @Util:TabGroup.

I suppose what it means is that for you to iterate over your list and
control the maximize/minimize stuff, you'll have to have this as an
attribute in the For loop's List, and accordingly use some client side
scripting to handle maximize/minimize.

Unless there is an attribute of the For loop that forces generation of one
@Util:TabGroup for every iteration.  If there is some such parameter, I am
not aware of it 

Good luck.


On 8/4/06, Reto Hotz [EMAIL PROTECTED] wrote:

 The TabGroup has a @DirectLink to change the state: minimized/maximized.

 Home.html :
 span jwcid=@For source=ognl:items value=ognl:item
   span jwcid=@Util:TabGroup title=ognl:item.name/
 /span


 TabGroup.html:
 span jwcid=@If condition=ognl:!minimized
   a jwcid=@DirectLink parameters=ognl:minimized
 listener=ognl:listeners.lnkActionToggleGroup 
 span jwcid=@Insert value=ognl:title/
   /a
 /span

 TabGroup.jwc:
 component-specification class=TabGroup allow-body=yes
 allow-informal-parameters=no
   parameter name=title required=yes cache=false/
 /component-specification

 TabGroup.java:
 public abstract class TabGroup extends BaseComponent implements
 PageAttachListener, IFormComponent {

 public abstract String getTitle();

 @Persist(client)
 public abstract boolean getMinimized();

 public void lnkActionToggleGroup(boolean minimized) {
 setMinimized(!minimized);
 }
 ...
 }


 For example if I create 2 TabGroups *without* the @For loop they are
 rendered like this:
 $TabGroup
 $TabGroup_0

 But if I create them *with* the @For loop, I get the component twice:
 $TabGroup
 $TabGroup

 -- both are the same component and thus if I click on the DirectLink
 of the first component, the second gets minimized too.

 Greetings
 Reto

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




--
Thanks, Karthik




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Manipulate components inside a @For with DirectLink.

2006-08-04 Thread Reto Hotz

Hello,

In T4, I have a custom component (TabGroup) in a @For loop. The
component has a @DirectLink to manipulate itself. Now I have the
problem, that the @For-loop creates only one instance of my component
and reuses it in every loop. And thus if I click on the components
DirectLink to manipulate one of tthem, all of them are manipulated
instead of just one.

If I use the TabGroup component outside of the @For loop, it just works fine.

Is there a way to tell the @For component to create on every loop a
new instance of the TabGroup component?


Thanks for your help.

Greetings
Reto

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Manipulate components inside a @For with DirectLink.

2006-08-04 Thread Reto Hotz

The TabGroup has a @DirectLink to change the state: minimized/maximized.

Home.html:
span jwcid=@For source=ognl:items value=ognl:item
 span jwcid=@Util:TabGroup title=ognl:item.name/
/span


TabGroup.html:
span jwcid=@If condition=ognl:!minimized
 a jwcid=@DirectLink parameters=ognl:minimized
listener=ognl:listeners.lnkActionToggleGroup
   span jwcid=@Insert value=ognl:title/
 /a
/span

TabGroup.jwc:
component-specification class=TabGroup allow-body=yes
allow-informal-parameters=no
 parameter name=title required=yes cache=false/
/component-specification

TabGroup.java:
public abstract class TabGroup extends BaseComponent implements
PageAttachListener, IFormComponent {

   public abstract String getTitle();

   @Persist(client)
   public abstract boolean getMinimized();

   public void lnkActionToggleGroup(boolean minimized) {
   setMinimized(!minimized);
   }
   ...
}


For example if I create 2 TabGroups *without* the @For loop they are
rendered like this:
$TabGroup
$TabGroup_0

But if I create them *with* the @For loop, I get the component twice:
$TabGroup
$TabGroup

-- both are the same component and thus if I click on the DirectLink
of the first component, the second gets minimized too.

Greetings
Reto

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: ZipException

2006-07-14 Thread Reto Hotz

Hi,

The problem seems to be somewhere here:
We create an external link with an serializable object as parameter.

In T3 it looked like this:
IEngineService service =
cycle.getEngine().getService(Tapestry.EXTERNAL_SERVICE);
ILink link = service.getLink(cycle, this, getServiceParameters());
url = link.getURL();

where getServiceParameters() returned an Object[] with {Long, String,
ourSerializableObject}

In T4 I did it that way:
@InjectObject(engine-service:external)
public abstract IEngineService getExternalService();
...

ExternalServiceParameter esp = new
ExternalServiceParameter(targetPage, (Object[])
getServiceParameters());
url = getExternalService().getLink(false, esp).getURL();


Now I can see that our serializable object is squeezed as a gzipped
serializable object.
In the URL something like this: ZH4sIAI2SwWoUQRCGa8aMm7gakgh...

But I still can't explain why the unsqueeze is not able to handle this
gzipped object.


Yes, I know it's not the best way to serialize objects like this. But
for the moment we have no other choise.

Greetings
Reto



On 7/13/06, Howard Lewis Ship [EMAIL PROTECTED] wrote:

Could this be a bookmark from the T3 app that you are trying to use under T4?

The stack trace indicates parsing a query parameter that is a gzipped
encoding of a serialized Java object.  That's a red flag right there
(just because you can do it, doesn't mean you should ... Serialization
is a very brittle thing).

On 7/13/06, Reto Hotz [EMAIL PROTECTED] wrote:
 Hello,

 I try to upgrade our application from T3 to T4. Most of it is working,
 but I have one strange error, I cannot figure out how to fix it.
 We have a rather complex component that worked fine in T3, but in T4
 it throws this exception:

 org.apache.hivemind.ApplicationRuntimeException
 Unable to decode stream: incomplete literal/length tree

 java.util.zip.ZipException
 incomplete literal/length tree
 Stack Trace:
 java.util.zip.InflaterInputStream.read(InflaterInputStream.java:140)
 java.util.zip.GZIPInputStream.read(GZIPInputStream.java:87)
 java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
 java.io.BufferedInputStream.read1(BufferedInputStream.java:256)
 java.io.BufferedInputStream.read(BufferedInputStream.java:313)
 java.io.ObjectInputStream$PeekInputStream.read(ObjectInputStream.java:2217)
 
java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2230)
 
java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2698)
 java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:750)
 java.io.ObjectInputStream.init(ObjectInputStream.java:268)
 
org.apache.tapestry.util.io.ResolvingObjectInputStream.init(ResolvingObjectInputStream.java:40)
 
org.apache.tapestry.util.io.SerializableAdaptor.unsqueeze(SerializableAdaptor.java:117)
 $SqueezeAdaptor_10c6724e0cd.unsqueeze($SqueezeAdaptor_10c6724e0cd.java)
 
org.apache.tapestry.util.io.DataSqueezerImpl.unsqueeze(DataSqueezerImpl.java:179)
 
org.apache.tapestry.util.io.DataSqueezerImpl.unsqueeze(DataSqueezerImpl.java:199)
 $DataSqueezer_10c6724df8d.unsqueeze($DataSqueezer_10c6724df8d.java)
 
org.apache.tapestry.services.impl.LinkFactoryImpl.extractListenerParameters(LinkFactoryImpl.java:181)
 
$LinkFactory_10c6724df8f.extractListenerParameters($LinkFactory_10c6724df8f.java)
 org.apache.tapestry.engine.ExternalService.service(ExternalService.java:159)
 $IEngineService_10c6724e021.service($IEngineService_10c6724e021.java)
 
org.apache.tapestry.services.impl.EngineServiceOuterProxy.service(EngineServiceOuterProxy.java:66)
 org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:248)
 ch.bw.worknavigator.webapp.WNWebAppEngine.service(Unknown Source)
 
org.apache.tapestry.services.impl.InvokeEngineTerminator.service(InvokeEngineTerminator.java:60)
 $WebRequestServicer_10c6724dff5.service($WebRequestServicer_10c6724dff5.java)
 $WebRequestServicer_10c6724dff1.service($WebRequestServicer_10c6724dff1.java)
 
org.apache.tapestry.services.impl.WebRequestServicerPipelineBridge.service(WebRequestServicerPipelineBridge.java:56)
 
$ServletRequestServicer_10c6724dfd7.service($ServletRequestServicer_10c6724dfd7.java)
 
org.apache.tapestry.request.DecodedRequestInjector.service(DecodedRequestInjector.java:55)
 
$ServletRequestServicerFilter_10c6724dfd3.service($ServletRequestServicerFilter_10c6724dfd3.java)
 
$ServletRequestServicer_10c6724dfd9.service($ServletRequestServicer_10c6724dfd9.java)
 
org.apache.tapestry.multipart.MultipartDecoderFilter.service(MultipartDecoderFilter.java:52)
 
$ServletRequestServicerFilter_10c6724dfd1.service($ServletRequestServicerFilter_10c6724dfd1.java)
 
$ServletRequestServicer_10c6724dfd9.service($ServletRequestServicer_10c6724dfd9.java)
 
org.apache.tapestry.services.impl.SetupRequestEncoding.service(SetupRequestEncoding.java:53)
 
$ServletRequestServicerFilter_10c6724dfd5.service($ServletRequestServicerFilter_10c6724dfd5.java)
 
$ServletRequestServicer_10c6724dfd9.service

ZipException

2006-07-13 Thread Reto Hotz

Hello,

I try to upgrade our application from T3 to T4. Most of it is working,
but I have one strange error, I cannot figure out how to fix it.
We have a rather complex component that worked fine in T3, but in T4
it throws this exception:

org.apache.hivemind.ApplicationRuntimeException
Unable to decode stream: incomplete literal/length tree

java.util.zip.ZipException
incomplete literal/length tree
Stack Trace:
java.util.zip.InflaterInputStream.read(InflaterInputStream.java:140)
java.util.zip.GZIPInputStream.read(GZIPInputStream.java:87)
java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
java.io.BufferedInputStream.read1(BufferedInputStream.java:256)
java.io.BufferedInputStream.read(BufferedInputStream.java:313)
java.io.ObjectInputStream$PeekInputStream.read(ObjectInputStream.java:2217)
java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2230)
java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2698)
java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:750)
java.io.ObjectInputStream.init(ObjectInputStream.java:268)
org.apache.tapestry.util.io.ResolvingObjectInputStream.init(ResolvingObjectInputStream.java:40)
org.apache.tapestry.util.io.SerializableAdaptor.unsqueeze(SerializableAdaptor.java:117)
$SqueezeAdaptor_10c6724e0cd.unsqueeze($SqueezeAdaptor_10c6724e0cd.java)
org.apache.tapestry.util.io.DataSqueezerImpl.unsqueeze(DataSqueezerImpl.java:179)
org.apache.tapestry.util.io.DataSqueezerImpl.unsqueeze(DataSqueezerImpl.java:199)
$DataSqueezer_10c6724df8d.unsqueeze($DataSqueezer_10c6724df8d.java)
org.apache.tapestry.services.impl.LinkFactoryImpl.extractListenerParameters(LinkFactoryImpl.java:181)
$LinkFactory_10c6724df8f.extractListenerParameters($LinkFactory_10c6724df8f.java)
org.apache.tapestry.engine.ExternalService.service(ExternalService.java:159)
$IEngineService_10c6724e021.service($IEngineService_10c6724e021.java)
org.apache.tapestry.services.impl.EngineServiceOuterProxy.service(EngineServiceOuterProxy.java:66)
org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:248)
ch.bw.worknavigator.webapp.WNWebAppEngine.service(Unknown Source)
org.apache.tapestry.services.impl.InvokeEngineTerminator.service(InvokeEngineTerminator.java:60)
$WebRequestServicer_10c6724dff5.service($WebRequestServicer_10c6724dff5.java)
$WebRequestServicer_10c6724dff1.service($WebRequestServicer_10c6724dff1.java)
org.apache.tapestry.services.impl.WebRequestServicerPipelineBridge.service(WebRequestServicerPipelineBridge.java:56)
$ServletRequestServicer_10c6724dfd7.service($ServletRequestServicer_10c6724dfd7.java)
org.apache.tapestry.request.DecodedRequestInjector.service(DecodedRequestInjector.java:55)
$ServletRequestServicerFilter_10c6724dfd3.service($ServletRequestServicerFilter_10c6724dfd3.java)
$ServletRequestServicer_10c6724dfd9.service($ServletRequestServicer_10c6724dfd9.java)
org.apache.tapestry.multipart.MultipartDecoderFilter.service(MultipartDecoderFilter.java:52)
$ServletRequestServicerFilter_10c6724dfd1.service($ServletRequestServicerFilter_10c6724dfd1.java)
$ServletRequestServicer_10c6724dfd9.service($ServletRequestServicer_10c6724dfd9.java)
org.apache.tapestry.services.impl.SetupRequestEncoding.service(SetupRequestEncoding.java:53)
$ServletRequestServicerFilter_10c6724dfd5.service($ServletRequestServicerFilter_10c6724dfd5.java)
$ServletRequestServicer_10c6724dfd9.service($ServletRequestServicer_10c6724dfd9.java)
$ServletRequestServicer_10c6724dfcb.service($ServletRequestServicer_10c6724dfcb.java)
org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:123)
org.apache.tapestry.ApplicationServlet.doGet(ApplicationServlet.java:79)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
java.lang.Thread.run(Thread.java:595)


Any idea where I can start