You're absolutely right! That worked. Thanks!

I guess I still don't understand when models need to be used and when
simple values are ok.


Can somebody explain this to me, or point out some docs?


Thank you!




On Tue, 2006-09-05 at 12:13 +0530, karthik Guru wrote:
> I think having a PropertyModel to access 'isSuccessful' seems complicated.
> May be something like this ?
> 
> public class TestLabel extends Label {
> 
>    boolean isSuccessful;
> 
>    public TestLabel( final String id, final String label,boolean 
> isSuccessful){
>      super( id, label);
>      this.isSuccessful= isSuccessful;
>    }
> 
>    @Override
>    protected void onComponentTag( final ComponentTag tag ){
>      super.onComponentTag( tag );
>      final ValueMap map = tag.getAttributes();
>      map.put( "class", getLabelTagClass( isSuccessful ) );
>    }
> }
> 
> On 9/5/06, David Leangen <[EMAIL PROTECTED]> wrote:
> >
> > This is exactly what I need. Thanks!
> >
> > Now, to make the code a bit cleaner in my repeater, I'd like to subclass
> > Label, overriding the onComponentTag(ComponentTag) method. I'm a big
> > confused again regarding models...
> >
> > This is the mess I created, which does not work. The part that confuses
> > me the most is the use of the property model in the subclasses Label.
> >
> >
> >   public class TestLabel
> >         extends Label
> >   {
> >     private static final long serialVersionUID = 1L;
> >     private PropertyModel m_isSuccessfulPropertyModel;
> >
> >     public TestLabel( final String id, final String label, final
> > PropertyModel propModel )
> >     {
> >       super( id, label );
> >       m_isSuccessfulPropertyModel = propModel;
> >     }
> >
> >     @Override
> >     protected void onComponentTag( final ComponentTag tag )
> >     {
> >       super.onComponentTag( tag );
> >       final ValueMap map = tag.getAttributes();
> >       final boolean isSuccessful =
> > (Boolean)m_isSuccessfulPropertyModel.getObject( this );
> >       map.put( "class", getLabelTagClass( isSuccessful ) );
> >     }
> >   }
> >
> >
> > And I populate my item in the repeater like this.
> >
> >   add(
> >     new DataView( "testResults", new
> > TestResultDataProvider( testResults ) )
> >     {
> >       private static final long serialVersionUID = 1L;
> >       private boolean m_isSuccessful = true;
> >
> >       public void populateItem( final Item item )
> >       {
> >         final TestResult testResult = (TestResult)item.getModelObject();
> >         final boolean isSuccessful = testResult.isSuccessful();
> >         setSuccessful( isSuccessful );
> >         final PropertyModel isSuccessfulPropertyModel = new
> > PropertyModel( this, "isSuccessful" );
> >         final Date lastTimeExecuted = new
> > Date( testResult.getLastTimeExecuted() );
> >         final Long testDuration = testResult.getExecutionTime();
> >         item.add( new TestLabel( "test.name", testResult.getName(),
> > isSuccessfulPropertyModel ) );
> >       }
> >
> >       public void setSuccessful( final boolean isSuccessful )
> >       {
> >         m_isSuccessful = isSuccessful;
> >       }
> >
> >       public boolean isSuccessful()
> >       {
> >         return m_isSuccessful;
> >       }
> >     }
> >   );
> >
> >
> > What am I missing here?
> >
> >
> >
> >
> > On Mon, 2006-09-04 at 19:17 -0700, Igor Vaynberg wrote:
> > > you can either override oncomponenttag(ComponentTag tag)
> > > { tag.getAttributes().get/put } or add a behavior to the component -
> > > namely an (Simple)AttributeModifier.
> > >
> > > -Igor
> > >
> > >
> > > On 9/4/06, David Leangen <[EMAIL PROTECTED]> wrote:
> > >
> > >         Could somebody please point me to an example or reference on
> > >         how to
> > >         dynamically change tag attributes? I don't recall offhand.
> > >
> > >         I'm trying to do something like this:
> > >
> > >         If no error:
> > >         <span class="noerr">Righto!</span>
> > >
> > >         Or if error:
> > >         <span class="err">Sorry, try again!</span>
> > >
> > >
> > >         Thanks!
> > >
> > >
> > >
> > >         
> > > -------------------------------------------------------------------------
> > >         Using Tomcat but need to do more? Need to support web
> > >         services, security?
> > >         Get stuff done quickly with pre-integrated technology to make
> > >         your job easier
> > >         Download IBM WebSphere Application Server v.1.0.1 based on
> > >         Apache Geronimo
> > >         
> > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > >         _______________________________________________
> > >         Wicket-user mailing list
> > >         Wicket-user@lists.sourceforge.net
> > >         https://lists.sourceforge.net/lists/listinfo/wicket-user
> > >
> > > -------------------------------------------------------------------------
> > > Using Tomcat but need to do more? Need to support web services, security?
> > > Get stuff done quickly with pre-integrated technology to make your job 
> > > easier
> > > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > > _______________________________________________ Wicket-user mailing list 
> > > Wicket-user@lists.sourceforge.net 
> > > https://lists.sourceforge.net/lists/listinfo/wicket-user
> >
> >
> > -------------------------------------------------------------------------
> > Using Tomcat but need to do more? Need to support web services, security?
> > Get stuff done quickly with pre-integrated technology to make your job 
> > easier
> > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > _______________________________________________
> > Wicket-user mailing list
> > Wicket-user@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/wicket-user
> >
> 
> 


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to