You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Lance Java <la...@googlemail.com> on 2013/03/13 09:52:10 UTC

Read only bindings - How do I set their value from a mixin?

In a mixin, I can change the value of a component parameter using
@BindParameter to get a mirror of the parameter and then updating the
mirrored value.

This is fine with the prop: and var: bindings since they are read/write
bindings. If I try this with a parameter which is bound to symbol: or
literal: the update fails with "Binding %s is read-only" (originating from
AbstractBinding).

Is there any way that I can change a component parameter that is bound to
literal: or symbol: from a mixin?



--
View this message in context: http://tapestry.1045711.n5.nabble.com/Read-only-bindings-How-do-I-set-their-value-from-a-mixin-tp5720446.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: Read only bindings - How do I set their value from a mixin?

Posted by Lance Java <la...@googlemail.com>.
I think that the ParameterWorker is outside of my comfort zone. I'll leave
it the tapestry dev team's capable hands.

Feel free to use the selenium test from my patch.


On 26 March 2013 16:57, Lance Java <la...@googlemail.com> wrote:

> > As I've said in the dev mailing list... this should be fixed in the way
> Tapestry handles parameters
> Damn!! Wish I'd read this before I started
>
> > To me it's clear how to make it do what I want. The question how should
> the symbol binding work
> In my opinion, if a binding is invariant, I think a PerThreadValue should
> be initialized and future get() operations pass through to the
> PerThreadValue.
>
>
> On 26 March 2013 16:53, Barry Books <tr...@gmail.com> wrote:
>
>> > The code that handles the parameters is in the parameter worker. I
>> think it could be fixed here but it's a bit messy. The real problem is the
>> symbol binding is invariant but you want to set it. Should that be an error
>> or not?
>>
>> From looking at the code it's clear the  symbol binding can just ignore
>> the set because it only calls the get once.
>>
>> I also think it would still work if the symbol binding was invariant.
>>
>> To me it's clear how to make it do what I want. The question how should
>> the symbol binding work
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>

Re: Read only bindings - How do I set their value from a mixin?

Posted by Lance Java <la...@googlemail.com>.
> As I've said in the dev mailing list... this should be fixed in the way
Tapestry handles parameters
Damn!! Wish I'd read this before I started

> To me it's clear how to make it do what I want. The question how should
the symbol binding work
In my opinion, if a binding is invariant, I think a PerThreadValue should
be initialized and future get() operations pass through to the
PerThreadValue.


On 26 March 2013 16:53, Barry Books <tr...@gmail.com> wrote:

> > The code that handles the parameters is in the parameter worker. I think
> it could be fixed here but it's a bit messy. The real problem is the symbol
> binding is invariant but you want to set it. Should that be an error or not?
>
> From looking at the code it's clear the  symbol binding can just ignore
> the set because it only calls the get once.
>
> I also think it would still work if the symbol binding was invariant.
>
> To me it's clear how to make it do what I want. The question how should
> the symbol binding work
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Read only bindings - How do I set their value from a mixin?

Posted by Barry Books <tr...@gmail.com>.
> The code that handles the parameters is in the parameter worker. I think it could be fixed here but it's a bit messy. The real problem is the symbol binding is invariant but you want to set it. Should that be an error or not?  

From looking at the code it's clear the  symbol binding can just ignore the set because it only calls the get once. 

I also think it would still work if the symbol binding was invariant. 

To me it's clear how to make it do what I want. The question how should the symbol binding work 


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


Re: Read only bindings - How do I set their value from a mixin?

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Tue, 26 Mar 2013 12:36:07 -0300, Lance Java <la...@googlemail.com>  
wrote:

> FYI, I've created a Jira ticket and attached a patch based on
> PerThreadValue for literal, message and symbol bindings.
> The patch includes a unit test and a selenium test.

As I've said in the dev mailing list, if possible (and I don't know  
whether it is or not), this should be fixed in the way Tapestry handles  
parameters, not in the bindings.

-- 
Thiago H. de Paula Figueiredo

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


Re: Read only bindings - How do I set their value from a mixin?

Posted by Lance Java <la...@googlemail.com>.
FYI, I've created a Jira ticket and attached a patch based on
PerThreadValue for literal, message and symbol bindings.
The patch includes a unit test and a selenium test.

https://issues.apache.org/jira/browse/TAP5-2099

Could one of the tapestry comitters please take a look?

Thanks,
Lance.


On 23 March 2013 11:35, Barry Books <tr...@gmail.com> wrote:

> OK that makes more sense. It's basically the same as using the request
> object. If we don't hear anything this weekend I'll post over on the
> dev list on Monday. Perhaps we can get an explanation about how
> Bindings and Parameters really work. I think I understand why the code
> I have works but I might be using features that could change.
>
> Even if the value needs to be stored I'm certain this approach will
> work and solve the @BindParameter problem.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Read only bindings - How do I set their value from a mixin?

Posted by Barry Books <tr...@gmail.com>.
OK that makes more sense. It's basically the same as using the request
object. If we don't hear anything this weekend I'll post over on the
dev list on Monday. Perhaps we can get an explanation about how
Bindings and Parameters really work. I think I understand why the code
I have works but I might be using features that could change.

Even if the value needs to be stored I'm certain this approach will
work and solve the @BindParameter problem.

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


Re: Read only bindings - How do I set their value from a mixin?

Posted by Lance Java <la...@googlemail.com>.
Ah, sorry, I see where you are coming from. Tapestry has a special type of
thread local which is cleaned up after each request. It's called a
PerThreadValue. That's what I was ultimately referring to.
On 23 Mar 2013 01:30, "Barry Books" <tr...@gmail.com> wrote:

> My impression was Thread Local gives you an instance of an Object for
> each thread. If you run Tomcat with 100 thread pool you will have at
> most 100 different objects no matter how many connections you have and
> since a new connection is handled by an existing thread it will pick
> up the values from the previous request that used that thread. I think
> you could use the request to store the value in but as I said I don't
> think it's necessary. I'll post a request on the Dev list. It would be
> nice to solve this problem because it seems all the parameters I'd
> like to have control over are the ones with default values.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Read only bindings - How do I set their value from a mixin?

Posted by Barry Books <tr...@gmail.com>.
My impression was Thread Local gives you an instance of an Object for
each thread. If you run Tomcat with 100 thread pool you will have at
most 100 different objects no matter how many connections you have and
since a new connection is handled by an existing thread it will pick
up the values from the previous request that used that thread. I think
you could use the request to store the value in but as I said I don't
think it's necessary. I'll post a request on the Dev list. It would be
nice to solve this problem because it seems all the parameters I'd
like to have control over are the ones with default values.

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


Re: Read only bindings - How do I set their value from a mixin?

Posted by Lance Java <la...@googlemail.com>.
Hi Barry, I'm not sure you understand a Thread Local, it's guaranteed to be
thread safe since it's local to a thread

I would appreciate it if a tapestry committer could chime in with their
thoughts.

Thanks,
Lance
 On 22 Mar 2013 20:52, "Barry Books" <tr...@gmail.com> wrote:

> The method is isInvariant so returning false means the value can
> change. This is confusing and it seems like a double negative to me.
>
> public boolean isInvariant() {
>    return false;
> }
>
> The set method is commented out because setting the value would affect
> other instances of the component. After thinking about it I'm not sure
> this is as complicated as it seems but I'm a bit fuzzy on the details
> of Parameters. I believe they are really conduits so calling the set
> method in the component calls the set method on all variables bound to
> the parameter. In the case of the default value I don't care if the
> set method is called so I just ignore it. The set method is still
> called on all the other values bound to the parameter.
>
> I don't think ThreadLocal would work if there is a thread pool. In
> that case setting the value would affect all subsequent request using
> that thread.
>
> At any rate it does seem to work with the simple test case I wrote. I
> just wonder if it really is this easy or am I breaking something.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Read only bindings - How do I set their value from a mixin?

Posted by Barry Books <tr...@gmail.com>.
The method is isInvariant so returning false means the value can
change. This is confusing and it seems like a double negative to me.

public boolean isInvariant() {
   return false;
}

The set method is commented out because setting the value would affect
other instances of the component. After thinking about it I'm not sure
this is as complicated as it seems but I'm a bit fuzzy on the details
of Parameters. I believe they are really conduits so calling the set
method in the component calls the set method on all variables bound to
the parameter. In the case of the default value I don't care if the
set method is called so I just ignore it. The set method is still
called on all the other values bound to the parameter.

I don't think ThreadLocal would work if there is a thread pool. In
that case setting the value would affect all subsequent request using
that thread.

At any rate it does seem to work with the simple test case I wrote. I
just wonder if it really is this easy or am I breaking something.

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


Re: Read only bindings - How do I set their value from a mixin?

Posted by Lance Java <la...@googlemail.com>.
There are a couple of things wrong with your solution

1. You've implemented a variant binding (isVariant = false) but you have a
no-op implemetation of set(Object value)
This means that the value is 10 in your mixin, but the the value in the
underlying grid component is still 25 (no change)

2. Your binding has a per binding value
I notice you commented out this.value = value in your set(Object value)
method. If you were to uncomment this block of code, you would have major
problems. Bindings are singletons (like pages and components) so they are
shared by all threads in your application.

As I said initially, I think that the value should be backed by a mutable
ThreadLocal.


On 22 March 2013 18:10, Barry Books <tr...@gmail.com> wrote:

> I overrode the SymbolBindingFactory with the attached
> MySymbolBindingFactory and it appears to work, but I'd like a second
> opinion. As I understand it Bindings are cached so my question is will
> making the set method a no op instead of an error cause any problems?
> I created this mixin to test it.
>
> public class GridEnviromentMixin {
>         @BindParameter
>         private Boolean lean;
>
>         @BindParameter
>         private int rowsPerPage;
>
>         @Inject
>         private Environment environment;
>
>         @Inject
>         private Logger logger;
>
>         @Inject
>         private ComponentResources resources;
>
>         @SetupRender
>         void setupRender() {
>                 environment.push(GridEnvironment.class, new
> GridEnvironmentImpl().withLean(lean));
>                 logger.info("rows {}",rowsPerPage);
>                 rowsPerPage= 10;
>                 logger.info("rows {}",rowsPerPage);
>
>         }
>
>         @CleanupRender
>         void cleanupRender() {
>                 environment.pop(GridEnvironment.class);
>         }
>
> }
>
> and the output is this
>
> [INFO] mixins.GridEnviromentMixin rows 25
> [INFO] mixins.GridEnviromentMixin rows 10
>
>
> public class MySymbolBindingFactory implements BindingFactory {
>
>         private final SymbolSource symbolSource;
>         private final Logger logger;
>
>                public MySymbolBindingFactory(SymbolSource symbolSource,
> Logger logger)
>                {
>                    this.symbolSource = symbolSource;
>                    this.logger = logger;
>                }
>
>                public Binding newBinding(String description,
> ComponentResources container,
>                        ComponentResources component, String expression,
> Location location)
>                {
>
>                    String value = symbolSource.valueForSymbol(expression);
>                    logger.info("value {} {}",expression ,value);
>                    return new SymbolBinding(location, description, value);
>                }
>
>                public class SymbolBinding implements Binding {
>                    private Object value;
>
>
>                    public SymbolBinding(Location location, String
> description,
> String value) {
>                            this.value = value;
>                    }
>
>                         @Override
>                         public <T extends Annotation> T
> getAnnotation(Class<T> arg0) {
>                                 return null;
>                         }
>
>                         @Override
>                         public Object get() {
>                                 return value;
>                         }
>
>                         @Override
>                         public Class getBindingType() {
>                                 return value.getClass();
>                         }
>
>                         @Override
>                         public boolean isInvariant() {
>                                 return false;
>                         }
>
>                         @Override
>                         public void set(Object value) {
>                                 //this.value = value;
>                         }
>
>                }
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Read only bindings - How do I set their value from a mixin?

Posted by Barry Books <tr...@gmail.com>.
I overrode the SymbolBindingFactory with the attached
MySymbolBindingFactory and it appears to work, but I'd like a second
opinion. As I understand it Bindings are cached so my question is will
making the set method a no op instead of an error cause any problems?
I created this mixin to test it.

public class GridEnviromentMixin {
	@BindParameter
	private Boolean lean;
	
	@BindParameter
	private int rowsPerPage;
	
	@Inject
	private Environment environment;
	
	@Inject
	private Logger logger;
	
	@Inject
	private ComponentResources resources;
	
	@SetupRender
	void setupRender() {
		environment.push(GridEnvironment.class, new
GridEnvironmentImpl().withLean(lean));
		logger.info("rows {}",rowsPerPage);
		rowsPerPage= 10;
		logger.info("rows {}",rowsPerPage);

	}
	
	@CleanupRender
	void cleanupRender() {
		environment.pop(GridEnvironment.class);
	}

}

and the output is this

[INFO] mixins.GridEnviromentMixin rows 25
[INFO] mixins.GridEnviromentMixin rows 10


public class MySymbolBindingFactory implements BindingFactory {
	
	private final SymbolSource symbolSource;
	private final Logger logger;
	
	       public MySymbolBindingFactory(SymbolSource symbolSource, Logger logger)
	       {
	           this.symbolSource = symbolSource;
	           this.logger = logger;
	       }
	
	       public Binding newBinding(String description,
ComponentResources container,
	               ComponentResources component, String expression,
Location location)
	       {
	
	           String value = symbolSource.valueForSymbol(expression);
	           logger.info("value {} {}",expression ,value);
	           return new SymbolBinding(location, description, value);
	       }
	
	       public class SymbolBinding implements Binding {
	    	   private Object value;
	    	
	    	
	    	   public SymbolBinding(Location location, String description,
String value) {
	    		   this.value = value;
	    	   }

			@Override
			public <T extends Annotation> T getAnnotation(Class<T> arg0) {
				return null;
			}

			@Override
			public Object get() {
				return value;
			}

			@Override
			public Class getBindingType() {
				return value.getClass();
			}

			@Override
			public boolean isInvariant() {
				return false;
			}

			@Override
			public void set(Object value) {
				//this.value = value;
			}
	    	
	       }

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


Re: Read only bindings - How do I set their value from a mixin?

Posted by Barry Books <tr...@gmail.com>.
This has been a source of problems for me also. I'll mess with it
today and report back. I think it should be possible to create a new
binding then change the default from

symbol:SomeSymbol

to

default:symbol:SomeSymbol

would that work for you?

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


Re: Read only bindings - How do I set their value from a mixin?

Posted by Lance Java <la...@googlemail.com>.
Since I'm ultimately trying to apply a mixin to a symbol: binding on the
grid, a new binding won't help me. I'm asking for the core code to be
changed for literal: and symbol: bindings.



--
View this message in context: http://tapestry.1045711.n5.nabble.com/Read-only-bindings-How-do-I-set-their-value-from-a-mixin-tp5720446p5720532.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: Read only bindings - How do I set their value from a mixin?

Posted by trsvax <tr...@gmail.com>.
I think that might work. I would try making a ThreadLocal binding and see
what happens. My plan was to bind them to an environmental so you could
change defaults by pushing a different environmental.



--
View this message in context: http://tapestry.1045711.n5.nabble.com/Read-only-bindings-How-do-I-set-their-value-from-a-mixin-tp5720446p5720520.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: Read only bindings - How do I set their value from a mixin?

Posted by Lance Java <la...@googlemail.com>.
Just bumping this thread again. 

Has anyone given any thought to my idea that literal: and symbol: bindings
could use a ThreadLocal for their value so that a mixin could update the
value?



--
View this message in context: http://tapestry.1045711.n5.nabble.com/Read-only-bindings-How-do-I-set-their-value-from-a-mixin-tp5720446p5720514.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: Read only bindings - How do I set their value from a mixin?

Posted by Lance Java <la...@googlemail.com>.
That would apply to all grids. I want a DisablePaging mixin that I can use on
a case by case basis



--
View this message in context: http://tapestry.1045711.n5.nabble.com/Read-only-bindings-How-do-I-set-their-value-from-a-mixin-tp5720446p5720469.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: Read only bindings - How do I set their value from a mixin?

Posted by Steve Eynon <st...@alienfactory.co.uk>.
Okay, add the following to App Defaults then: (!)

config.add(ComponentParameterConstants.GRID_ROWS_PER_PAGE, Integer.MAX_VALUE);

I usually set the number to 500 or some other large number. Big enough
so you rarely see it, but if you do happen to get 1000s of rows, then
your HTML doesn't bloat to several Mb and clog up the browser
renderer!

Steve.

On 15 March 2013 08:04, Lance Java <la...@googlemail.com> wrote:
> Your suggestion only removes the navigation so I can only assume it would be
> impossible to see the second page of data. I want all the data in a single
> page so that navigation is not required.
>
>
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/Read-only-bindings-How-do-I-set-their-value-from-a-mixin-tp5720446p5720465.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
>

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


Re: Read only bindings - How do I set their value from a mixin?

Posted by Lance Java <la...@googlemail.com>.
Your suggestion only removes the navigation so I can only assume it would be
impossible to see the second page of data. I want all the data in a single
page so that navigation is not required. 



--
View this message in context: http://tapestry.1045711.n5.nabble.com/Read-only-bindings-How-do-I-set-their-value-from-a-mixin-tp5720446p5720465.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: Read only bindings - How do I set their value from a mixin?

Posted by Steve Eynon <st...@alienfactory.co.uk>.
Is there any reason the following doesn't work?

public static void
contributeApplicationDefaults(MappedConfiguration<String, String>
config) {
    config.add(ComponentParameterConstants.GRID_PAGER_POSITION, "NONE");
}

>From GridPagerPosition:

NONE = Don't show a pager (the application will need to supply its own
navigation mechanism).

Steve.


On 15 March 2013 02:17, Lance Java <la...@googlemail.com> wrote:
> I'm actually trying to set the rowsPerPage parameter on a grid to Integer.
> MAX_VALUE to effectively disable paging. It might be controversial but what
> if AbstractBinding wrote to a ThreadLocal?
>

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


Re: Read only bindings - How do I set their value from a mixin?

Posted by Lance Java <la...@googlemail.com>.
I'm actually trying to set the rowsPerPage parameter on a grid to Integer.
MAX_VALUE to effectively disable paging. It might be controversial but what
if AbstractBinding wrote to a ThreadLocal? 



--
View this message in context: http://tapestry.1045711.n5.nabble.com/Read-only-bindings-How-do-I-set-their-value-from-a-mixin-tp5720446p5720460.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: Read only bindings - How do I set their value from a mixin?

Posted by Howard Lewis Ship <hl...@gmail.com>.
With a read-only binding, there is simply no place to put an updated value.

You may need to rethink how your component and mixins interoperate.

Perhaps the component sets a read/write property from a (read-only)
parameter and the mixin is bound to that property, not the parameter itself.

On Wed, Mar 13, 2013 at 8:48 AM, Steve Eynon <steve.eynon@alienfactory.co.uk
> wrote:

> There is no way that I found.  :(
>
>
> On 13 March 2013 16:52, Lance Java <la...@googlemail.com> wrote:
> > In a mixin, I can change the value of a component parameter using
> > @BindParameter to get a mirror of the parameter and then updating the
> > mirrored value.
> >
> > This is fine with the prop: and var: bindings since they are read/write
> > bindings. If I try this with a parameter which is bound to symbol: or
> > literal: the update fails with "Binding %s is read-only" (originating
> from
> > AbstractBinding).
> >
> > Is there any way that I can change a component parameter that is bound to
> > literal: or symbol: from a mixin?
> >
> >
> >
> > --
> > View this message in context:
> http://tapestry.1045711.n5.nabble.com/Read-only-bindings-How-do-I-set-their-value-from-a-mixin-tp5720446.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
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

Re: Read only bindings - How do I set their value from a mixin?

Posted by Steve Eynon <st...@alienfactory.co.uk>.
There is no way that I found.  :(


On 13 March 2013 16:52, Lance Java <la...@googlemail.com> wrote:
> In a mixin, I can change the value of a component parameter using
> @BindParameter to get a mirror of the parameter and then updating the
> mirrored value.
>
> This is fine with the prop: and var: bindings since they are read/write
> bindings. If I try this with a parameter which is bound to symbol: or
> literal: the update fails with "Binding %s is read-only" (originating from
> AbstractBinding).
>
> Is there any way that I can change a component parameter that is bound to
> literal: or symbol: from a mixin?
>
>
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/Read-only-bindings-How-do-I-set-their-value-from-a-mixin-tp5720446.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
>

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


Re: Read only bindings - How do I set their value from a mixin?

Posted by Rusty Phillips <rp...@dtsgis.com>.
On Mar 13, 2013 4:52 AM, "Lance Java" <la...@googlemail.com> wrote:
>
> In a mixin, I can change the value of a component parameter using:..
> @BindParameter to get a mirror of the parameter and then updating the
> mirrored value.
>
> This is fine with the prop: and var: bindings since they are read/write
> bindings. If I try this with a parameter which is bound to symbol: or
> literal: the update fails with "Binding %s is read-only" (originating from
> AbstractBinding).
>
> Is there any way that I can change a component parameter that is bound to
> literal: or symbol: from a mixin?
>
>
>
> --
> View this message in context:
http://tapestry.1045711.n5.nabble.com/Read-only-bindings-How-do-I-setw,-their-value-from-a-mixin-tp5720446.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: Read only bindings - How do I set their value from a mixin?

Posted by Steve Eynon <st...@alienfactory.co.uk>.
Here's the thread where I ran into the problem:

http://tapestry.1045711.n5.nabble.com/How-to-set-the-translate-parameter-tt5719495.html

Luckily, for my use case, I was able to Munky Patch T5.

Steve.

On 16 March 2013 05:25, trsvax <tr...@gmail.com> wrote:
> I ran into this problem also. I think you might be able to create a different
> binding prefix like default: that is writable and change the default to use
> that prefix. This is still on my todo list because I'd like to do the same
> thing.
>
>
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/Read-only-bindings-How-do-I-set-their-value-from-a-mixin-tp5720446p5720486.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
>

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


Re: Read only bindings - How do I set their value from a mixin?

Posted by trsvax <tr...@gmail.com>.
I ran into this problem also. I think you might be able to create a different
binding prefix like default: that is writable and change the default to use
that prefix. This is still on my todo list because I'd like to do the same
thing. 



--
View this message in context: http://tapestry.1045711.n5.nabble.com/Read-only-bindings-How-do-I-set-their-value-from-a-mixin-tp5720446p5720486.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