Hello

Thanks, that was the problem indeed. So I change to that :

                <div t:type="loop" t:source="instanceList" t:value="instances">
                        <div id="Liste" style="background-color: 
${getInstanceState()}">
                                
                                        ${instances.nomInstance}
                        </div>
                  </div>

And it works!!!!!

But now I have another problem (yeahh I never stop ^^) with my service this
time. Here is the service class :

@Inject
        @Service("borneManager")
        private BorneManager borneManager;

        private IsoMsgServiceImpl service;

        /*
         * (non-Javadoc)
         * 
         * @see
         * com.atosworldline.effia.applira.web.services.BorneService#borneState(
         * long)
         */
        public String borneState(long id) {
                List<Bornes> bornes = null;
                service = new IsoMsgServiceImpl();
                String color = "green";
                try {
                        bornes = (List<Bornes>) borneManager.findByIdAo(id);
                } catch (BusinessException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                } catch (TechnicalException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }
                for (Bornes borne : bornes) {
                        String colorBorne = 
service.borneStateForInstance(borne.getId());
                        if (color == "green") {

                                color = colorBorne;
                        } else if (color == "orange") {
                                if (colorBorne != "green") {
                                        color = colorBorne;
                                }
                        } else if (color == "red") {
                                return color;
                        }

                }
                return color;
        }

But when I try to run it, my borneManager bean is not injected as in the
page class...

I don't really see were is the problem.


mcfly37 wrote:
> 
> Hi all!!
> 
> As I said in the title I'm trying to change dynamically the
> background-color parameter of a <div>. I tried with this code :
> 
> <div t:type="loop" t:source="instanceList" t:value="instances">
>                       <div id="Liste" t:source="instanceState" t:value="color"
> style="background-color: ${color}">
>                               
>                                       ${instances.nomInstance}
>                       </div>
>                 </div>
> 
> And the java class is like this :
> 
>       @Property
>       private Instances instances;
>       
>       @Property
>       private String color;
> 
> public List<Instances> getInstanceList()
>       {
>               try {
>                       return (List<Instances>) instanceManager.sortAll();
>               } catch (BusinessException e) {
>                       
>                       e.printStackTrace();
>                       return null;
>               } catch (TechnicalException e) {
>                       
>                       e.printStackTrace();
>                       return null;
>               } 
>       }
>       
>       public String getInstanceState()
>       {
>               InstanceService service = new InstanceService(); 
>               color = service.instanceState(instances.getIdAo());
>               return color;
>       }
> 
> Apparently it's good but the background-color doesn't change... Even if I
> try to simply return color = "red" there are no changes... and neither
> error message... So I'm quite disappointed, I don't see where the program
> bugs...
> 
> If anyone can help me it would be very great ^^
> 
> ps : Excuse me for the grammar, English is not my native language ^^
> 

-- 
View this message in context: 
http://old.nabble.com/Background-color-dynamic-change-tp29288115p29295649.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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

Reply via email to