Re: Tapestry 5.1 on top of GORM Hibernate Session bound to thread

2009-04-07 Thread ice96

Thank you. This works like a charm.

Saddly but the Gorm events not work for me too. 

Now I'm thinking about the Tapestry Grid and the BeanEditForm form
improvements. I want automaticly bind belongsTo anotation for multiple
choice (select) in BeanEditForm. 
-- 
View this message in context: 
http://www.nabble.com/Tapestry-5.1-on-top-of-GORM-Hibernate-Session-bound-to-thread-tp22900050p22927783.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



Tapestry 5.1 on top of GORM Hibernate Session bound to thread

2009-04-05 Thread ice96

Hello,

I'm experimenting with T5.1 and GORM. At the moment I'm trying to save
models into the database. Models without associations like: hasMany and
BelongsTo works perfectly. But when I try To save model like this:


package org.example.entities
mport grails.persistence.Entity

@Entity
public class User {
  long id
  String login
  String password
  static belongsTo = [role:Role]

  static mapping = {
  table 'USERS'
  login column:'LOGIN'
  password column:'PASSWORD'
  }
}

With this:

package org.example.pages.users

import org.apache.tapestry5.annotations.Property
import org.apache.tapestry5.ioc.annotations.Inject
import org.example.entities.User
import org.slf4j.Logger

public class UsersAdd {
  @Inject
  private Logger log

  @Property
  private User user;

  Object onSuccess() {
user.save();
return null
  }

}


I have got an error: Hibernate Session bound to thread, and configuration
does not allow creation of non-transactional one here

As I sad, this works fine without associations. How to configure and pass
transactional session from Tapestry to Gorm?

Any suggestions?

-- 
View this message in context: 
http://www.nabble.com/Tapestry-5.1-on-top-of-GORM-Hibernate-Session-bound-to-thread-tp22900050p22900050.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



Re: Tapestry 5 server side validation

2008-06-06 Thread ice96

Thanks! I'm stupid!;)
-- 
View this message in context: 
http://www.nabble.com/Tapestry-5-server-side-validation-tp17680152p17687166.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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



Tapestry 5 server side validation

2008-06-05 Thread ice96

Hello, 
I have problems with tapestry 5 server side validations. First o all there
is my code:
package org.example.myapp.model;

import org.apache.tapestry.beaneditor.NonVisual;
import org.apache.tapestry.beaneditor.Validate;

public class User {
private int id;
private String name;
private String surname;


public int getId() {
return id;
}
@NonVisual
public void setId(int id) {
this.id = id;
}
@Validate(required)
public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

@Validate(required)
public String getSurname() {
return surname;
}

public void setSurname(String surname) {
this.surname = surname;
}
}



package org.example.myapp.pages;

import org.example.myapp.model.User;

public class Register {
private User user;

public User getUser() {
return user;
}

public void setUser(User user) {
this.user = user;
}

public Object onSubmit()
{
return Start.class;
}

}


html xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd;
head
titleRegister Page/title
/head
body
h1myapp Start Page/h1

p This is the start page for this application, a good place to
start your modifications.
Just to prove this is live: /p


t:beaneditform  t:id=user /

/body
/html



After disabling java script validation stop working. Some times after page
refresh I can see validatio messanges, but not after click submit button. I
have tested on firefox 3  and opera (in linux)
-- 
View this message in context: 
http://www.nabble.com/Tapestry-5-server-side-validation-tp17680152p17680152.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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



Tapestry 5 Beaneditform and TextFlield

2008-05-06 Thread ice96

Hello,
I have simple question: I have extended TextField component with few new
futures (I called it Input), now I want to replace TextField component to my
Input component in BeanEditForm. Is it not painfull way without tapestry
corelib recompilation?
-- 
View this message in context: 
http://www.nabble.com/Tapestry-5-Beaneditform-and-TextFlield-tp17093611p17093611.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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



tooltips (hints) for form components

2008-04-23 Thread ice96

Hello,
is it way to extend all form input components with function witch onFocus
shows hint (tooltip) onBlur hides?
Any suggestions?
-- 
View this message in context: 
http://www.nabble.com/tooltips-%28hints%29-for-form-components-tp16834806p16834806.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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



[T5:] extend input components for tooltips

2008-04-07 Thread ice96

Hello,
I have greate idea to create nice toolTips  (hints) for input which get
hint-+ _resources.getId().
This part is working, now I want to find  way how to extend components like
textfield and add onBlur method call to toolTip. Anyone could help me?

Source of my tooltip component:


package org.stml.stmljms.components;

import org.apache.tapestry.ComponentResources;
import org.apache.tapestry.MarkupWriter;
import org.apache.tapestry.PageRenderSupport;
import org.apache.tapestry.TapestryConstants;
import org.apache.tapestry.annotations.AfterRender;
import org.apache.tapestry.annotations.BeginRender;
import org.apache.tapestry.annotations.Environmental;
import org.apache.tapestry.annotations.IncludeJavaScriptLibrary;
import org.apache.tapestry.annotations.IncludeStylesheet;
import org.apache.tapestry.annotations.Parameter;
import org.apache.tapestry.ioc.annotations.Inject;
import org.apache.tapestry.services.Environment;
import org.apache.tapestry.dom.Element;

@IncludeJavaScriptLibrary(value = {
${tapestry.scriptaculous}/prototype.js,
${tapestry.scriptaculous}/scriptaculous.js,
${commons.scripts}/Tooltip.js })
@IncludeStylesheet(value = { ${commons.stylesheets}/Tooltip.css })
public class MyToolTip {
@Parameter(value = , required = false, defaultPrefix = literal)
private String _value;

@Inject
private ComponentResources _resources;

@Parameter(value = prop:componentResources.id, defaultPrefix =
TapestryConstants.LITERAL_BINDING_PREFIX)
private String _clientId;

@Environmental
private PageRenderSupport _pageRenderSupport;

@Inject
private Environment _environment;

private String _assignedClientId;

void setupRender() {
if (_resources.getContainerResources().getMessages().contains(
hint- + _resources.getId())) {
_assignedClientId = 
_pageRenderSupport.allocateClientId(_clientId);
}
}

@BeginRender
void render(MarkupWriter writer) {

String hint = ;
if (_resources.getContainerResources().getMessages().contains(
hint- + _resources.getId())) {


Element element = writer.element(div);
element.attribute(id, _assignedClientId);

//  writer.write(Component   + _resources.getId() +  
hint:  + hint);
}

}

@AfterRender
void doAfterRender(MarkupWriter writer) {

if (_resources.getContainerResources().getMessages().contains(
hint- + _resources.getId())) {

writer.end();

String jsCommand = new Tip('%s', '%s';
jsCommand += , {className: 'tap5c_tooltip';

jsCommand += , title: ' + no title + ';

jsCommand += , effect: ' + blind + ';

jsCommand += });;

String hint = 
_resources.getContainerResources().getMessages().get(
hint- + _resources.getId());


_pageRenderSupport.addScript(jsCommand, _assignedClientId, 
hint);
}
}
}


-- 
View this message in context: 
http://www.nabble.com/-T5%3A--extend-input-components-for-tooltips-tp16537225p16537225.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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



Re: T5: mixing select component onchange=this.form.submit() and zone component

2008-04-06 Thread ice96

Thanks, I removed t:submit/
Now submit works but I'm getting error:

org.apache.tapestry.runtime.ComponentEventException
A component event handler method returned the value
[EMAIL PROTECTED] Return type
org.apache.tapestry.internal.structure.BlockImpl can not be handled.
Configured return types are java.lang.Class, java.lang.String, java.net.URL,
org.apache.tapestry.Link, org.apache.tapestry.StreamResponse,
org.apache.tapestry.runtime.Component.
-- 
View this message in context: 
http://www.nabble.com/T5%3A-mixing-select-component-onchange%3D%22this.form.submit%28%29%22-and-zone-component-tp16516982p16521656.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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



Re: T5: mixing select component onchange=this.form.submit() and zone component

2008-04-06 Thread ice96

Ok. Now I found solurtion. for onSelect we can use tapestry5 components.
Now my trouble with zone and block component
Test5:tml:
html xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd;
head
titleAjax test/title
/head
body


t:block t:id=dynamicBlock
fun dynamic block!
${color}
t:beaneditform t:id=oRegisterEquipmentForm
submitlabel=order

reorder=name,surname,frequency,weekDay,lecture,laptop,multimedia,auditorium,destination,bring,group,add_notes,dateFrom,dateTo
/
br/

/t:block

form t:type=Form t:id=playerForm t:zone=zoneToUpdatet:label
for=color /: t:select t:id=color model=literal:Red,Green,Blue
t:mixins=t5components/OnEvent event=change
onCompleteCallback=onSelectCompleteFunction //form

t:zone t:id=zoneToUpdate
Content before update
/t:zone


script type=text/javascript
function onSelectCompleteFunction(response)
{
$('zoneToUpdate').update(response);
}

/script
/body
/html


Test5.java:

package org.stml.stmljms.pages.operators;

import java.util.Date;

import org.apache.tapestry.Block;
import org.apache.tapestry.StreamResponse;
import org.apache.tapestry.annotations.OnEvent;
import org.apache.tapestry.annotations.Property;
import org.apache.tapestry.corelib.components.Zone;
import org.apache.tapestry.ioc.annotations.Inject;
import org.apache.tapestry.util.TextStreamResponse;
import org.stml.stmljms.forms.ORegisterEquipmentForm;
import org.stml.stmljms.services.OrderService;

public class Test5 {
@Inject
private OrderService orderService;

@Property
private String color;
private ORegisterEquipmentForm oRegisterEquipmentForm;

@Inject
private Block dynamicBlock;


public String getColor() {
return color;
}

public void setColor(String color) {
System.out.println(xxx asd);
this.color = color;
}

public ORegisterEquipmentForm getORegisterEquipmentForm() {
return oRegisterEquipmentForm;
}

public void setORegisterEquipmentForm(
ORegisterEquipmentForm registerEquipmentForm) {
oRegisterEquipmentForm = registerEquipmentForm;
}

@OnEvent(component = color, value = change)
public Block onChange()
{
 System.out.println(it works);
 return dynamicBlock;
 //return new TextStreamResponse(text/html, new 
Date().toString());
}
/*
@OnEvent(component = playerForm, value = success)
private Block successFromTheForm() {
System.out.println(sitas irgi veikia);
return dynamicBlock;
}
*/
/*
 * @OnEvent(value = submit) public Object save() { //
 *
(oRegisterEquipmentForm.getDateTo()-oRegisterEquipmentForm.getDateFrom())
 * orderService.setOrder(oRegisterEquipmentForm); return 
operators/Start;
}
 */
}



I got view with java script debug. Anyone could help me?
Btw. Data component in block doesn't work.:(

http://www.nabble.com/file/p16522871/Screenshot.png Screenshot.png 

-- 
View this message in context: 
http://www.nabble.com/T5%3A-mixing-select-component-onchange%3D%22this.form.submit%28%29%22-and-zone-component-tp16516982p16522871.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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



T5: mixing select component onchange=this.form.submit() and zone component

2008-04-05 Thread ice96

Hello,
I have problem. I want to do same action as on click submit button.
source:

Test3.tml

html xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd;
head
titleAjax test/title
/head
body


  t:block t:id=dynamicBlock
fun dynamic block!
${color}
br /
  
/t:block

form t:type=Form t:id=playerForm t:zone=zoneToUpdate
t:label for=color /:
t:select t:id=color model=literal:Red,Green,Blue
onchange=this.form.submit() /
t:submit/
/form

   t:zone t:id=zoneToUpdate
Content before update
/t:zone

/body
/html


Test3.java:
package org.stml.stmljms.pages.operators;

import java.util.Date;

import org.apache.tapestry.Block;
import org.apache.tapestry.annotations.OnEvent;
import org.apache.tapestry.annotations.Property;
import org.apache.tapestry.ioc.annotations.Inject;

public class Test3 {
private String color;
@Inject
private Block dynamicBlock;

public String getColor() {
return color;
}



public void setColor(String color) {
System.out.println(xxx asd);
this.color = color;
}

@OnEvent(component = playerForm, value = success)
private Block successFromTheForm() {
System.out.println(xxx bsd);
return dynamicBlock;
}

}


FireBug says for me this.form.submit is not a function

Could anyone help me?
-- 
View this message in context: 
http://www.nabble.com/T5%3A-mixing-select-component-onchange%3D%22this.form.submit%28%29%22-and-zone-component-tp16516982p16516982.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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