You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Durgesh_Kab <du...@nuware.com> on 2009/11/12 14:27:56 UTC

Customizing tapestry grid row

Hi,

I am working on a migration of project, which is using Tapestry4, and i am
upgrading it to Tapestry5.

It was using below ognl expression at tr level inside the grid as below:
<tr jwcid="tableRows" style="ognl:row.id?'display:none;':'display:;'">

where as in Tapestry5, i do not have control over tr in grid, as:
<table t:id="rowGrid">

Please help me to customize the grid. My requirement is if any of the row id
is coming as null, do not display that row in grid.

Thanks in advance.

@ DK
-- 
View this message in context: http://old.nabble.com/Customizing-tapestry-grid-row-%3Ctr%3E-tp26318657p26318657.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: Testify + TestNG: more than one object marked as @ForComponents

Posted by Paul Field <pa...@db.com>.
You need to be very careful about calling tester.injectInto() yourself 
because the superclass TapestryTest is already doing that for you. It 
contains this code:
    @BeforeClass(alwaysRun=true)
    public final void processInjectAnnotation() {
        tester.injectInto(this);
    }


So I would try removing the suite set-up from your TestifyBaseTest. 
Instead create a special class that is a subclass of TestifyBaseTest and 
has the suite setup in it and no actual tests. (This is as described in 
the documentation: 
http://tapestry.formos.com/nightly/tapestry-testify/#TestNG ).

If that doesn't work, let me know and I'll take a more detailed look.

- Paul





Ben Gidley <be...@gidley.co.uk> wrote on 13/11/2009 16:41:56:

> I just fixed this by making the 'TapestryTester' not static. THis 
removes
> the issue. However this does seem to defeat some of the point of testify 
as
> we now have a lot slower tests are we will be initialising the tester 
for
> each test.

> On Fri, Nov 13, 2009 at 4:00 PM, Augusto Rodriguez <
> Augusto.Rodriguez@ioko.com> wrote:
> 
> > I'm using testify to test my pages, but I can only run one test
> > successfully and all the other tests, whether they are in another 
class
> > or in the same class, fail with the message:
> >  Found more than one object marked as @ForComponents of type
> > uk.co.test.services.PageInformation
> >
> >
> > It looks like testify is inserting the mock "pageInformation" two 
times
> > in the IoC container.
> >
> > I don't know if this is related to how I'm using TestNG annotations
> > and/or using @ForComponent in the parent class. I've tried to play a 
bit
> > with the annotations, for example I annotated 
TestifyBaseTest.suiteSetup
> > with @BeforeClass, @BeforeTest and @BeforeMethod without success. I've
> > also tried to move the attributes annotated with @ForComponents to the
> > subclasses, but it didn't work too. I have copied a bit of my code 
below
> > as reference.
> >
> >
> > Thanks a lot! And sorry for the long email.
> >
> > Cheers,
> > Augusto
> >
> >
> > Base test class:
> >
> > Public class TestifyBaseTest extends TapestryTest {
> >        private static final TapestryTester SHARED_TESTER = new
> > TapestryTester("uk.co.test.ux", TestModule.class );
> >
> >        @ForComponents @Mock protected PageURLResolver pageURLResolver;
> >        @ForComponents @Mock protected PageInformation pageInformation;
> >
> >    public TestifyBaseTest() {
> >        super(SHARED_TESTER);
> >    }
> >
> >    @BeforeSuite(alwaysRun=true)
> >    public void suiteSetup() {
> >        tester.injectInto(this);
> >    }
> >
> >    @Override
> >    protected void setUpForAllTestMethods() throws Exception {
> >        MockitoAnnotations.initMocks(this);
> >    }
> > }
> >
> >
> > Test:
> > public class SimpleTest extends TestifyBaseTest {
> >
> >        @BeforeMethod(alwaysRun=true)
> >        public void setup() {
> >                //stub some method calls
> >        }
> >
> >        // this test passes.
> >        @Test(groups="fast")
> >        public void canRenderProgrammeTitle() throws
> > PageNotFoundException {
> >                Document page = tester.renderPage("test");
> >        }
> >
> >        // this test throws an exception with the message "Found more
> > than one object marked as @ForComponents of type
> > uk.co.test.services.TestService".
> >        @Test(groups="fast")
> >        public void canRenderProgrammeTitle() throws
> > PageNotFoundException {
> >                Document page = tester.renderPage("test");
> >        }
> > }



---

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

Please refer to http://www.db.com/en/content/eu_disclosures.htm for additional EU corporate and regulatory disclosures.

Re: Testify + TestNG: more than one object marked as @ForComponents

Posted by Ben Gidley <be...@gidley.co.uk>.
Augusto,

I just fixed this by making the 'TapestryTester' not static. THis removes
the issue. However this does seem to defeat some of the point of testify as
we now have a lot slower tests are we will be initialising the tester for
each test.

Ben Gidley

www.gidley.co.uk
ben@gidley.co.uk


On Fri, Nov 13, 2009 at 4:00 PM, Augusto Rodriguez <
Augusto.Rodriguez@ioko.com> wrote:

> Hi All,
>
> I'm using testify to test my pages, but I can only run one test
> successfully and all the other tests, whether they are in another class
> or in the same class, fail with the message:
>  Found more than one object marked as @ForComponents of type
> uk.co.test.services.PageInformation
>
>
> It looks like testify is inserting the mock "pageInformation" two times
> in the IoC container.
>
> I don't know if this is related to how I'm using TestNG annotations
> and/or using @ForComponent in the parent class. I've tried to play a bit
> with the annotations, for example I annotated TestifyBaseTest.suiteSetup
> with @BeforeClass, @BeforeTest and @BeforeMethod without success. I've
> also tried to move the attributes annotated with @ForComponents to the
> subclasses, but it didn't work too. I have copied a bit of my code below
> as reference.
>
>
> Thanks a lot! And sorry for the long email.
>
> Cheers,
> Augusto
>
>
> Base test class:
>
> Public class TestifyBaseTest extends TapestryTest {
>        private static final TapestryTester SHARED_TESTER = new
> TapestryTester("uk.co.test.ux", TestModule.class );
>
>        @ForComponents @Mock protected PageURLResolver pageURLResolver;
>        @ForComponents @Mock protected PageInformation pageInformation;
>
>    public TestifyBaseTest() {
>        super(SHARED_TESTER);
>    }
>
>    @BeforeSuite(alwaysRun=true)
>    public void suiteSetup() {
>        tester.injectInto(this);
>    }
>
>    @Override
>    protected void setUpForAllTestMethods() throws Exception {
>        MockitoAnnotations.initMocks(this);
>    }
> }
>
>
> Test:
> public class SimpleTest extends TestifyBaseTest {
>
>        @BeforeMethod(alwaysRun=true)
>        public void setup() {
>                //stub some method calls
>        }
>
>        // this test passes.
>        @Test(groups="fast")
>        public void canRenderProgrammeTitle() throws
> PageNotFoundException {
>                Document page = tester.renderPage("test");
>        }
>
>        // this test throws an exception with the message "Found more
> than one object marked as @ForComponents of type
> uk.co.test.services.TestService".
>        @Test(groups="fast")
>        public void canRenderProgrammeTitle() throws
> PageNotFoundException {
>                Document page = tester.renderPage("test");
>        }
> }
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Testify + TestNG: more than one object marked as @ForComponents

Posted by Augusto Rodriguez <Au...@ioko.com>.
Hi All,

I'm using testify to test my pages, but I can only run one test
successfully and all the other tests, whether they are in another class
or in the same class, fail with the message:
  Found more than one object marked as @ForComponents of type
uk.co.test.services.PageInformation


It looks like testify is inserting the mock "pageInformation" two times
in the IoC container.

I don't know if this is related to how I'm using TestNG annotations
and/or using @ForComponent in the parent class. I've tried to play a bit
with the annotations, for example I annotated TestifyBaseTest.suiteSetup
with @BeforeClass, @BeforeTest and @BeforeMethod without success. I've
also tried to move the attributes annotated with @ForComponents to the
subclasses, but it didn't work too. I have copied a bit of my code below
as reference.


Thanks a lot! And sorry for the long email.

Cheers,
Augusto


Base test class:

Public class TestifyBaseTest extends TapestryTest {
	private static final TapestryTester SHARED_TESTER = new
TapestryTester("uk.co.test.ux", TestModule.class );
	
	@ForComponents @Mock protected PageURLResolver pageURLResolver;
	@ForComponents @Mock protected PageInformation pageInformation;
	
    public TestifyBaseTest() {
        super(SHARED_TESTER);
    }
    
    @BeforeSuite(alwaysRun=true)
    public void suiteSetup() {
        tester.injectInto(this); 
    }
    
    @Override
    protected void setUpForAllTestMethods() throws Exception {
        MockitoAnnotations.initMocks(this);
    }  
}


Test:
public class SimpleTest extends TestifyBaseTest {
	
	@BeforeMethod(alwaysRun=true)
	public void setup() {
    		//stub some method calls
	}

	// this test passes.
	@Test(groups="fast") 
	public void canRenderProgrammeTitle() throws
PageNotFoundException {
		Document page = tester.renderPage("test");
	}

	// this test throws an exception with the message "Found more
than one object marked as @ForComponents of type
uk.co.test.services.TestService".
	@Test(groups="fast")	
	public void canRenderProgrammeTitle() throws
PageNotFoundException {
		Document page = tester.renderPage("test");
	}
}




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


Re: Customizing tapestry grid row

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Fri, 13 Nov 2009 13:52:10 -0200, Durgesh_Kab <du...@nuware.com>  
escreveu:

> Thank you very much...

:)

> I found one some reference on:
> http://tapestry.formos.com/nightly/ioko-tapestry-commons/tapestry-mixins/

Why don't you use it or at least read its sources to draw inspiration from  
it?

> But, as this is a indivisual project, i wanted some hint on how i can
> achieve the same control check box in my project. The main challenge  
> before me is to add checkbox in grid header and then give master control  
> to it for all the content id check boxes.

You can rewrite a header cell using <t:parameter  
name="propertyNameHeader"> or <p:propertyNameHeader>. The rest is  
implemented through JavaScript. Give each controlled checkbox a CSS class  
then use Prototype's $$() function to find them.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, software architect and developer, Ars Machina Tecnologia da  
Informação Ltda.
http://www.arsmachina.com.br

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


Re: Customizing tapestry grid row

Posted by Durgesh_Kab <du...@nuware.com>.
Thank you very much...

I was working for this requirement from last one week... You were right...
that i will like it... ;) I have another requirement... don't laugh on me if
i am more demanding... but now it seems to be interesting...

I have to have a checkbox for the id column in grid header... which should
work like select all...

I found one some reference on:
http://tapestry.formos.com/nightly/ioko-tapestry-commons/tapestry-mixins/

But, as this is a indivisual project, i wanted some hint on how i can
achieve the same control check box in my project. The main challenge before
me is to add checkbox in grid header and then give master control to it for
all the content id check boxes.

Please provide your inputs on this.
@ Durgesh

Thiago H. de Paula Figueiredo wrote:
> 
> Em Fri, 13 Nov 2009 07:26:35 -0200, Durgesh_Kab <du...@nuware.com>  
> escreveu:
> 
>> Thiago,
> 
> Hi!
> 
>> Thank you for showing me the way... I was able to hide the rows..
>> Now, I have a hyperlink as [+], I want to show the hidden rows once i  
>> click on this hyperlink. Any idea?
> 
> Use Prototype's $$() function to get all the <tr> tags with class "hide"  
> (I guess it would be $$('tr.hide')) and then change their class to "show".  
> Add this to your CSS:
> tr.show {
> 	display: block
> }
> 
> -- 
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
> and instructor
> Owner, software architect and developer, Ars Machina Tecnologia da  
> Informação Ltda.
> http://www.arsmachina.com.br
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Customizing-tapestry-grid-row-%3Ctr%3E-tp26318657p26338759.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: Customizing tapestry grid row

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Fri, 13 Nov 2009 07:26:35 -0200, Durgesh_Kab <du...@nuware.com>  
escreveu:

> Thiago,

Hi!

> Thank you for showing me the way... I was able to hide the rows..
> Now, I have a hyperlink as [+], I want to show the hidden rows once i  
> click on this hyperlink. Any idea?

Use Prototype's $$() function to get all the <tr> tags with class "hide"  
(I guess it would be $$('tr.hide')) and then change their class to "show".  
Add this to your CSS:
tr.show {
	display: block
}

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, software architect and developer, Ars Machina Tecnologia da  
Informação Ltda.
http://www.arsmachina.com.br

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


Re: Customizing tapestry grid row

Posted by Durgesh_Kab <du...@nuware.com>.
Thiago,

Thank you for showing me the way... I was able to hide the rows..

Now, I have a hyperlink as [+], I want to show the hidden rows once i click
on this hyperlink. Any idea?

@ DK


Thiago H. de Paula Figueiredo wrote:
> 
> Em Thu, 12 Nov 2009 11:27:56 -0200, Durgesh_Kab <du...@nuware.com>  
> escreveu:
> 
>> Hi,
> 
> Hi!
> 
>> I am working on a migration of project, which is using Tapestry4, and i  
>> am upgrading it to Tapestry5.
> 
> You'll love it. :)
> 
>> It was using below ognl expression at tr level inside the grid as below:
>> <tr jwcid="tableRows" style="ognl:row.id?'display:none;':'display:;'">
>> where as in Tapestry5, i do not have control over tr in grid, as:
>> <table t:id="rowGrid">
> 
> You can use Grid's rowClass parameter to define which class will be given  
> to the <tr> tag.
> 
> Template:
> 
> <table t:type="Grid" t:rowCclass="trClass" t:row="object" ...>
> 
> Page class:
> 
> public String getTrClass() {
> 	return object.getId() != null ? null : "hide";
> }
> 
> CSS:
> 
> tr.hide {
> 	display: none;
> }
> 
> -- 
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
> and instructor
> Owner, software architect and developer, Ars Machina Tecnologia da  
> Informação Ltda.
> http://www.arsmachina.com.br
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Customizing-tapestry-grid-row-%3Ctr%3E-tp26318657p26333615.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: Customizing tapestry grid row

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Thu, 12 Nov 2009 11:27:56 -0200, Durgesh_Kab <du...@nuware.com>  
escreveu:

> Hi,

Hi!

> I am working on a migration of project, which is using Tapestry4, and i  
> am upgrading it to Tapestry5.

You'll love it. :)

> It was using below ognl expression at tr level inside the grid as below:
> <tr jwcid="tableRows" style="ognl:row.id?'display:none;':'display:;'">
> where as in Tapestry5, i do not have control over tr in grid, as:
> <table t:id="rowGrid">

You can use Grid's rowClass parameter to define which class will be given  
to the <tr> tag.

Template:

<table t:type="Grid" t:rowCclass="trClass" t:row="object" ...>

Page class:

public String getTrClass() {
	return object.getId() != null ? null : "hide";
}

CSS:

tr.hide {
	display: none;
}

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, software architect and developer, Ars Machina Tecnologia da  
Informação Ltda.
http://www.arsmachina.com.br

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