Re: upload files an zone

2013-08-20 Thread Ivan Khalopik
Standard tapestry upload component doesn't work with ajax requests and so it can not be used in zone. You can try custom solution like this: http://mutabra.blogspot.com/2012/07/tapestry-ajax-upload-fixin.html Or this: http://tawus.wordpress.com/2011/06/25/ajax-upload-for-tapestry/ On Tue,

Re: nullpointer exception

2013-08-02 Thread Ivan Khalopik
It happens because your entity is null. It can be because you didn't initialize it in prepare for submit handler or with page activation context. On Fri, Aug 2, 2013 at 10:06 AM, Will N. llcool_wil...@yahoo.fr wrote: Hi, i have some issues trying to save an Entitie in the database after

Re: How to write HTML from java page

2013-07-11 Thread Ivan Khalopik
If you want to render string as html you need to use MarkupWriter#writeRaw() method: void beginRender(MarkupWriter writer) { writer.writeRaw(input type='checkbox' name='leaf' id='leaf' value='leaf'/); } Or you can use OutputRaw component: t:outputraw value=testFunction()/ Or

Re: Conditional translator

2013-07-08 Thread Ivan Khalopik
You can dynamically create translator: @Inject private FieldTranslatorSource fieldTranslatorSource; public getMyTranslator() { switch(myAccountType) { case ACCOUNT_TYPE1: return createTranslator(myField, myTranslator1); // other types } return null; } protected

Re: Disabling filling form with old values on validation failure

2013-06-15 Thread Ivan Khalopik
You can reset field recorded value by calling recordInput method with null parameter value: tracker.recordInput(myField, null); The same way to reset recorded error for field: tracker.recordError(myField, null); On Fri, Jun 14, 2013 at 2:11 AM, Ryan How r...@zbit.net.au wrote: It's really

Re: @BeginRender equivalent for component AJAX events

2013-04-24 Thread Ivan Khalopik
One note about ZoneRefresh mixin: https://issues.apache.org/jira/browse/TAP5-2100 So it provides not the original event context(that was encoded in url) but the context populated from parameter. And so it has no sence for now. On Wed, Apr 24, 2013 at 4:21 PM, Michael Prescott

Re: SymbolConstants.APPLICATION_VERSION = maven build version

2013-04-09 Thread Ivan Khalopik
If you have web application you can use context param to specify application version: context-param param-nametapestry.application-version/param-name param-value${project.version}/param-value /context-param Then you just need to enable filtering for web.xml in

Re: Reuse component containing form, but with extra fields

2013-04-09 Thread Ivan Khalopik
1. You can move form up, so that you personeditor component will contain only form controls: *page.tml* t:form t:personeditor t:person=person / /t:form *personeditor.tml* t:textfield t:value=person.name / ... *page2.tml* t:form t:personeditor t:person=person / t:textfield

Re: [T5] Avoid logs in error for wrong urls and missing components ?

2013-04-09 Thread Ivan Khalopik
What about configuring robots.txt? On Sat, Apr 6, 2013 at 1:50 PM, Nicolas Bouillon nico...@bouillon.netwrote: Thanks for your thoughts, and that leads me to the following suggestion to resolve my problem: I've already contributed a custom RequestExceptionHandler using

Re: getting context from java Class

2013-04-08 Thread Ivan Khalopik
If you need context path you can inject Request: @Inject private Request request; public String getContextPath() { return request.getContextPath() } On Mon, Apr 8, 2013 at 10:25 AM, Taha Hafeez Siddiqi tawus.tapes...@gmail.com wrote: Hi You can use assets in your page using @Path

Re: RegistryShutdownHub replacement?

2013-04-02 Thread Ivan Khalopik
As I know RegistryShutdownHub is not deprecated. RegistryShutdownListener is deprecated and can be replaced with a Runnable. http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ioc/services/RegistryShutdownHub.html#addRegistryShutdownListener(java.lang.Runnable) On Tue, Apr 2, 2013

Re: ServiceOverride IoC recursion exception

2013-03-29 Thread Ivan Khalopik
Had the same issue when tried to use some service inside SymbolProvider contribution. E.g. @ApplicationDefaults @Contribute(SymbolProvider.class) public void contributeApplicationDefaults(final MappedConfigurationString, String configuration, final MyService myService) {

Re: ServiceOverride IoC recursion exception

2013-03-29 Thread Ivan Khalopik
And the third option is to play with ApplicationDefaults, FactoryDefaults, e.g. ApplicationDefaults has no service dependencies, tapestr.production-mode symbol should be configured here, FactoryDefaults can depend on your services. On Fri, Mar 29, 2013 at 11:11 AM, Ivan Khalopik ikhalo

Re: Ways to trigger on value change for the select component

2013-03-26 Thread Ivan Khalopik
It depends on your task. If it is related to validation you can campare values in onValidate handler: @OnEvent(value=EventConstants.VALIDATE, component=mySelect) void validateMaySelect(MyValue newValue) { if (!myValue.equals(newValue)) { // your code here } } Or you can use getter

Re: InjectComponent Field in component and validate field in page class

2013-03-21 Thread Ivan Khalopik
You can add getter for injected field inside vendor component: Vendor.class @InjectComponent private Field vendorNameField; public Field getVendorNameField() { return vendorNameField; } Then inject vendor component inside the page Page.class @InjectComponent private Vendor vendor; void

Re: is there a way to get the hostname:port and IP address

2013-03-16 Thread Ivan Khalopik
It is not a tapestry question. http://docs.oracle.com/javaee/5/api/javax/servlet/ServletRequest.html On Sat, Mar 16, 2013 at 11:42 PM, nhhockeyplayer nashua nhhockeypla...@hotmail.com wrote: Folks, I want to track my users. Is there a way to get host:port and ip ? Best regards and

Re: client id problem with nested components

2013-03-12 Thread Ivan Khalopik
I think the issue is that you use clientId directly in your getClientId() method. To have a unique id you need to add some additional work. You can look at AbstractField implementation: @Parameter(value = prop:componentResources.id, defaultPrefix = BindingConstants.LITERAL) private String

Re: tapestry5.3 and Twitter-bootstrap disabled inputs

2013-03-06 Thread Ivan Khalopik
...@starpoint.com wrote: -Original Message- From: Ivan Khalopik [mailto:ikhalo...@gmail.com] Sent: Tuesday, March 05, 2013 3:34 AM To: Tapestry users Subject: Re: tapestry5.3 and Twitter-bootstrap disabled inputs You can use span element with .uneditable-input if you have some field

Re: Best generic way to use zones

2013-03-05 Thread Ivan Khalopik
Tapestry generates ids for components using id allocation mechanism. E.g. t:zone t:id=myZone.../t:zone In this case T5 will try to allocate myZone as id for zone. If this id is already allocated by some other component it will try myZone_0, then myZone_1... This rule is broken inside ajax

Re: tapestry5.3 and Twitter-bootstrap disabled inputs

2013-03-05 Thread Ivan Khalopik
You can use span element with .uneditable-input if you have some field that should not be modified at all. span class=input-xlarge uneditable-inputSome value here/span If you need some client-side behaviour of enable/disable component use disabled attribute as mentioned earlier. input type=text

Re: Conditional service override

2013-03-01 Thread Ivan Khalopik
There is a helper method in configuration classes for service autobuilding: configuration.addInstance(FooService.class, DevFooService.class); But I think autobuilding inside service override contribution is not a good idea as it can result in recursion if service has complex dependency tree. The

Re: Add a getServiceById method to Registry ?

2013-02-28 Thread Ivan Khalopik
You can use registry.getService(serviceId, serviceInterface) On Thu, Feb 28, 2013 at 11:52 AM, antalk nab...@vankalleveen.net wrote: Is it an idea to add a 'getServiceById' method to the Registry ? The reason: We are calling Tapestry service methods from a declarative view. We have some

Re: Add a getServiceById method to Registry ?

2013-02-28 Thread Ivan Khalopik
registry.getService(serviceId, Object.class) On Thu, Feb 28, 2013 at 12:30 PM, antalk nab...@vankalleveen.net wrote: Not really, i still have to specify the full class of the interface. I just want to get a service by it's ID without specifying any class or interface. -- View this

Re: Mixng cant find zone parameter

2013-02-28 Thread Ivan Khalopik
t:zone t:id=zoneFilterType id=prop:ZoneFilterTypeId ... t:zone t:id=zoneFilterProperty id=prop:ZoneFilterPropertyId ... /t:zone ... /t:zone public String getZoneFilterTypeId() { return zoneFilterType.getClientId();// return zoneFilterType + currentFilterSection.getKey(); }

Re: how to adjust row height of tapestry grid component

2013-02-25 Thread Ivan Khalopik
You just need to override css for t-beaneditor-row. Global solution: .t-beaneditor-row { height: 200px; } More flexible solution: div class=t-beaneditor my-own-cool-css-class t:beaneditor object=mb:bean t:mixins=tynamo/BeanModelAdvisor/ /div css: .my-own-cool-css-class .t-beaneditor-row

Re: how to adjust row height of tapestry grid component

2013-02-25 Thread Ivan Khalopik
It works everywhere. Global solution: .t-data-grid tr { height: 200px; } Flexible solution: t:grid class=t-data-grid my-own-cool-css-class ... /t:grid css: .my-own-cool-css-class tr { height: 200px; } On Mon, Feb 25, 2013 at 11:28 AM, Ken in Nashua kcola...@live.com wrote: Thanks

Re: how to render a TML page as-is

2013-02-24 Thread Ivan Khalopik
Use components, e.g. splash.tml + Spash.java. So you will have something like: div id=tab0 class=content t:splash/ /div But the tapestry-way is to create custom component for tab control with informal block parameters for tab contents: t:tabs ...parameters... p:tab0 CONTENT /p:tab0

Re: Mixng cant find zone parameter

2013-02-24 Thread Ivan Khalopik
1) It seems that you use something like this t:zone t:id=zone id=prop:zoneFilterPropertyId ... t:select zone=prop:zoneFilterPropertyId .../ ... /t:zone public String getZoneFilterPropertyId() { return zone.getClientId(); } It makes a recursion in zoneId retrieval. You just need to remove id

Re: Mixng cant find zone parameter

2013-02-23 Thread Ivan Khalopik
1. Each row will generate its own zone with unique id, so you can't use static value for zone parameter. But you can use clientId of injected zone: @InjectComponent provate Zone zone; public String getZoneId() { return zone.getClientId(); } 2. If you will use @BindParameter annotation - both

Re: PersistenceConstants.FLASH cann't persist ListString langs

2013-02-22 Thread Ivan Khalopik
As far as I understood flash strategy is needed to store values between form submission and render requests. Your flow: 1. onActivate() create values and store them in session 2. onSubmit() retrieve values and remove them from session = add value to detached collection 3. onActivate() retrieve

Re: How to disable bootstrap label/button hover behavior?

2013-02-20 Thread Ivan Khalopik
// Hover/focus state, but only for links a { .label:hover, .label:focus, .badge:hover, .badge:focus { color: @white; text-decoration: none; cursor: pointer; } } This lines are from the latest bootstrap sources. It adds hover behaviour only for links with label/badge class.

Re: how to send a row information in ajaxformloop

2013-02-19 Thread Ivan Khalopik
As far as i understood you can't do this with common tapestry select component. It has no context for VALUE_CHANGED event except selected value. But you can try to implement your own logic. Just copy logic responsible for VALUE_CHANGED event from tapestry select component to mixin and add context

Re: simple page render

2013-02-18 Thread Ivan Khalopik
You can create your own component for rendering plain html files. I had something similar to your issue - source code rendering. https://github.com/sody/heroku-samples/blob/master/src/main/java/com/example/ui/components/Source.java usage: t:source content=classpath:sources/Source1.java/ Or you

Re: Form fields based on List

2013-02-15 Thread Ivan Khalopik
You can wrap this fields with custom component, e.g. CoordinateEdit. Then inject all needed fields using @InjectComponent annotation. In afterRender or cleanupRender method you can use such trick: private static final ComponentActionCoordinateEdit VALIDATE = new ComponentActionCoordinateEdit {

Re: Form fields based on List

2013-02-15 Thread Ivan Khalopik
And your encoder (that uses value index within list) can be replaced with formState=iteration on loop component -- BR Ivan

Re: [5.3.6] Validation errors are only shown on the second submit

2012-11-20 Thread Ivan Khalopik
to the fields. But when I update the form's fields using ajax, it's broken. I have a feeling this could be wrong but its my very best guess so far. On Mon, Nov 19, 2012 at 5:33 PM, Ivan Khalopik ikhalo...@gmail.com wrote: Do you use t:errors component to show errors for whole form

Re: smart menu links

2012-11-20 Thread Ivan Khalopik
You can extract li items with content to separate component, e.g MenuItem with parameter 'page'. Inside this component you can get this parameter value, check whether this page is allowed for current user and if yes then render li with inner PageLink component. If no then render nothing. So it

Re: [5.3.6] How Select's ajax request could reload the whole page

2012-11-20 Thread Ivan Khalopik
Select component with enabled ajax posts ajax request to the server-side. Then server-side dispatches it to correspondent event handler and it returns some value. Then this value goes to correspondent ComponentEventResultProcessor and generates response markup. Then this markup goes to client-side

Re: [t5.3.6] Form's recordError(Field, String) behavior

2012-11-19 Thread Ivan Khalopik
When you use recordError(field, Message) you have not only messages listed by t:errors/ component but also this messages are connected to the fileds and can be used later: 1. You can remove t:errors and use t:error for=field/ component that will render error message for specified field, e.g. div

Re: BeanEditForm and hibernate

2012-11-19 Thread Ivan Khalopik
You can try 2 options: 1. Use validation by name to prevent name changes before request to DB. It will be executed before name property will be assigned to new value: @OnEvent(value=EventConstants.VALIDATE_FORM, component=nameField) public void validateName() { //... } t:beaneditform

Re: Changing to default localization without extension for the language

2012-11-19 Thread Ivan Khalopik
I don't understand your question. But if you change locale using PersistentLocale service it will be persisted in URL and be changed for next page request. The new localale should also be configured in tapestry.supported-locales symbol. If you want to chnge locale just for this request you can use

Re: BeanEditForm and hibernate

2012-11-19 Thread Ivan Khalopik
, Nicolás.- On Mon, Nov 19, 2012 at 8:11 AM, Ivan Khalopik ikhalo...@gmail.com wrote: You can try 2 options: 1. Use validation by name to prevent name changes before request to DB. It will be executed before name property will be assigned to new value: @OnEvent(value

Re: [5.3.6] Validation errors are only shown on the second submit

2012-11-19 Thread Ivan Khalopik
Do you use t:errors component to show errors for whole form or just use separate t:error components to show errors for particular field? On Mon, Nov 19, 2012 at 6:28 PM, Muhammad Gelbana m.gelb...@gmail.comwrote: When I first load my page, some form's fields are changed through ajax and then I

Re: [5.3.6] Validation errors are only shown on the second submit

2012-11-19 Thread Ivan Khalopik
this could be wrong but its my very best guess so far. On Mon, Nov 19, 2012 at 5:33 PM, Ivan Khalopik ikhalo...@gmail.com wrote: Do you use t:errors component to show errors for whole form or just use separate t:error components to show errors for particular field? On Mon, Nov 19, 2012

Re: Posting from multiple submits

2012-10-05 Thread Ivan Khalopik
Just tried your code and everething works as expected. Have you any client side errors reported by your browser? On Fri, Oct 5, 2012 at 8:41 AM, Henrik von Schlanbusch hen...@enovate.nowrote: Hi. I have problems understanding multiple submits. I am running T5.3.5. I have the following tml:

Re: Posting from multiple submits

2012-10-05 Thread Ivan Khalopik
It seems that you have error in setSubmittingElement js function. This function is responsible of functionality you need. It sets the id and name of submit button the form was submitted from. Hmm - I did not see this. This may be the source of my problems? Yes, exactly. You have error in

Re: Update form inside zone on submit failure

2012-10-05 Thread Ivan Khalopik
Use EventConstants.FAILURE event handler to return updated zone. There is also a bug in T5 with form validation inside zone: https://issues.apache.org/jira/browse/TAP5-1512 You can try a workaround for this: http://mutabra.blogspot.com/2012/09/tapestry-fixed-control-name-fixin.html On Fri, Oct

Re: Label component usage

2012-10-01 Thread Ivan Khalopik
Label component is used in addition to t5 Field component, so for parameter is required and Field with defined identifier should exist. In case if you need just an html label element you can use html tag label. As I understand in your code snippet you need something like span with some styling:

Re: block delegate usage

2012-10-01 Thread Ivan Khalopik
use block:autoPagingContent instead of block:components.autoPagingContent On Mon, Oct 1, 2012 at 7:40 AM, Ken in Nashua kcola...@live.com wrote: Hi Folks, I am modeling a gallery in a template. This worked beautiful in T4. But for T5 I have the following: Gallery.TML (without showing

Re: Zone update after ajax request to component event

2012-09-28 Thread Ivan Khalopik
As you use your own zone update mechanism instead of native(e.g. EventLink component) you can provide js-callback for ajax request as you mention before. To update zone use something like this: var zone = Tapestry.findZoneManager(spec.zoneId); function rowClickCalback(response) {

Re: T4 to T5 select component usage

2012-09-21 Thread Ivan Khalopik
1. To place components defined in java class on your template you should use t:id attribute equal to field name(id attribute references clientId logic). As you don't use this attribute in your code snippet you have 2 separate selects. One of this selects are defined within java class and doesn't

Re: Tapestry Spring localization

2012-09-21 Thread Ivan Khalopik
You need to contribute ComponentMessagesSource service: @Contribute(ComponentMessagesSource.class) public static void contributeComponentMessagesSource( @Value(com/example/my-messages1) final Resource myMessage1, @Value(com/example/my-messages2) final Resource myMessage2, final

Re: Preload js after block update

2012-09-21 Thread Ivan Khalopik
If you need to load all scripts when page is loaded just place @Import annotation to your page java class. There is no way to make it dynamicly as components placed in block are not rendered and as result doesn't add their scripts to page. You need to specify all scripts explicitly. Or you can

Re: Problem with tapestry ajax window refresh

2012-09-18 Thread Ivan Khalopik
You can also use invisible iframe as a target of download link. It will prevent opening a new window: t:eventlink target=_download/ !-- somewhere in the bottom -- iframe name=_download style=display:none;/iframe On Tue, Sep 18, 2012 at 9:05 AM, Waleriy walera0...@mail.ru wrote: Thank you.

Re: One Template to include another TML - JSP style

2012-09-13 Thread Ivan Khalopik
I think this is not a good solution to have a view page that consists of form elements. Usually view pages are represented as plain text. But technically there are two ways to reuse code/markup in tapestry: 1. Composition. As was mentioned earlier in this thread we can extract all repeatable

Re: refreshing zone without highlighting it

2012-09-12 Thread Ivan Khalopik
Since 5.3 you can also contribute application defaults to change default values for zone update and show parameter. @Contribute(SymbolProvider.class) @ApplicationDefaults public void contributeApplicationDefaults(final MappedConfigurationString, String configuration) { //...