Re: URL coding strategies

2010-03-18 Thread bgooren

You cannot have a seo-friendly url _and_ pass objects. If you want to pass an
object to another page (say a Product), then you need to create a
constructor on the target page which accepts a Product or an
IModel. You can then call setResponsePage( new TargetPage( product
) ); The upside is that you only query the database once for the product,
but the url is not seo-friendly.


vp143 wrote:
> 
> Hi there, I have a question about URL coding strategies
> 
>  
> 
> I have decided to use IndexedParamUrlCodingStrategy for friendly URL's.
> 
>  
> 
> I have set PageParameters for this strategy in the following way:
> 
>  
> 
> PageParameters pageParameters = new PageParameters();
> 
> pageParameters.add("0", categoryName);
> 
> pageParameters.add("1", productName);
> 
>  
> 
> I have then created a Bookmarkable link like the following:
> 
> Link viewItem = new BookmarkablePageLink("viewItem", ProductInfo.class,
> pageParameters);
> 
>  
> 
> What I really want to do is pass the Product object to the ProductInfo
> class
> without it being visible in the URL. 
> 
> I would rather not have to query the database for data object that I
> already
> have.
> 
> How can this be achieved?
> 
>  
> 
> Many thanks in advance.
> 
>  
> 
> Regards
> 
> Vishal
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/URL-coding-strategies-tp27939290p27944464.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: How to encrypt/obfuscate resource reference?

2010-03-02 Thread bgooren

Good to know I contributed something useful to this thread haha.

The code looks like the stuff I had in mind.

You gotta love Wicket for making it quite easy to do this stuff; Although
the URL encoding/decoding can be quite complex for beginners, but that is
likely to be fixed in the future (I've had a look at Matej's wicket-ng
implementation, and it looks very promising).


Sergey Olefir wrote:
> 
> 
> Thanks to your idea, I played around with WebRequestCodingStrategy and
> below is what I came up with.
> 
> It uses jasypt, but feel free to replace it with whatever you like more.
> 

-- 
View this message in context: 
http://old.nabble.com/How-to-encrypt-obfuscate-resource-reference--tp27744679p27757852.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Ajax File Upload (Safari and Chrome)?

2010-03-02 Thread bgooren

Just perform a google search for WICKET-2657 in that case, or copy the
following link http://issues.apache.org/jira/browse/WICKET-2657


Pierre Goupil wrote:
> 
> The link is broken, unfortunately: "The project you are trying to view
> does
> not exist. Try browsing <http://issues.apache.org/jira/browse> for
> projects.
> "
> 
> Regards,
> 
> Pierre
> 
> 
> 
> On Tue, Mar 2, 2010 at 1:27 PM, bgooren  wrote:
> 
>>
>> Possibly this is related to
>> http://issues.apache.org/jira/browse/WICKET-2657
>> WICKET-2657<http://issues.apache.org/jira/browse/WICKET-2657%0AWICKET-2657>?
>> That bug only mentions Chrome though, so it is unclear if it also occurs
>> on
>> Safari.
>>
>> Did you check if AjaxButton.onSubmit() gets called to isolate the problem
>> area (server vs client)?
>>
>>
>> Corbin, James-2 wrote:
>> >
>> > Are there any known issues with the FileUploadField when submitting via
>> > Ajax on Safari 4.x or Chrome 5.x?
>> >
>> > In the AjaxButton.onSubmit(), I am attempting to update other
>> components
>> > and it doesn't seem to repaint the component(s) in Safari or Chrome,
>> but
>> > does work as I expect in Firefox 3.x.
>> >
>> > J.D.
>> >
>> >
>>
>> --
>> View this message in context:
>> http://old.nabble.com/Ajax-File-Upload-%28Safari-and-Chrome%29--tp27748810p27755256.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
> 
> 
> -- 
> Les deux règles universelles du bide :
> 
> 1) on n'explique pas un bide
> 
> 2) dans le futur, un bide sera toujours un bide.
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Ajax-File-Upload-%28Safari-and-Chrome%29--tp27748810p27755431.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Ajax File Upload (Safari and Chrome)?

2010-03-02 Thread bgooren

Possibly this is related to  http://issues.apache.org/jira/browse/WICKET-2657
WICKET-2657 ?
That bug only mentions Chrome though, so it is unclear if it also occurs on
Safari.

Did you check if AjaxButton.onSubmit() gets called to isolate the problem
area (server vs client)?


Corbin, James-2 wrote:
> 
> Are there any known issues with the FileUploadField when submitting via
> Ajax on Safari 4.x or Chrome 5.x?
> 
> In the AjaxButton.onSubmit(), I am attempting to update other components
> and it doesn't seem to repaint the component(s) in Safari or Chrome, but
> does work as I expect in Firefox 3.x.
> 
> J.D.
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Ajax-File-Upload-%28Safari-and-Chrome%29--tp27748810p27755256.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: How to encrypt/obfuscate resource reference?

2010-03-02 Thread bgooren

Ok, scratch that comment too...

I see Antoine dug up an old thread of yours where you already found out
about the possibility to override WebRequestCodingStrategy.

I also see that Antoine created WICKET-2731 and that it has been closed as
resolved/fixed, so there should be some hooks available in wicket 1.4.7
(which is to be release shortly according to the dev mailing list).


Sergey Olefir wrote:
> 
> As I briefly mentioned before, class aliases are, IMO, a terribly
> unreliable thing to maintain. Every time someone comes up with new
> component that uses resource reference they must not forget to go and
> register the alias for it. 
> 
> I'm predicting a 100% probability that soon enough someone will forget it
> and it'll go into production -- thus defeating the entire purpose behind
> the encryption/obfuscation :)
> 
> And to comment on what Antoine is saying -- I'm not entirely sure what did
> you mean, but if I tried to implement encryption at
> CryptedUrlWebRequestCodingStrategy, I will have to ensure that encrypted
> URL will have format that will be fully parseable after browser appends
> relative CSS URL to it. This is manageable by, say, encrypting only the
> section of the path containing the class name. But then I'm completely
> unsure as to how properly decode it / fake request for Wicket. The
> existing code only 'fakes' parameters string -- but there are API methods
> that deal with request path as well, and if those are not correct, I'm not
> sure what issues that may cause.
> 
> Bottom line -- it must be possible to do encryption at
> CryptedUrlWebRequestCodingStrategy, but it will take some serious digging
> to make sure all parts fit correctly. It would be far easier to e.g.
> automatically add alias in SharedResources method that deals with
> assigning the name to shared resource -- the only thing it'll require is
> to modify Application class so that e.g. getSharedResources() is not
> final.
> 
> But I'm still hoping for some 'easy' solution that doesn't entail
> modifying Wicket source code to avoid headaches when upgrading.
> 
> 
> 
> bgooren wrote:
>> 
>> The easiest way around this is to specify 
>> http://wicket.apache.org/docs/1.4/org/apache/wicket/SharedResources.html#putClassAlias(java.lang.Class,
>> java.lang.String) class aliases .
>> 
>> The upside is that you control the generated URL, the downside is that
>> you have to make sure the alias is unique.
>> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/How-to-encrypt-obfuscate-resource-reference--tp27744679p27754749.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: How to encrypt/obfuscate resource reference?

2010-03-02 Thread bgooren

Sorry, I overlooked that part of your original post.

I've been toying with the same idea, since class aliases are bound to cause
problems as projects grow bigger. As long as the aliases are user-generated,
they might not be unique.

So I had a quick look at the source code of WebRequestCodingStrategy, and I
think it should be possible to create a solution for your problem quite
easily:

1) subclass WebRequestCodingStrategy, and use it by overriding
newRequestCycleProcessor() in your application, and return a subclasses
WebRequestCycleProcessor which returns your custom WebRequestCodingStrategy
in the call to newRequestCodingStrategy(). Quickest solution is to create an
anonymous inner class for the custom WebRequestCycleProcessor
2) override the 
http://wicket.apache.org/docs/1.4/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.html#encode(org.apache.wicket.RequestCycle,
org.apache.wicket.request.target.resource.ISharedResourceRequestTarget)
encode  method which deals with shared resources, and implement "encryption"
(or simply an obfuscated, stable alias for classes)
3) override 
http://wicket.apache.org/docs/1.4/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.html#addResourceParameters(org.apache.wicket.Request,
org.apache.wicket.request.RequestParameters) addResourceParameters()  and
implement "decryption"



Sergey Olefir wrote:
> 
> As I briefly mentioned before, class aliases are, IMO, a terribly
> unreliable thing to maintain. Every time someone comes up with new
> component that uses resource reference they must not forget to go and
> register the alias for it. 
> 
> I'm predicting a 100% probability that soon enough someone will forget it
> and it'll go into production -- thus defeating the entire purpose behind
> the encryption/obfuscation :)
> 
> And to comment on what Antoine is saying -- I'm not entirely sure what did
> you mean, but if I tried to implement encryption at
> CryptedUrlWebRequestCodingStrategy, I will have to ensure that encrypted
> URL will have format that will be fully parseable after browser appends
> relative CSS URL to it. This is manageable by, say, encrypting only the
> section of the path containing the class name. But then I'm completely
> unsure as to how properly decode it / fake request for Wicket. The
> existing code only 'fakes' parameters string -- but there are API methods
> that deal with request path as well, and if those are not correct, I'm not
> sure what issues that may cause.
> 
> Bottom line -- it must be possible to do encryption at
> CryptedUrlWebRequestCodingStrategy, but it will take some serious digging
> to make sure all parts fit correctly. It would be far easier to e.g.
> automatically add alias in SharedResources method that deals with
> assigning the name to shared resource -- the only thing it'll require is
> to modify Application class so that e.g. getSharedResources() is not
> final.
> 
> But I'm still hoping for some 'easy' solution that doesn't entail
> modifying Wicket source code to avoid headaches when upgrading.
> 
> 
> 
> bgooren wrote:
>> 
>> The easiest way around this is to specify 
>> http://wicket.apache.org/docs/1.4/org/apache/wicket/SharedResources.html#putClassAlias(java.lang.Class,
>> java.lang.String) class aliases .
>> 
>> The upside is that you control the generated URL, the downside is that
>> you have to make sure the alias is unique.
>> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/How-to-encrypt-obfuscate-resource-reference--tp27744679p27754615.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: How to encrypt/obfuscate resource reference?

2010-03-01 Thread bgooren

The easiest way around this is to specify 
http://wicket.apache.org/docs/1.4/org/apache/wicket/SharedResources.html#putClassAlias(java.lang.Class,
java.lang.String) class aliases .

The upside is that you control the generated URL, the downside is that you
have to make sure the alias is unique.
 

Sergey Olefir wrote:
> 
> Hi,
> 
> out of the box Wicket generates urls for packaged resources that
> contain fully-qualified class names, e.g.:
>  href="resources/org.example.MyClassName/decorations/style.css" />
> 
> Now in accordance with our security policies we are not allowed to
> expose internal application details -- and fully qualified class name
> certainly fits that category.

-- 
View this message in context: 
http://old.nabble.com/How-to-encrypt-obfuscate-resource-reference--tp27744679p27748507.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: W.: serializable problem

2010-02-26 Thread bgooren

It looks like you are serializing the MySQL connection. You should not keep
it around in the session, but rather create a connection when you need it,
or use a connection pool.


exceptionist wrote:
> 
> hello,
> i´ve got a problem with serialization.
> 
> my application is connected to a mysql-db and every class of mine
> implements serializable.
> but still there are exceptions telling me that java.lang.Object isn´t
> serializable...
> 
> 
> 
>> org.apache.wicket.util.io.SerializableChecker$WicketNotSerializableException:
>> Unable to serialize class: java.lang.Object
>> 
>> private java.util.Map com.mysql.jdbc.ConnectionImpl.charsetConverterMap
>> [class=java.util.HashMap]
>> private java.util.Map
>> com.mysql.jdbc.ConnectionImpl.charsetConverterMap[write:1][write:2]
>> [class=java.lang.Object] <- field that is not serializable
>> 
> 
> is there a possibility to deactivate serialization?
> or how shall i solve this problem?
> 
> kind regards ans many thanks to those who can help me out of the
> serialization-jungle (never serialized anything before and i am relatively
> new to wicket with my very first real wicket-project)
> 
> 
> 
> 
> Tolle Dekolletés oder scharfe Tatoos? Vote jetzt ... oder mach selbst mit
> und zeige Deine Schokoladenseite
> bei Topp oder Hopp von Arcor: http://www.arcor.de/rd/footer.toh
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/W.%3A-serializable-problem-tp27715846p27716936.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Model to use for static Label text

2010-02-22 Thread bgooren

Well, a couple of strings more or less usually don't make that much of a
difference. I personally prefer to save some typing and have better
readability then to save a few bytes here and there.

Furthermore, if you were to create an implementation of IModel specifically
for this case, you would always need to store the string as an instance
variable, thus creating the "problem" you are trying to solve.


Serban Balamaci wrote:
> 
> Hello.
> I've always used
> add(new Label("alabel", new Model("A message")); - does this not save the
> "A message" string in the page store?
> Is it not better to do add(new Label("alabel", new
> LoadableDetachableModel() {
> 
> @Override
> protected String load() {
> return "A message";
> }
> })); - while this option does not save it in the page store.
> Is it because of the coding amount that nobody is using this? I guess not
> because we could extend IModel and create a "label model" with a string
> property that is cleared on detach.
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Model-to-use-for-static-Label-text-tp27695054p27695195.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Adding components to page (dynamically)

2009-12-22 Thread bgooren

Ok, so when you say "I need to add more than 1 window", do you mean that the
type of window can differ, or that you want to add multiple windows at once?

In the first case (1 window), you could go for:
final WebMarkupContainer hook = new WebMarkupContainer("win1");
hook.setOutputMarkupId( true );
hook.setOutputMarkupPlaceholderTag( true );
m.add( hook );
and then in onClick( AjaxRequestTarget ) you call m.addOrReplace( window )
and add the window to the AjaxRequestTarget;

In the latter case (multiple windows), you could go for a RepeatingView;
you'll need to put it in a WebMarkupContainer with setOutputMarkupId to true
since you cannot refresh a RepeatingView itself through AJAX. You can (re-)
populate the RepeatingView manually in the onClick( AjaxRequestHandler )
method and add it so it get's re-rendered.


marioosh.net wrote:
> 
> 
> bgooren wrote:
>> 
>> Well, you need to have some html in the container with wicket:id="win1"
>> for your code to work. Wicket is (correctly) complaining that it cannot
>> locate html for your component. What kind of component is Window? (it's
>> not a standard wicket component)
>> 
> 
> Window is simple:
> 
> public class Window extends Panel {
> ...
> }
> 
>  xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd";>
>   ...
> 
> 
> When i add containser with wicket:id="win1" to template, i need to add
> component too, but i need add component after click button. And i need to
> add more then one window.
> 

-- 
View this message in context: 
http://old.nabble.com/Adding-components-to-page-%28dynamically%29-tp26886670p26889863.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Adding components to page (dynamically)

2009-12-22 Thread bgooren

Well, you need to have some html in the container with wicket:id="win1" for
your code to work. Wicket is (correctly) complaining that it cannot locate
html for your component. What kind of component is Window? (it's not a
standard wicket component)


marioosh.net wrote:
> 
> 
> 
> marioosh.net wrote:
>> 
>> I have a Window component (Panel subclass) and button to dynamic
>> adding new Window to Base page,
>> but when i click this button (AjaxLink) i get error:
>> 
>> WicketMessage: Unable to find the markup for the component. That may
>> be due to transparent containers or components implementing
>> IComponentResolver: [MarkupContainer [Component id = win1]]
>> 
>> Base.html:
>> 
>>   # new 
>> 
>> 
>> Base.java:
>> public class Base extends WebPage {
>>  public Base() {
>>  
>>  add(new AjaxLink("new"){
>>  @Override
>>  public void onClick(AjaxRequestTarget target) {
>>  Window win = new Window("win1","title");
>>  win.setOutputMarkupId(true);
>>  add(win);
>>  target.addComponent(win); // ajax refresh
>>  }
>>  });
>>  }
>> }
>> 
>> -- 
>> Greetings,
>> marioosh
>> 
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>> 
>> 
>> 
> 
> 
> I changed my code, but now i get error:
> WicketMessage: The component(s) below failed to render. A common problem
> is that you have added a component in code but forgot to reference it in
> the markup (thus the component will never be rendered).
> 
> 1. [MarkupContainer [Component id = win1]]
> ...
> 
> Base.java:
> public class Base extends WebPage {
>   public Base() {
> 
>   final WebMarkupContainer m = new 
> WebMarkupContainer("container");   
>   m.setOutputMarkupId(true);
>   add(m);
>   add(new AjaxLink("new"){
>   @Override
>   public void onClick(AjaxRequestTarget target) {
>   Window win = new Window("win1","...");
>   m.add(win);
>   target.addComponent(m);
>   }
>   });
>   }
> }
> 
> Base.html:
> 
># new 
>  
> 
> 
> Anybody help with that ?
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Adding-components-to-page-%28dynamically%29-tp26886670p26888242.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Remote Image Generation Null Pointer

2009-12-05 Thread bgooren

If you want to generate the URL yourself and want to keep using the code you
have already written, use a WebComponent instead of an Image:

WebComponent dynamicImage = new WebComponent("image");
dynamicImage.add(new AttributeModifier("src", true, new
AbstractReadOnlyModel() {} ) );

Otherwise, as suggested by the previous reply, look into
DynamicImageResource.


bassglider wrote:
> 
> Hi Everyone,
> 
> I am attempting to load an image that takes some time.  I can load a
> remote image using the URL, but when it takes time to gather the data
> and then get the url, I get this:
> 
> [java] 11174 [btpool0-1] ERROR org.apache.wicket.RequestCycle -
> Exception in rendering component: [Component id = image]
> [java] org.apache.wicket.WicketRuntimeException: Exception in
> rendering component: [Component id = image]
> [java] at
> org.apache.wicket.Component.renderComponent(Component.java:2656)
> [java] at
> org.apache.wicket.markup.html.WebComponent.onRender(WebComponent.java:62)
> [java] at org.apache.wicket.Component.render(Component.java:2448)
> 
> 
> I read that it could be from the thread expiring or the page trying to
> modify itself after it is rendered(?)
> 
> So I tried adding this to my Application
> 
>  @Override
>  protected void init() {
>super.init();
> 
>//remove thread monitoring from resource watcher
>this.getResourceSettings().setResourcePollFrequency(null);
>  }
> 
> 
> It had no effect on the issue.  Any suggestions or remedies would be
> greatly appreciated.
> 
> Here is the code I am using:
> 
> 
>  Image dynamicImage = new Image("image");
>dynamicImage.add(new AttributeModifier("src", true, new
> AbstractReadOnlyModel() {
> 
>  private static final long serialVersionUID = 1L;
> 
>  /**
>   * {...@inheritdoc}
>   */
>  @Override
>  public final Object getObject() {
>GoogleChart chart = new GoogleChart("http://xx:/x/";);
>String url = chart.getChart ("value", "2009-11-15"," 2009-11-15",
>"", "july", true, false );
>System.out.println("GETCHART URL: " + url);
>//String url = "http://xx/PleaseStandBy.jpg";;
>return url;
>  }
>}));
>dynamicImage.setOutputMarkupId(true);
>add(dynamicImage);
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Remote-Image-Generation-Null-Pointer-tp26653612p26655670.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: How to return specific HTTP result code on HTTP request

2009-12-05 Thread bgooren

See http://cwiki.apache.org/WICKET/error-pages-and-feedback-messages.html

In particular (in your webpage):

@Override
protected void configureResponse() {
super.configureResponse();

getWebRequestCycle().getWebResponse().getHttpServletResponse().setStatus(HttpServletResponse.SC_NOT_FOUND);
}

Where you can send other codes than SC_NOT_FOUND, obviously.

Bas

Petr Fejfar-2 wrote:
> 
> Hi all,
> 
> I'm not able to find-out how to respond on HTTP request
> (via mounted URL) by setting HTTP result code
> to specific value e.g. 402 (Payment required) etc...
> 
> Pls, could somebody push me forward?
> 
> 
> Thx, pf
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/How-to-return-specific-HTTP-result-code-on-HTTP-request-tp26653425p26655615.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Modal Window Problems On Internet Explorer.

2009-11-30 Thread bgooren

I don't have this problem with the Modal Window, so my guess is that you have
some custom javascript which tries to set the focus to an element which is
either invisible or inactive.

Bas


carlo c wrote:
> 
> Hi,
> 
> I keep on experiencing this when I try to open a modal window in IE6, 7
> and 8.
> 
> 
> I don't know if any of you encountered it from before.
> 
> "Can't move focus to the control because it is invisible, not enabled,
> or of a type that does not accept the focus"
> 
> 
> It's happeningd on Internet Explorer only and it's quite annoying.
> 
> Thanks A Lot
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Modal-Window-Problems-On-Internet-Explorer.-tp26572367p26572872.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wizard and confirmation screens

2009-11-30 Thread bgooren

Sounds like you are using static models instead of dynamic models.

E.g. if you use Model.of("test"), the model is essentialy self-contained.
Whereas if you have a property called "value" in your wizard and you use 
new PropertyModel( Wizard.this, "value" )
, the model will depend on the value of the "value" property.

Bas


John Armstrong-3 wrote:
> 
> It may just be late and I am missing the obvious but..
> 
> I have a wizard. The last step needs to be a confirmation step however
> it is constructed when added to the WizardModel in the Wizard
> constructor and at this stage all of the backing models are empty
> since, well, the user hasn't done anything.
> 
> This means when I access models on the confirmation step all of the
> model data is empty (it was built by wicket earlier in the process).
> 
> What am I missing? This is a common use pattern so I am doing
> something wrong since obviously the form has the data as back/forth
> show it just fine. The only work-around I can think of is to not add
> this step and then insert this step at the end myself (once the
> objects are populated). Seems hacky though.
> 
> Tx
> John-
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Wizard-and-confirmation-screens-tp26570806p26572871.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: WicketSessionFilter and several domains

2009-11-28 Thread bgooren

Well, even if it's regional the question remains why your site is available
over two domainnames. You can solve your problem by running the site on one
of the domains and issuing a 301 redirect from the other domainname to the
main domain. Or did I misunderstand, and are you running the site from the
.com.ar and only the flash part from the .com?

Bas


Fernando Wermus-2 wrote:
> 
> Bas,
>  The site is regional. It is for LATAM. I will try to append the
> session
> id to the flash post.
> 
> thanks
> 
> On Fri, Nov 27, 2009 at 1:17 PM, bgooren  wrote:
> 
>>
>> There are serveral options; The easiest is probably to append the
>> sessionId
>> to the URL you are accessing from the flash file; If that is not an
>> option,
>> host both the flash and the website on the same domain. Cross-domain
>> issues
>> are a hassle ;-)
>>
>> What's your reason for working with two domain names anyway?
>>
>> Bas
>>
>>
>> Fernando Wermus-2 wrote:
>> >
>> > Bas,
>> > Thanks. I havent checked this behavior with other browsers. I will.
>> > What
>> > do you think is the best solution or approach to this problem?
>> >
>> > Fernando
>>
>> --
>> View this message in context:
>> http://old.nabble.com/WicketSessionFilter-and-several-domains-tp26502429p26543760.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
> 
> 
> -- 
> Fernando Wermus.
> 
> www.linkedin.com/in/fernandowermus
> 
> 

-- 
View this message in context: 
http://old.nabble.com/WicketSessionFilter-and-several-domains-tp26502429p26547249.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: WicketSessionFilter and several domains

2009-11-27 Thread bgooren

There are serveral options; The easiest is probably to append the sessionId
to the URL you are accessing from the flash file; If that is not an option,
host both the flash and the website on the same domain. Cross-domain issues
are a hassle ;-)

What's your reason for working with two domain names anyway?

Bas


Fernando Wermus-2 wrote:
> 
> Bas,
> Thanks. I havent checked this behavior with other browsers. I will.
> What
> do you think is the best solution or approach to this problem?
> 
> Fernando

-- 
View this message in context: 
http://old.nabble.com/WicketSessionFilter-and-several-domains-tp26502429p26543760.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: WicketSessionFilter and several domains

2009-11-27 Thread bgooren

Given your detailed explanation, I think the problem is clear: your browser
(and thus the flash client as well) is protected so it can only use cookies
_for the same domain_. So if you load a flash movie from .com.ar and have it
connect to a .com, it will not use the cookie(s) it got from the .com.ar;

So what you are seeing is expected behavior.

Bas

Fernando Wermus-2 wrote:
> 
> Bas,
> 
>   I will try to explain what it is going on with this scenario (anyway
> I
> think you understood).
> 
> 1. an user logs in the site using .com.ar
> 2. the user gets a flex component in the site's page. The flex component
> is
> compiled to point to .com services.
> 3. the flex component asks a specific service to the back-end which
> consults
> if this user has a wicket session, it fails.
> 
> The user has never change the tab which is using.
> 
> He has a cookie because he is accessing to the site using the same tab.
> Thus, it shouldnt have been any problem.
> 
> On the another hand, I have set up the server with two dns manager, one
> for
> each domain.
> 
> ---
> | a page (from .com.ar)  |
> |  |
> | --   |
> ||  a flex component | |
> ||  (connects .com)  | |
> ---
> 
> MessageBrokerServlet, flex component back end, which needs
> wicketSessionFilter to verify user authentication.
> WicketSessionServletFilter which "injects" the session into
> MessageBrokerServlet.
> WicketFilter.
> 
> flex client   ---> MessageBrokerServlet through .com
> the page> WicketFilter through .com.ar
> 
> I know the cookie should be the same because they are in the same tab, but
> it is also truth that they connect using differents domains.
> 
> The message log4j sends to me it is clear. It couldnt reach the session.
> 
> Thanks anyway.

-- 
View this message in context: 
http://old.nabble.com/WicketSessionFilter-and-several-domains-tp26502429p26539906.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: WicketSessionFilter and several domains

2009-11-26 Thread bgooren

Did you check if a session is actually created, e.g. do you see a cookie?

I cannot imagine that if you use the exact same flow, and the only
difference is the domain name, it would work in the one case but not the
other.
What happens exactly? Getting the session returns null?

I suggest you try a debugger for finding out what's happening inside the
WicketSessionFilter.


Fernando Wermus-2 wrote:
> 
> Bas,
>  What I actually did was to login in .com and test the servlet I
> mentioned you. Then I logged out and logged in the site using .com.ar
> again.
> This second time failed. In this case, it seems that I am  using different
> cookies and it shouldn't to affect if I get the session.
> 
> To be more specific,
> 
> I have some embeded flex clients which connects to Blazeds. I need to get
> wicket session to know who has logged in using wicket front end. Each flex
> client has been compiled using a specific url from the site. The servlet
> that is in charge is messageBroker that delegates to a class of my own the
> service called.There it is where I couldnt get the session when the user
> logged in to a specific domain.
> 
> Thanks in advance.
> 

-- 
View this message in context: 
http://old.nabble.com/WicketSessionFilter-and-several-domains-tp26502429p26526474.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



RE: onclick auto-added to

2009-11-26 Thread bgooren

Well, I don't use Spring integration in my projects, so I cannot tell you for
sure if that could be the reason for this. I do however find it unlikely
that Spring integration would alter html tags.

What you could try is step through the rendering process with a debugger and
see what's happening with the  tag. See AutoLinkResolver and
WicketLinkTagHandler.
Which version of Wicket are you running?


Loritsch, Berin C. wrote:
> 
> I'm integrated with Spring/Hibernate, could this be a side effect from
> the SpringInvocationHandler?  I've not added anything of the sort
> directly (i.e. I have not created any ComponentInstantiationListeners
> myself).
> 
> I've removed the  blocks for now in my header and things
> are working as expected.  That rules out a browser plugin being at
> fault.

-- 
View this message in context: 
http://old.nabble.com/onclick-auto-added-to-%3Cscript%3E-tags--tp26504274p26526076.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: onclick auto-added to

2009-11-25 Thread bgooren

I'm using  blocks around javascript references as well and have
never observed the behavior you describe. Do you auto-add a behavior to
components which adds the onclick value? It's being added from somewhere,
and is not default Wicket behavior. So it's either a browser plugin or an
IBehavior added from, say, a ComponentInstantiationListener.

Bas


Loritsch, Berin C. wrote:
> 
> I have my HTML header links for CSS and JavaScript surrounded in a
>  block so that it can resolve the context name, etc.
> Problem is that it causes unexpected and peculiar behavior:
> 
> 
> 
> Becomes
> 
>  onclick="window.location.href='script/prototype.js';return
> false;">
> 
> Which is invalid markup, much less causing errors for me.  How do I get
> rid of the onclick attribute?
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/onclick-auto-added-to-%3Cscript%3E-tags--tp26504274p26511542.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: WicketSessionFilter and several domains

2009-11-25 Thread bgooren

If you are using session cookies, the answer is simple: your browser only
sends the cookie for the domain from which it was set. Simply put: if a
cookie gets set from the .com, it is not available on the .com.ar

Bas


Fernando Wermus-2 wrote:
> 
> Hi all,
> I have several domain for a site: .com and a .com.ar. I got to get the
> session in a servlet using WicketSessionFilter for .com domain, but I
> failed
> in the another case. How come?
> 
> thanks in advance.
> 
> -- 
> Fernando Wermus.
> 
> www.linkedin.com/in/fernandowermus
> 
> 

-- 
View this message in context: 
http://old.nabble.com/WicketSessionFilter-and-several-domains-tp26502429p26511240.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: AjaxFallBackLink driving me nuts!

2009-11-17 Thread bgooren

For starters, I'd try to eliminate possible causes. E.g. make sure the model
change is seen from QuestionEditPanel. A way to do this is either run your
app in a debugger and set some checkpoints around onRender and/or
onBeforeRender, or simply override onBeforeRender() and log the model
contents.

Since we don't see what kind of model your templatewebmodel is, it could
also be that this class is caching its value.

Bas


Pieter Claassen wrote:
> 
> Can anybody please enlighten me why this doesn't work (ok end of the day,
> maybe it really is something small). I am clearly changing the underlying
> model data, but how to tell questionEditPanel to pick that change up. I
> tried setDefaultModel(new TemplateWebModel(template)),
> templateEditPanel.modelChanged() and nothing works.  Any tips appreciated.

-- 
View this message in context: 
http://old.nabble.com/AjaxFallBackLink-driving-me-nuts%21-tp26393621p26396450.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: AjaxLink and component visibility

2009-11-15 Thread bgooren

Hi,

The answer to your question is simple: component replacement over ajax needs
to be able to "find" the old component so it can be replaced with new
content. Since you set panel B to be invisible, it simply is not in the
page, and therefore cannot be replaced.

Simple solution: if you want to replace an invisible component through AJAX,
use 
http://wicket.apache.org/docs/1.4/org/apache/wicket/Component.html#setOutputMarkupPlaceholderTag(boolean)
Component#setOutputMarkupPlaceholderTag . This will output an HTML tag which
can be replaced by an AJAX call.

Ofcourse you should also call setOutputMarkupId(true) so wicket generates an
id with which it can locate the placeholder.

Bas


Ed_ wrote:
> 
> 
> Trying to build a shopping cart - Panel B . Which is hidden till an item
> is selected. Items are stored in the session.
> 
> I am trying to get  (shipping cart )Panel B to show up when I click an
> Ajax link, viz in Panel C
> 
> 
> Both the Panels are under a parent panel A.
> 
> 
> When I fist get to the page Panel B is hidden - I am using
> B.setVisibility(false).
> 
> When I click the link in Panel C. I am construction a new PanelB and call
> a method in panelA to replace the oldB with the newB
> 
> method on PanelA.updateShopping cart(){
>  oldB.replaceWith(newB)
> newB.setVisibility(true);
> }
> I can't get B to show up unless I do a page reload. 
> 
> Once B is on the page though clicking the links in Panel C - keeps
> updating it just fine.
> 
> 
> Ideas on what I am messing up in getting the shopping cart to show up for
> the first item to be added, I want to avoid a page reload when the first
> item is added and stick with the ajax behavoir.
> 
> thx!
> 
> 
> 
> _
> Bing brings you maps, menus, and reviews organized in one place.
> http://www.bing.com/search?q=restaurants&form=MFESRP&publ=WLHMTAG&crea=TEXT_MFESRP_Local_MapsMenu_Resturants_1x1
> 

-- 
View this message in context: 
http://old.nabble.com/AjaxLink-and-component-visibility-tp26365175p26365902.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: setResponsePage chaining

2009-10-28 Thread bgooren

Well, new P2() is executed _before_ it's result (a P2 instance) is passed to
setResponsePage(), so this behavior is perfectly normal: setResponsePage(
new P3() ) is executed before the resulting P2 instance is passed to
setResponsePage().

Timeline:
1. new P2() is executed
2. P2 constructor is called, which calls setResponsePage( new P3() )
3. P2 constructor returns a P2 instance, which is used as input in the first
setResponsePage() call

As you can see, the final call to setResponsePage() wins, P2 in this case

The reason that setResponsePage( P2.class ) does result in P3 being rendered
is also logical: it results in wicket instantiating P2.class _after_
setResponsePage( P2.class ) is called.

Timeline:

1. setResponsePage( P2.class )
2. wicket calls the P2 constructor, which calls setResponsePage( new P3() )

As you can see, in this case the final call to setResponsePage() is in the
P2 constructor, so it "wins".

By throwing a RestartResponseException, setResponsePage( [P2 class instance]
) is never executed, since the exception breaks out of the code.

Bas


Ryan-117 wrote:
> 
> Throwing RestartResponseException works as expected, but I'm still not
> sure if the setResponsePage behavior is correct...
> 
> On Wed, Oct 28, 2009 at 11:52:09AM -0600, Ryan exclaimed:
> 
>>If you have a page,P1, with a form which has an onSubmit() that calls
>>setResponsePage(new P2()) and the constructor in P2 calls
>>setResponsePage(new P3()) the page that is rendered is P2.
>>
>>However, P3 is rendered if the onSubmit calls setResponsePage(P2.class)
>>and the P2 constructor calls setResponsePage(P3.class).
>>
>>Is this a bug or am I missing something?
>>
>>Thanks,
>>Ryan
>>
>>-
>>To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>For additional commands, e-mail: users-h...@wicket.apache.org
>>
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/setResponsePage-chaining-tp26099119p26104397.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: [tinymce] problem adding/removing TinyMceBehavior dinamically

2009-10-12 Thread bgooren

Daniele,

So why don't you collect a list of markup-ids serverside, perform a TinyMCE
unload through AjaxRequestTarget.prepentJavascript(), and then have it
redraw the list and load TinyMCE in appendJavascript()?

Another alternative would be to manually add the component trough
javascript, see:
http://wicketinaction.com/2008/10/repainting-only-newly-created-repeater-items-via-ajax/;
This way you do not need to refresh all items in the listview

Hope this helps, TinyMCE + AJAX is interesting to say the least.


Daniele Dellafiore wrote:
> 
> yep I do that. Actually, I wrote that article :)
> 
> My problem is more subtle here and I have discovered now that is
> related to javascript execution order. In fact I open a new thread to
> investigate that specific issue. I also try to produce a ExamplePage
> to commit on tinymce example project.
> 
> On Fri, Oct 9, 2009 at 7:47 PM, Dane Laverty 
> wrote:
>> Did you get the
>> response.renderJavascriptReference(TinyMCESettings.javaScriptReference());
>> ?
>>
>> In my code it goes like this (as per
>> http://wicketbyexample.com/wicket-tinymce-some-advanced-tips/):
>>
>> add(new HeaderContributor(new IHeaderContributor() {
>>             public void renderHead(IHeaderResponse response) {
>>
>> response.renderJavascriptReference(TinyMCESettings.javaScriptReference());
>>             }
>>        }));
>>
>> Dane
>>
>> On Fri, Oct 9, 2009 at 10:17 AM, Daniele Dellafiore
>> wrote:
>>
>>> I start from the end: I need fine control over the order javascript is
>>> executed. What is the javascript to call a refresh on a component like
>>> is done when I use target.addComponent()?
>>>
>>>
>>> From the start.
>>> I make that work with bgooren suggestion, using the javascript to
>>> remove the editor. No need to remove the behavior on java side. That
>>> works for the checkbox that dynamically adds and removes the Rich
>>> Editor.
>>>
>>> Now, the problem on refreshing a list of fields.
>>> What happens: to add a new field, click on ADD and I add my ListView
>>> is added to be refreshed via a target.addComponent(). In doing this,
>>> the markupId of the component changes, so tinyMce lose reference to
>>> it's existing editors.
>>>
>>> My solution: on the ADD callback, I remove the editors and let them be
>>> re-added during repainting. Works? NO!
>>> Why? because the listView is repainted before the mceControlRemove is
>>> executed, even if they are added to the same AjaxRequestTarget in the
>>> ADD callback. So happens that:
>>> 1.  the remove fails because the old component is found no more
>>> 2. after, the submit fails because tinyMCE still have the old editor
>>> reference.
>>>
>>> --> ;(
>>>
>>> On Mon, Oct 5, 2009 at 11:44 AM, Daniele Dellafiore 
>>> wrote:
>>> > Hey Bas, thanks for answering.
>>> >
>>> > Unfortunately it does not work.
>>> > Even if I run:
>>> >
>>> >               String removeEditor =
>>> "tinyMCE.execCommand('mceRemoveControl',
>>> > false, '"
>>> >                      + propertyPanel.getValueMarkupId() + "');";
>>> >                target.appendJavascript(removeEditor);
>>> >
>>> > or simply remove the TinyMceBehavior from my TextField, the result is
>>> the
>>> > same: mce editor disappear correclty, but remains in tinyMCE.editors
>>> list
>>> so
>>> > Tiny tries to process it in a successive iteration.
>>> >
>>> > I try to find help on tinyMCE forum
>>> >
>>> >
>>> > On Mon, Oct 5, 2009 at 10:59 AM, bgooren  wrote:
>>> >>
>>> >> I'll show you some parts of my code so you get an idea of how I do
>>> things.
>>> >>
>>> >> First of all, I have used AjaxEditableLabel from wicket-extensions as
>>> a
>>> >> starting point.
>>> >> TinyMCE's javascripts should always be loaded:
>>> >>
>>> >> // Preload TinyMCE
>>> >>        add( new AbstractBehavior()
>>> >>        {
>>> >>
>>> >>           �...@override
>>> >>            public void renderHead( IHeaderResponse response )
>>> >>            {
>>> >>                if( !tinyMCELoaded )
>>> >>                {
>>> >

Re: [tinymce] problem adding/removing TinyMceBehavior dinamically

2009-10-05 Thread bgooren

I'll show you some parts of my code so you get an idea of how I do things.

First of all, I have used AjaxEditableLabel from wicket-extensions as a
starting point.
TinyMCE's javascripts should always be loaded:

// Preload TinyMCE
add( new AbstractBehavior()
{

@Override
public void renderHead( IHeaderResponse response )
{
if( !tinyMCELoaded )
{
response.renderJavascriptReference(
TinyMCESettings.javaScriptReference() );

settings = buildTinyMCESettings();

tinyMCELoaded = true;
}
}

} );

In my case TinyMCE is loaded through an AJAX call:

@SuppressWarnings("unchecked")
@Override
protected void onEdit( AjaxRequestTarget target )
{
super.onEdit( target );

final String id = editor.getMarkupId( true );
final StringBuilder buf = new StringBuilder();

// Load plugins
buf.append( settings.getLoadPluginJavaScript() ).append( ";\n" );

// Initialize tinyMCE
buf.append( "tinyMCE.init({" ).append( settings.toJavaScript(
Mode.none, Collections.EMPTY_LIST ) ).append( " });\n" );
buf.append( settings.getAdditionalPluginJavaScript() ).append( ";\n"
);

// Setup editor
buf.append( "tinyMCE.execCommand('mceAddControl',true,'" ).append(
id ).append( "');" );

// Request focus on editor
buf.append( "setTimeout( function()
{tinyMCE.execCommand('mceFocus',true,'" ).append( id ).append( "');}, 500
);" );

target.appendJavascript( buf.toString() );
}

As you can see I initialize TinyMCE, and then perform an mceAddControl
command on the textarea I want to convert to a TinyMCE editor.

Finally, I need to switch back to a textarea before unloading, so the
correct contents are POSTed. To do so, I have added an AjaxCallDecorator to
the close request, and allow implementations to override it:

@Override
protected IAjaxCallDecorator getCloseDecorator()
{
return new AjaxCallDecorator()
{

@Override
public CharSequence decorateScript( CharSequence script )
{
return "tinyMCE.execCommand('mceRemoveControl', false, '" +
editor.getMarkupId() + "'); "
+ super.decorateOnSuccessScript( script );

// Call to save contents back to textarea
// return "tinyMCE.get('" + editor.getMarkupId() +
"').save(); " +
// super.decorateScript( script );
}

};
}

The above code removes TinyMCE from the given textarea, and saves the HTML
back into the textarea. I have commented out the call to save(), since it
was not necessary.

Bas


Daniele Dellafiore wrote:
> 
> I get what the real problem is: tinyMce saves internally each "editor"
> that
> is added to a page in a list called, well, editors.
> When I remove the behavior from a textField, I should also call
> tinyMce.remove passing the editors as a parameter.
> 
> I will try to do this but any help is appreciated :)
> 
> This is for the checkbox that enable/disable the tinyMce behavior.
> 
> 
> I have a more subtle situation: I have a list of textFields and a button
> to
> add more. When I add a new field, I refresh the list via AJAX to show the
> new field. But, refreshing the list also causes the html id of any element
> in the list to change!
> 
> So, when in the end I submit the form, tinyMce cannot find its editors
> anymore cause the parent DIV of the INPUT field that has an associated
> tinyMce editor just changed it's html id.
> Given that the id will change and there is no alternatives, I have to find
> a
> way to keep the associations or to clean all editors and recreate them at
> every list refresh.
> 
> What is your suggesions?
> 
> -- 
> Daniele Dellafiore
> http://blog.ildella.net
> http://twitter.com/ildella
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-tinymce--problem-adding-removing-TinyMceBehavior-dinamically-tp25681833p25747314.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: [tinymce] problem adding/removing TinyMceBehavior dinamically

2009-09-30 Thread bgooren

Well, that's what I meant with "preloading". You cannot use TinyMCE if you're
loading its javascripts from your ajax request. If the TinyMCE scripts are
loaded from the containing page, then it will work (as you say).


nino martinez wael wrote:
> 
> Actually AFAIK the resources just need to be on path, then you can pretty
> much do whatever you want. Could be what your definition of preloading are
> :)
> 
> I have a panel that are added by ajax so I had to make sure the resources
> used by that panel always where on the containing page.
> 
> regards
> 
> 2009/9/30 bgooren 
> 
>>
>> It's not possible to add TinyMCE dynamically due to the way TinyMCE
>> works.
>> What you can do however, is pre-load TinyMCE, and dynamically
>> enable/disable
>> it on a component.
>>
>> Daniele Dellafiore wrote:
>> >
>> > Hi. I have a problem with this example code:
>> >
>> >   tinyMceBehavior = new TinyMceBehavior();
>> >   PropertyModel richProperty = new PropertyModel(model,
>> > "rich");
>> >   add(new AjaxCheckBox("switchRte", richProperty) {
>> >
>> >  @Override
>> >  protected void onUpdate(AjaxRequestTarget target) {
>> > if (getModelObject()) {
>> >textArea.add(tinyMceBehavior);
>> > } else {
>> >textArea.remove(tinyMceBehavior);
>> >tinyMceBehavior = new TinyMceBehavior();
>> > }
>> > refresh(target);
>> >  }
>> >   });
>> >
>> > the purpose is to have a checkbox that add and remove the
>> > TinyMceBehavior from a text area.
>> > It works fine but I have this problem: when I Submit the form the
>> > textArea is in after REMOVING the behavior, I have a javascript error:
>> >
>> > t.win.document is null
>> >
>> > firebug show the error in tiny_mce_src.js at line 5376
>> >
>> > if (!r)
>> >r = isIE ? t.win.document.body.createTextRange() :
>> > t.win.document.createRange();
>> >
>> > I am using tinymce 3.2.7 but the same problem occurs with tinymce used
>> > in trunk version of wicket-contrib-tinymce.
>> >
>> > the effect is that "submit" does not work.
>> > if I click on checkbox again, everything continue to work.
>> > Any idea?
>> >
>> > --
>> > Daniele Dellafiore
>> > http://blog.ildella.net
>> > http://twitter.com/ildella
>> >
>> > -
>> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> > For additional commands, e-mail: users-h...@wicket.apache.org
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/-tinymce--problem-adding-removing-TinyMceBehavior-dinamically-tp25681833p25682644.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-tinymce--problem-adding-removing-TinyMceBehavior-dinamically-tp25681833p25683255.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: [tinymce] problem adding/removing TinyMceBehavior dinamically

2009-09-30 Thread bgooren

It's not possible to add TinyMCE dynamically due to the way TinyMCE works.
What you can do however, is pre-load TinyMCE, and dynamically enable/disable
it on a component.

Daniele Dellafiore wrote:
> 
> Hi. I have a problem with this example code:
> 
>   tinyMceBehavior = new TinyMceBehavior();
>   PropertyModel richProperty = new PropertyModel(model,
> "rich");
>   add(new AjaxCheckBox("switchRte", richProperty) {
> 
>  @Override
>  protected void onUpdate(AjaxRequestTarget target) {
> if (getModelObject()) {
>textArea.add(tinyMceBehavior);
> } else {
>textArea.remove(tinyMceBehavior);
>tinyMceBehavior = new TinyMceBehavior();
> }
> refresh(target);
>  }
>   });
> 
> the purpose is to have a checkbox that add and remove the
> TinyMceBehavior from a text area.
> It works fine but I have this problem: when I Submit the form the
> textArea is in after REMOVING the behavior, I have a javascript error:
> 
> t.win.document is null
> 
> firebug show the error in tiny_mce_src.js at line 5376
> 
> if (!r)
>r = isIE ? t.win.document.body.createTextRange() :
> t.win.document.createRange();
> 
> I am using tinymce 3.2.7 but the same problem occurs with tinymce used
> in trunk version of wicket-contrib-tinymce.
> 
> the effect is that "submit" does not work.
> if I click on checkbox again, everything continue to work.
> Any idea?
> 
> -- 
> Daniele Dellafiore
> http://blog.ildella.net
> http://twitter.com/ildella
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-tinymce--problem-adding-removing-TinyMceBehavior-dinamically-tp25681833p25682644.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Controlling the order of resource files

2009-08-17 Thread bgooren

Arie,

This is possible out-of-the-box using Session.setStyle();

Setting a style will make wicket consider resource files and property files
with the style you've specified.

The following is from the Component javadoc:

Style - The style ("skin") for a component is available through getStyle(),
which is equivalent to getSession().getStyle(). Styles are intended to give
a particular look to a Component or Resource that is independent of its
Locale. For example, a style might be a set of resources, including images
and markup files, which gives the design look of "ocean" to the user. If the
Session's style is set to "ocean" and these resources are given names
suffixed with "_ocean", Wicket's resource management logic will prefer these
resources to other resources, such as default resources, which are not as
good of a match. 

Bas


Arie Fishler-2 wrote:
> 
> Hello,
> 
> The normal way wicket goes over resource files is based on locale and
> different component names, application name etc.
> 
> What's the best practice for a situation in which I would like my
> application to find the resource file based on a "skin".
> This means that for the same classes set (same wicket application) and
> same
> local I still need to have different texts for a certain resource key.
> 
> It is like I need another selection mechanism for resource file which is
> not
> the locale but something that is specific to the logic of my application.
> 
> Is there some way to implement that? Like making wicket look for resource
> files the same way it does but add a prefix for every resource file
> name
> 
> Thanks,
> Arie
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Controlling-the-order-of-resource-files-tp25002679p25002802.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Enforcing CSS Styles to be Loaded From Server ?

2009-08-16 Thread bgooren

Farhan,

Please take a look at IResourceSettings (accessible from the application
object). More specifically at 

http://wicket.apache.org/docs/wicket-1.3.2/wicket/apidocs/org/apache/wicket/settings/IResourceSettings.html#setAddLastModifiedTimeToResourceReferenceUrl(boolean)
setAddLastModifiedTimeToResourceReferenceUrl(boolean) 

Bas


Farhan Bajwa wrote:
> 
> I want to customize themes for my website for each Valid User, for that
> purpose i have a unique StyleSheet for each user. When a user Logs IN, a
> respective CSS file turned ON. The problem exist when a user Logs IN again
> after modifying styles (theme) of his website, the latest CSS file not
> being applied on the Website but preexisting styles for that user applied
> on the Website. 
> When I Logs IN after clearing History (Cache) of the Browser(IE or
> FireFox), the latest styles are being applied. So I believe, problem exist
> in the Browser Cache. I have tried all Cache Headers for that purpose but
> it didn't work at all.
> That's why i want to create a Random number in my URL (for HomePage) so
> that request to HomePage after Logging IN will go to Server (enforcing
> Styles to be loaded from Server, not from cache).
> 
> Is this a valid approach, and how i can add random number to my URL ?
> Is there exist any other solution for clearing Browser's Cache ? 
> 
> Thanks...
> 
> 
> 
>   
> 

-- 
View this message in context: 
http://www.nabble.com/Enforcing-CSS-Styles-to-be-Loaded-From-Server---tp25001539p25001595.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Populating a model with form data from external site

2009-08-16 Thread bgooren

Sophia,

There are a number of solutions to this. I will name two:

1) Use a stateless form, take a look at the HTML (and form action) it
generates, and post to that form from an external site. I have not tested
this myself, but I expect it will work like a charm. Since the form is
stateless, it should always be handle a post, wherever it comes from

2) mount a custom handler on a URL and process the form fields manually.
This is a two-fold process:
- extend (e.g.) URIRequestTargetUrlCodingStrategy, and mount that @
application init
- decode() is most important to you in this case, you should return an
instance of your IRequestTarget implementation here (see my next point)
- create a second class which implements IRequestTarget and handles the form
submit
- in respond( RequestCycle ) you can access the HttpServlet through
   HttpServletRequest request = ( (WebRequest) requestCycle.getRequest()
).getHttpServletRequest();

Hope this helps.

Bas


NYSophia wrote:
> 
> Were you able to find a solution?
> 
> 
> LLehtinen wrote:
>> 
>> Hi -
>> 
>> I have "normal" POST requests coming from an external website. I would 
>> like to have a model object's members populated with the matching HTTP 
>> parameter values sent in the request. I have a feeling that there is an 
>> obvious an elegant way of having Wicket do this for me, but I can't seem 
>> to figure it out at this late hour. I would appreciate it if someone 
>> could point me to the right direction!
>> 
>> Right now I'm depending on a bunch of getRequest().getParameter() calls 
>> which seems way too servlet-ish to be the "right" way of doing this.
>> 
>> For clarity:
>> 
>> Let's say the incoming POST request contains the following parameters: 
>> id and name.
>> 
>> I would like to have Wicket populate a POJO (a model object) like this 
>> for me:
>> 
>> public class ModelObject {
>>   private Long id;
>>   private String name;
>> 
>>   .. getters & setters ..
>> 
>> }
>> 
>> instead of doing
>> 
>> Long id = Long.parseLong(getRequest().getParameter("id"));
>> String name = getRequest().getParameter("name");
>> 
>> Thank you all for your quick responses to my earlier questions.
>> 
>> --
>> LL
>> 
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Populating-a-model-with-form-data-from-external-site-tp17395075p25001556.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: how to get some data from servlet

2009-07-28 Thread bgooren

Thanks Fernando, I was looking for some code like this!


Fernando Wermus-2 wrote:
> 
> Hi,
> 
> Instead using a servlet you could try the following (you can find the
> whole
> code at wicketstuff pickwick )
> 
> This way you will have the session because your are into the
> requestCycle
> 
> On your WicketApp
> 
> mount(new URIRequestTargetUrlCodingStrategy("/upload") {
> @Override public IRequestTarget decode(RequestParameters
> requestParameters) {
> try {
> return new
> UploadRequestTarget(decodeParameters(requestParameters).getString("uri"));
> } catch (Exception e) {
> throw new WicketRuntimeException(e);
> }
> }
> });
> 
> Your own class for uploading images or whatever you want
> 
> public class UploadRequestTarget implements IRequestTarget {
> String parameters;
> 
> public UploadRequestTarget(String parameters) {
> this.parameters=uri;
> }
> 
> public void detach(RequestCycle requestCycle) {}
> 
> public void respond(RequestCycle requestCycle) {
> HttpServletRequest
> request=((WebRequest)requestCycle.getRequest()).getHttpServletRequest();
> HttpServletResponse
> response=((WebResponse)requestCycle.getResponse()).getHttpServletResponse();
> 
> response.setHeader("Connection","close");
> 
> FileItemFactory factory = new DiskFileItemFactory();
> ServletFileUpload upload = new ServletFileUpload(factory);
> 
> List items=null;
> PrintWriter out=null;
> try {
> out = response.getWriter();
> items = upload.parseRequest(request);
> 
> for (int i = 0; i < items.size(); i++) {
> DiskFileItem item = (DiskFileItem) items.get(i);
> // As we are interested not in regular form fields, we
> filter only files
> if (!item.isFormField()) {
> String fileName=COMPLETE IT
> item.write(new File(fileName));
> out.print("RESP.100");
> out.flush();
> }
> }
> } catch (FileUploadException e1) {
> out.print("RESP.200");
> // flush the stream to speed up applet notification
> out.flush();
> e1.printStackTrace();
> } catch (Exception e) {
> e.printStackTrace();
> }
> 
> }
> 
> 
> On Sun, Jul 19, 2009 at 3:20 PM, Altuğ B. Altıntaş 
> wrote:
> 
>> Hi Igor;
>>
>> I found the problem; problem is when i hit my UploadServlet via http-get
>> method , i simply write the url and hit the enter then below code is
>> working
>>
>>  Session wicketSession = Session.get();
>>
>> I can get wicket Session, wow !! it is great...
>>
>> BUT ...
>>
>> When i hit  my UploadServlet via http-post method, swfupload access in
>> that
>> way then i can NOT access wicketSession.
>>
>> I mean this code :
>>
>>  Session wicketSession = Session.get();
>>
>> it throws :
>>
>> java.lang.IllegalStateException: you can only locate or create sessions
>> in
>> the context of a request cycle
>>
>> Any idea ?
>>
>> Thanks
>>
>> Altug..
>>
>>
>> 2009/7/14 Igor Vaynberg 
>>
>> > that doesnt make any sense. all things within the webapp share the
>> > session. you guys are welcome to create a quickstart that replicates
>> > this.
>> >
>> > -igor
>> >
>> > On Tue, Jul 14, 2009 at 3:47 AM, Altuğ B. Altıntaş
>> > wrote:
>> > > Also I have a problem like yours.
>> > >
>> > > Servlet session and Wicket's session are different so you are getting
>> > nul.
>> > > Just debug your application and you will see that they have different
>> > > session Id's.
>> > >
>> > > I tried to use WicketSessionFilter but it doesn't work.
>> > >
>> > > I am using wicket 1.3.5.
>> > >
>> > > Cheers...
>> > >
>> > > Altug.
>> > >
>> > > 2009/6/23 danisevsky 
>> > >
>> > >> hello, I am using MyMultiFileUploadServlet for uploading files and
>> in
>> > some
>> > >> wicket component I need find out how many files was uploaded.
>> > >> I was trying to set this number to the HttpSession in
>> > >> MyMultiFileUploadServlet and get it in the component:
>> > >>
>> > >>HttpSession httpSession = ((WebRequest)
>> > >> getRequest()).getHttpServletRequest()
>> > >>.getSession();
>> > >> String count = httpSession
>> > >>.getAttribute("filesCount");
>> > >>
>> > >> but count is always null. Is there any way how to get some data from
>> > >> servlet? Thanks
>> > >>
>> > >
>> > >
>> > >
>> > > --
>> > > Altuğ.
>> > >
>> >
>> > -
>> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> > For additional commands, e-mail: users-h...@wicket.apache.org
>> >
>> >
>>
>>
>> --
>> Altuğ.
>>
> 
> 
> 
> -- 
> Fernando Wermus.
> 
> www.linkedin.com/in/

Re: Anybody know what is this situation?

2009-07-03 Thread bgooren

I got the same error today, seems totally random.

The only possible explanation I have is that maybe the subclass (LoginPage$1
in your case) stores a PageHolder class instead of the actual page
(LoginPage) when serialized, and when LoginPage$1 is deserialized, the
PageHolder retrieves/points to a different Page.

I was just as baffled as you since in my case the two classes were totally
different, like in your case (com.application.MainPage vs
wicket.quickstart.LoginPage).
In my case it's two pages from the same application, but they are
functionally separate and never interact.

In my case I made the inner class that caused the problem a static inner
class. Since I have been unable to reproduce the problem I cannot confirm if
this resolves the problem.

Can you share what kind of class LoginPage$1 is? (it's the first anonymous
inner class in LoginPage) Is it a class which extends IModel?

Also, you someone from the Wicket team confirm if my explanation above is
possible at all (PageHolder retrieving a different class when
deserializing)?

Bas


MartinM wrote:
> 
> Anybody know what is this situation? Wicket 1.4-rc4
> 
> From production:
> 
> 2009-05-18 16:32:44,316 19598423 [btpool0-112] ERROR RequestCycle  -
> cannot assign instance of com.application.MainPage to field
> wicket.quickstart.LoginPage$1.this$0 of type
> wicket.quickstart.LoginPage in instance of
> wicket.quickstart.LoginPage$1
> java.lang.ClassCastException: cannot assign instance of
> com.application.MainPage to field wicket.quickstart.LoginPage$1.this$0
> of type wicket.quickstart.LoginPage in instance of
> wicket.quickstart.LoginPage$1
>at
> java.io.ObjectStreamClass$FieldReflector.setObjFieldValues(ObjectStreamClass.java:2032)
>at
> java.io.ObjectStreamClass.setObjFieldValues(ObjectStreamClass.java:1212)
> 
> .. etc ...
> 

-- 
View this message in context: 
http://www.nabble.com/Anybody-know-what-is-this-situation--tp23597800p24329006.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org