Re: 答复: is there tapestry 5 component f or htmlarea?

2008-04-07 Thread Gabriel Landais

滕训华 a écrit :
 You can find from http://code.google.com/p/tapestry5-components/ ,but I can
 not find the document this,so I don't know how to use it 
   
Other there :
http://213.160.23.119:8080/t5components/t5c-commons/ref/org/apache/tapestry/commons/components/Editor.html


-- 
Gabriel [EMAIL PROTECTED]
http://www.codelutin.com
tel : 02 40 50 29 28 / fax : 09 59 92 29 28


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



Re: T5 and Eclipse 3.3.2 and Tomcat 5.5

2008-03-25 Thread Gabriel Landais

Bruce Petro a écrit :

Does anyone have suggestions for running/debugging Tapestry using Tomcat
5.5 and working in Eclipse?

 

IE: 


a)   Should you create the eclipse project as a dynamic web project
or just a java project or some sort of J2EE project?

b)  Does a maven-built project map over to the type of project
answered in question a?

c)   Suggestions for pushing war over to tomcat's local directory,
debugging through tomcat with code changes visible.

d)  Any plugins?

 


THANKS!
I've given up Tomcat for Jetty and run jetty run plugin. It just works, 
and as I don't use any specific servlet container API, my web app works 
on Tomcat without a glitch.
And for debug, Jetty reloads well, Tomcat just doesn't. Also, project 
has not to be a dynamic web project!
And if you really need to debug once with Tomcat, you still can open 
debug port and connect on it with Eclipse.


--
Gabriel [EMAIL PROTECTED]
http://www.codelutin.com
tel : 02 40 50 29 28 / fax : 09 59 92 29 28


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



Re: ApplicationState annotation problem since 5.0.11

2008-03-18 Thread Gabriel Landais

Alec Leamas a écrit :

Hi!

What are you really trying to do here? For me, this looks like a typo.
Have you contributed an ApplicationStateObject? Then you need to refer 
to this. I'm pretty sure Tapestry doen't have a String 
ApplicationState object in place...


I would expect something like

@ApplicationState
private MyClass myInstance;

Where MyClass is contributed to ApplicationStateManager in 
AppModule.java.


Hope this helps..

--alec

Yep, you have to contribute like that :

   public void 
contributeApplicationStateManager(MappedConfigurationClass, 
ApplicationStateContribution configuration)
   {   
 configuration.add(SimExplorerState.class, new 
ApplicationStateContribution(session));

   }

I was using a String as AS before, and it works until 5.0.10 without 
contributing.


Notice that you can store only one instance per class, so when you'll 
need anything else that your login, you will have to use a bean.


--
Gabriel [EMAIL PROTECTED]
http://www.codelutin.com
tel : 02 40 50 29 28 / fax : 09 59 92 29 28


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



Re: Tapestry at my company

2008-03-18 Thread Gabriel Landais

Lance Java a écrit :

For trolls such as yourself... I'd suggest you adopt struts 1 to ensure
maximum pain.

Plain servlets and JSPs would be even better!

--
Gabriel [EMAIL PROTECTED]
http://www.codelutin.com
tel : 02 40 50 29 28 / fax : 09 59 92 29 28


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



Re: Redirect on login

2008-03-17 Thread Gabriel Landais

Cordenier Christophe a écrit :

In fact, this is a better solution if you have an activation context.

So to achieve this, we still may use the ComponentResources class and its 
createPageLink method

Christophe.
  

Thanks all, it works great now :

  @ApplicationState
  private SimExplorerState applicationState;

   @Inject
   private ComponentResources resources;

  Object onActivate(Object... pageContext) throws SimExplorerException {
  [...]
  if (!userLogged) {
   applicationState.setPageName(resources.getPageName());
   applicationState.setPageContext(pageContext);
  return Login; // redirect to login page
  }
  [...]
  return null;
  }

Then in Login :

  public Object onSuccessFromFormLogin() throws SimExplorerException, 
IOException {

  [...]
  if (success) {
  [...]
   String fromPage = applicationState.getPageName();

   if (fromPage == null) {
   return elementList;
   }
   return 
resources.createPageLink(applicationState.getPageName(), true, 
applicationState.getPageContext());

  }
  return this;
  }

--
Gabriel [EMAIL PROTECTED]
http://www.codelutin.com
tel : 02 40 50 29 28 / fax : 09 59 92 29 28


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



Redirect on login

2008-03-14 Thread Gabriel Landais

Hi,
when a user try to connect to my app, it checks if user is logged.
I'm trying to redirect him to page is was trying to access, but I don't 
know how to do it in Tapestry way. With plain old sendRedirect of 
servlet response it works, but not as clean as it should.

All pages inherits of this page :

   @ApplicationState
   private SimExplorerState applicationState;

   Object onActivate() throws SimExplorerException {
   [...]
   if (!userLogged) {
   String fromURL = requestGlobals.getRequest().getPath(); // 
get url being tried
   applicationState.setRequestedURL(fromURL); // save it in 
application state of user

   return Login; // redirect to login page
   }
   [...]
   return null;
   }

Then in Login :

   public Object onSuccessFromFormLogin() throws SimExplorerException, 
IOException {

   [...]
   if (success) {
   [...]  
   String fromURL = applicationState.getRequestedURL();

   if (fromURL == null) {
   return elementList;
   }
   //return fromURL.substring(1); // doesn't work, as context 
is then included in page name
   requestGlobals.getResponse().sendRedirect(fromURL); // bad 
as Tapestry will try to commit data again in response afterwards

   return null;
   }
   return this;
   }

Thanks for any advice!

--
Gabriel [EMAIL PROTECTED]
http://www.codelutin.com
tel : 02 40 50 29 28 / fax : 09 59 92 29 28


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



Re: T5: Palette

2008-03-13 Thread Gabriel Landais

Weisu a écrit :

Hi Gabriel, Could you help me on ValueEncoder? The data is return from
database as a List. My palette component is like this:

t:palette t:id=districts encoder=districtEncoder
model=districtModel/

My class is like this:

@Persist
private List districts;
public List getDistricts() {return districts;}

public void setDistricts(List districts) {this.districts = districts;}

@Persist
private List districtModel;
public List getDistrictModel() {
districtModel = getEditService().getDistricts(); //This return a List 
from
database
return districtModel;
}

public void setDistrictModel(List districtModel) {this.districtModel =
districtModel;}


So how do I define the encoder?

Thanks in advance!

Weisu.


  

This is how I've done it :

.tml :

input t:type=Palette model=groups selected=groupsOfUser 
encoder=groupEncoder /


Value encoder :

public class GroupValueEncoder implements ValueEncoderGroup {

   public GroupValueEncoder(parameters...) {
   super();
   
   }

   /* (non-Javadoc)
* @see org.apache.tapestry.ValueEncoder#toClient(java.lang.Object)
*/
   public String toClient(Group group) {
   return Integer.toString(group.getId());
   }

   /* (non-Javadoc)
* @see org.apache.tapestry.ValueEncoder#toValue(java.lang.String)
*/
   public Group toValue(String group) {
   Group group = retrieveGroupFromId(group);
   return group;
   }

}


Page class :

/** The selected groups. */
@Persist
private ListGroup groupsOfUser;

/** The group encoder (one per user). */
@Persist
private GroupValueEncoder groupEncoder;

/** Called on initialization. */
void setup(int userId) throws SimExplorerException {
groupEncoder = new GroupValueEncoder(parameters);
}

public ListGroup getGroups() {
// fill and return the list with all groups
}

public ValueEncoderGroup getGroupEncoder() {
return groupEncoder;
}

Group :
It has to implement hashCode(), as elements in both lists (available and 
selected) can be different in terms of instance but equals in terms of 
logic. T5 uses Map internally, so equals and hashCode should be 
implemented on your class.


--
Gabriel [EMAIL PROTECTED]
http://www.codelutin.com
tel : 02 40 50 29 28 / fax : 09 59 92 29 28


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



Contribute localized messages

2008-03-03 Thread Gabriel Landais

Hi,
we already use a i18n parser in our libraries (released as GPL aka 
lutinutil).
Is there a way to contribute messages properties? Haven't fund how to 
yet :(

Thanks
Gabriel

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



Re: [Tapestry Wiki] Update of Tapestry5GridComponent by GabrielLandais

2008-02-25 Thread Gabriel Landais

Davor Hrg a écrit :

nice entry..
in T5.0.11
I've failed to make this work:

How to add an extra column

You want to add an extra column called details to each line that
does not have a field in the POJO:

t:grid t:source=list row=person
  t:parameter name=detailsCell  !-- just invent a cell name --
t:pagelink t:page=person
t:context=person.id${person.lastname}/t:pagelink
  /t:parameter
/t:grid


I know it can be done by modifying BeanModel, but this seemed like
nice feature to try out.


Davor Hrg
  
I've not tried that part, but in my own code I generate a specialized 
property in my model (as I was getting an exception on unknown pojo 
property). I use null as PropertyConduit.


--
Gabriel [EMAIL PROTECTED]
http://www.codelutin.com
tel : 02 40 50 29 28 / fax : 09 59 92 29 28


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



.class coercion

2008-02-25 Thread Gabriel Landais

Hello,
I've a bean with a Class? property. I want to display the simple 
name, without success.


First it understands well that (T5.0.10) :

   public static void 
contributeDefaultDataTypeAnalyzer(MappedConfigurationClass?, String 
configuration) {

   configuration.add(Class.class, text);
   }

It display something like class my.package.entity.
As I'm trying to contribute my own TypeCoercer, it looks like it is not 
used :


   public static void 
contributeTypeCoercer(ConfigurationCoercionTuple configuration) {
   CoercionClass, String coercionClassString = new 
CoercionClass, String() {

   public String coerce(Class input) {
   if (input == null) {
   return ;
   }
   // my code normally looksup an enum
   return input.getSimpleName();
   }
   };
   configuration.add(new CoercionTupleClass, String(Class.class, 
String.class, coercionClassString));

   }

Any idea? I've added a read only property for the moment, perhaps a best 
way...


--
Gabriel [EMAIL PROTECTED]
http://www.codelutin.com
tel : 02 40 50 29 28 / fax : 09 59 92 29 28


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



Re: T5: Palette

2008-02-08 Thread Gabriel Landais

Daniel Pinheiro a écrit :

How can i use palette with data from DataBase? Can someone help me?
  
I had some troubles with JPA too. If you use one request to retrieve all 
elements and another one for selected elements, it will not be same 
instances in both case.

So for each Palette,  I have specified :
- a model : getter returning array Entity[] with all my entities
- a selected : returning a private ListEntity containing all 
selected elements. This property has getter setter and @Persist 
annotation. This list is initialized when page is setup for user. 
Elements in this list are not same instances as in model


You also have to code a subclass of ValueEncoderEntity. toClient 
returns the id of Entity, and toValue retrieve entity from database. You 
can contribute this in contributeValueEncoderSource of your 
--App--Module. But as you have lists, encoder can not be found from 
object class. So :


- an encoder : returning instance of your ValueEncoder subclass.

Finally, as selected items are removed from available items in display, 
it finds your elements in a hashmap. So you have to implement hashCode 
(and equals?) in Entity.


It should work then. I'm using facilities of JPA/Hibernate, so if you 
use plain old JDBC, I have no idea of how it can work...


References :
http://tapestry.formos.com/nightly/tapestry5/tapestry-core/ref/org/apache/tapestry/corelib/components/Palette.html
http://www.hibernate.org/109.html
http://www.nabble.com/Re%3A--T5--Select%2C-palette%2C-multiselect-p11886311.html

It would be a great page for wiki, at least if it is not wrong!

Gabriel

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



Re: What's heartbeat ?

2008-01-07 Thread Gabriel Landais

Michael Courcy a écrit :

If you look at this exemple :  TreeGridComponent
http://tapestry5-treegrid.googlecode.com/svn/trunk/tapestry5-treegrid/src/main/java/org/codelutin/tapestry/components/TreeGrid.java 

a hearbeat.begin is called in beginRender and heartbeat.end is called 
in afterRender but you can never read a call to defer, so can you 
explain why the author of this component call begin and end ? I really 
can't explain myself.
I've based my component on 
http://wiki.apache.org/tapestry/Tapestry5HowToCreateYourOwnComponents 
and http://wiki.apache.org/tapestry/Tapestry5TreeComponent without 
really understanding how it heartbeat works... As I don't use defer, I 
don't even know if it is useful...

Gabriel

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



Re: What's heartbeat ?

2008-01-07 Thread Gabriel Landais

Steph a écrit :

Your code Gabriel work as well without heartbeats ... ;-)

Stephane
  
Yes it is ;) Until you use defer, it should be useless. And as I think 
that I'll not need it, I remove it heartbeat reference.

Gabriel

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



[T5] Announce - TreeGrid component

2008-01-04 Thread Gabriel Landais

Hi,
I've just released an early version of a tree grid component. It is 
available via SVN on Google Code 
(http://code.google.com/p/tapestry5-treegrid/source).
The code is based upon sstree, and as an early release, code is ugly 
and without comment yet...


Gabriel

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



Re: Authentication Tapestry 5

2007-11-21 Thread Gabriel Landais

Peter Stavrinides a écrit :

Hi all

My question is more of a best practice related question, I want to use 
a filter to extract my authentication code from the rest of the 
application logic, [...]


Thanks in advance,
Peter


Hi,
First, I'm a real Tapestry newbie, and I believe that Tapestry has a
quite steep learning curve (at last for T5 with current documentation).
 I wish to use JAAS inside my webapp, and I didn't achieve to use a
Tapestry login form. So I'm using a basic html page with Tomcat out of
box security login config. Magically, I'm able to retrieve my principal
in the JBoss EJB3 context. I use those EJBs for authorizations, Tapestry
just not knows if users have rights on data, as I delegate only the V
of MVC to Tapestry. If a user doesn't have right on something, a
security exception is thrown by the model and displayed back to him.
 A better solution would be having one namespace dedicated to login
users, not protected by servlet container. A Tapestry component would be
able to login user, and redirect him to a component in another
namespace, this one protected by a security-constraint. I'm just more
confident in servlet container security filtering than in a home made
filter.

So, how can I login my user inside my component and be able to retrieve
my principal with RequestGlobals.getHTTPServletRequest().getUserPrincipal()?

Thanks,
Gabriel


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