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, A

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. wrote: > Hi, > i have some issues trying to save an Entitie in the database after filling > the coresponding

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(""); } Or you can use OutputRaw component: Or you can use Renderable to write markup: @Property(write = false) private final R

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 FieldTrans

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 wrote: > It's really simple to make

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 < michael.r.presc

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 wrote: > Thanks for your thoughts, and that leads me to the following suggestion to > resolve my problem: > > I've already contributed a custom RequestExceptionHandler using > binder.bind(RequestExceptionHandler.

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* *personeditor.tml* ... *page2.tml* All validation logic can be deffered using FormSupport. 2. Or you can use block parameters. *page.tml* *personeditor.tml*

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: tapestry.application-version ${project.version} Then you just need to enable filtering for web.xml in maven-war-plugin, e.g.: org.apache.maven.plugins maven-war-pl

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 @P

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 a

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 wrote: > Had

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 MappedConfiguration configuration, final MyService myService) { configuration.add("t

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 a

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 on

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 wrote: > Folks, > > I want to track my users. Is there a way to get host:port and ip ? > > Best regards > and thanks... KEN -- BR Ivan

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 Strin

Re: tapestry5.3 and Twitter-bootstrap disabled inputs

2013-03-06 Thread Ivan Khalopik
In this case "disabled" is T5 parameter, not html attribute. http://tapestry.apache.org/component-parameters.html This component will be rendered as: On Tue, Mar 5, 2013 at 4:59 PM, Tony Nelson wrote: > > >> -Original Message- >> From: Ivan Khalopik

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. Some value here If you need some client-side behaviour of enable/disable component use disabled attribute as mentioned earlier. Or: On Mon, Mar 4, 2013 at 3:33 PM, Lance Java wrote:

Re: Best generic way to use zones

2013-03-05 Thread Ivan Khalopik
Tapestry generates ids for components using id allocation mechanism. E.g. ... 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 requests as page is popula

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: Mixng cant find zone parameter

2013-02-28 Thread Ivan Khalopik
... ... ... public String getZoneFilterTypeId() { return zoneFilterType.getClientId();// return "zoneFilterType" + currentFilterSection.getKey(); } public String getZoneFilterPropertyId() { return zoneFilterProperty.getClientId();//return "zoneFilterPropert

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 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 message in conte

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 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 file , say an XML f

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: ... css: .my-own-cool-css-class tr { height: 200px; } On Mon, Feb 25, 2013 at 11:28 AM, Ken in Nashua wrote: > Thanks Ivan... > > But does your solution actually work for t-grid ? > > that wa

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: css: .my-own-cool-css-class .t-beaneditor-row { height: 200px; } On Mon, Feb 25, 2013 at 7:33 AM, Ken in Nashua wrote: > Hi, > > Does anyone know how

Re: Mixng cant find zone parameter

2013-02-24 Thread Ivan Khalopik
1) It seems that you use something like this ... ... public String getZoneFilterPropertyId() { return zone.getClientId(); } It makes a recursion in zoneId retrieval. You just need to remove id parameter from zone. ... On Mon, Feb 25, 2013 at 1:39 AM, bhorvat wrote: > Hi sody, > > T

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: But the tapestry-way is to create custom component for tab control with informal block parameters for tab contents: CONTENT CONTENT Or you can use some internal component model as paramete

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 s

Re: PersistenceConstants.FLASH cann't persist List 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 val

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 clas

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 t

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: wrote: > Folks, > > I am prototyping and want to fill i

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: 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 ComponentAction VALIDATE = new ComponentAction { public void execute(Coordina

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: 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 will

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

2012-11-20 Thread Ivan Khalopik
at least an > improvement if not a bug ? Or may be any other ideas ? > > And thanks a million for your help :) > > On Mon, Nov 19, 2012 at 5:44 PM, Ivan Khalopik > wrote: > > > All this because of changed form controls names after ajax update (some > > hash added to the e

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

2012-11-19 Thread Ivan Khalopik
e 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 > wrote: > > > Do you use component to show errors for whole form or just use > > separate

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

2012-11-19 Thread Ivan Khalopik
Do you use component to show errors for whole form or just use separate components to show errors for particular field? On Mon, Nov 19, 2012 at 6:28 PM, Muhammad Gelbana wrote: > When I first load my page, some form's fields are changed through ajax and > then I submit the form (Without ajax) w

Re: BeanEditForm and hibernate

2012-11-19 Thread Ivan Khalopik
y with ain't it? > > cheers, > > Nicolás.- > > > On Mon, Nov 19, 2012 at 8:11 AM, Ivan Khalopik > wrote: > > > You can try 2 options: > > > > 1. Use validation by name to prevent name changes before request to DB. > It > > will be executed bef

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 us

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() { //... } 2.

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 component but also this messages are connected to the fileds and can be used later: 1. You can remove and use component that will render error message for specified field, e.g. DUT 2. You can remove component

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: 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 setSubm

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 wrote: > Hi. I have problems understanding multiple submits. I am running T5.3.5. > > I have the following tml: > > id="singleUs

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 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 all the co

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 . As I understand in your code snippet you need something like with some styling: to To ma

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) { zone.process

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 try

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 OrderedConfig

Re: T4 to T5 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 pr

Re: Problem with tapestry ajax window refresh

2012-09-18 Thread Ivan Khalopik
You can also use invisible as a target of download link. It will prevent opening a new window: On Tue, Sep 18, 2012 at 9:05 AM, Waleriy wrote: > Thank you. That solution works. > > > > -- > View this message in context: > http://tapestry.1045711.n5.nabble.com/Problem-with-tapestry-ajax-win

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 logic

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 MappedConfiguration configuration) { //... configur