Listening key pressings on server side

2010-02-09 Thread Roland
Hello,

I'd like to know whether there is a way to listen certain key pressings (key
a,>,1,...) on server side in wicket.

I've tried
.html:

.java
body = new WebMarkupContainer("body");
body.add(new AjaxEventBehavior("onkeypress"){

   protected void onEvent(final AjaxRequestTarget target) {
   LOG.debug("keypress");
   }
   });
Problem here is that event is generated only for "onclick" event, in case of
"onkeypress", nothing happens.
And even if I would be able to catch the "onkeypress" event, I'd still have
to figure out, which key was pressed.

And also I've tried wicket-contrib-input-events

add(new InputBehavior(new KeyType[] { KeyType.Left },
EventType.click));

add(new AjaxEventBehavior("onclick"){

@Override
protected void onEvent(AjaxRequestTarget target) {
LOG.debug("Clicked left");

}

});


But problem there is that EventType.onkeypress is not supported.

Examples I made on main page, but eventually I would need to listen key
pressings on modalwindow's panel, which is placed on a page.

Thanks in advance,
Roland


Hook into RequestCycle ?

2008-02-12 Thread Roland Huss

Hi,

what is the best place to hook into the request cycle 
before a page gets processed ? I looked through 
http://cwiki.apache.org/WICKET/lifecycle-of-a-wicket-application.html but
the 
information there seems to be a bit outdated ("the Session returned by the
Application 
is asked  to create a RequestCycle object using the Session's request cycle
factory", 
but there's nothing like a request cycle factory which can be obtained from
a Session in 1.3)

Is there a more accurate documentation of a request's lifecycle somewhere
else ? 

My use case is as follows: Before any page is processed I want to look up in
the Session,
whether a user is authenticated. If not, it is checked wheter a certain hash
stored in a Cookie 
(if any) is stored in the DB and the associated user then is put into the
session, providing some sort 
of 'keep me logged in' functionality. (The 'remember me' feature of the
SignInPanel is not enough for
me, since I want a transparent login without moving over the login page). Of
course, if there is already
support for this kind of feature out of the box somewhere, I would be happy
for getting a pointer, too.

thanx ...

... roland
-- 
View this message in context: 
http://www.nabble.com/Hook-into-RequestCycle---tp15428634p15428634.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



RE: StringResourceModel - how to pass method call instead of bean

2008-02-12 Thread Roland Huss


Michael Mehrle wrote:
> 
> Now, if I want to call a method that returns a String instead, like
> so...
> 
> add(new Label("greetings", new StringResourceModel("label.allAlbums",
> this, new Model(getTotalAlbums(;
> ^^^
> 
> ...with my properties file having this entry:
> 
> label.getTotalAlbums = All Albums: ${someReference}
> 
> Obviously, this doesn't work, since the new Model(xxx) call expects a
> bean to be passed in. How can I do this with a simple method call? And
> what would my someReference var be?
> 

Why dont you simple use MessageFormat's parameter substitution as desribed
in the JavaDoc, i.e.

 .. new StringResourceModel("label.getTotalAlbums",this,null,new Object[] {
getTotalAlbums() });

with 

label.getTotalAlbums=All Albums: ${0}

Alternatively, I you need late binding put 

new AbstractReadOnlyModel() {
public Object getObject() { return getTotalAlbums(); }
}

in the object array (instead of getTotalAlbums() directly)

bye ...

...roland
-- 
View this message in context: 
http://www.nabble.com/TabbedPanel-and-model-load...-tp15385787p15440668.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



RE: StringResourceModel - how to pass method call instead of bean

2008-02-12 Thread Roland Huss


Michael Mehrle wrote:
> 
> One more question - what do you refer to with 'late binding' - I assume
> the value would be computed 'late' in the process? Please elaborate or
> send me a pointer.
> ...
> 
>> Alternatively, I you need late binding put 
>> 
>> new AbstractReadOnlyModel() {
>>public Object getObject() { return getTotalAlbums(); }
>> }
> 
> 

You got it. ('late binding' is probably the wrong synonym here, but it's a
good metaphor anyway. 
At least for me ;-) Instead of showing only the number of total albums which
existed 
at creation time of your component, by using this extra indirection step you
get
your method evaluated each time the component is rendered (which can happen
quite later 
when your album collection changes, e.g. when you use this label on a page
where you
manage your stuff).

...roland
-- 
View this message in context: 
http://www.nabble.com/TabbedPanel-and-model-load...-tp15385787p15441970.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Hook into RequestCycle ?

2008-02-12 Thread Roland Huss



Martijn Dashorst wrote:
> 
> The auth-roles project is basically an example, so the fact that you
> copied
> it, is a good thing (tm). Even though it is sufficient for a lot of
> projects, if you need anything beyond the current capabilities, then
> rolling
> your own is the way to go. Or use Swarm/Wasp from Wicket Stuff
> 

Well, auth-roles meets nearly perfectly my current needs and I use it, but
had to 
*duplicate* quite some code in a subclass (i.e. overriding a method, 
copying the original code except one line or so). That's a bad thing IMO. 

I agree that auth-role is an add on and I could do it my own way. 
The core wicket extensions points are more than sufficient for that.
But even a good example like auth-roles could be improved sometimes ;-)
 
Don't get me wrong, the current situation is ok for me because it works.

bye ...

...roland
  

-- 
View this message in context: 
http://www.nabble.com/Hook-into-RequestCycle---tp15428634p15439750.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Hook into RequestCycle ?

2008-02-12 Thread Roland Huss

Hi Martijn,


Martijn Dashorst wrote:
> 
> Take a look at wicket-auth-roles. This provides the usual security stuff,
> and you can easily also check for a set cookie. Just implement your own
> authorisation scheme.
> 

Thanks, this was exactly the pointer I was looking for 
(i.e. the hook via IUnauthorizedComponentInstantiationListener as used in 
AuthenticatedWebApplication)

However, there is a slight glitch.  There is not way to provide a
automatic sign in since this can be only be done via
signIn(username,password) on AuthenticatedWebSession. It would be
possible if AWS.isSignedIn() wouldn't be final, so one could
dynamically check for the cookie (and not only for a previous occured
manual authentication).

The solution I've chosen right now is to set an own
UnauthorizedComponentInstantiationListener in my
AuthenticatedWebApplication which copies over 90% of the existing
functionality. This is certainly not an ideal solution.

In general, I'm a fan of final methods, too in order to restrict
unwanted extension points, but for AWS.isSignedIn() it would be
probably a good idea to allow overriding or at least to provide and
additional hook to relax the restriction to work with manual
authentication via AWS.signIn() only.

If you don't mind, I would like to open a JIRA issue for an RFE 
(with some more code examples).

Thanx again for the hint (and for this great framework in general ;-) ...

... roland


-- 
View this message in context: 
http://www.nabble.com/Hook-into-RequestCycle---tp15428634p15435618.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Business/Domain objects used as wicket model object - opinions please

2008-02-13 Thread Roland Huss

Except for rather small scoped projects, I prefer the usage of DTOs (or
formerly 
known as 'View Objects') over direct usage of domain objects. DTOs can be
modelled 
much closer to the use case (i.e. view) at hand (by combining domain objects
or 
leaving out non-required attributes to have objects like e,g
'UsersAndTicketsVO').

If you are using an ORM tool like Hibernate there are some additional
technical issues, if you 
intend to let the mapped domain objects propagate to the view layer:

* LazyInitializationException issues (no more words on this here ;-)
* Serialization can bite you in remote access scenarios (not very probable
for a 
  web application, though) because of the implicite dependency on some 
  implementation classes like a HibernateSession.
* Subtle but severe problems when you have to 'prepare' domain objects for
the view, 
  e.g. for security reasons. Consider a scenario where a user are only
allowed to see
  some parts of a domain objects, e.g. a 'Protocol' which has
'ProtocolEntry' members where 
  some of them are classified. If you now remove the classified
'ProtocolEntry' members before
  showing the protocol entries in a list view, and this happens within a
Hibernate Session's 
  boundary, then this entries will be removed from the DB as well (without
an explicit call to 
  some DAO). 

We use DTOs also for an addition abstraction layer (a facade), which
provides use-case (client) 
specific service methods (with DTOs as arguments) and call out to domain
specific services (hidden
by interfaces of course) with domain objects on the other side.

BTW, I had to learn all those things 'the hard way', so this is not a pure
theoretical argumentation.
Formerly, I was a firm advocat of 'avoiding DTOs at all cost', too ;-)

If you need some tool support for using view objects (and to cut down the
LOCs ;-), we find 
Dozer (http://dozer.sf.net/) for declarative, bean-wise mappings rather
useful. 

... roland


Martijn Dashorst wrote:
> 
> You could do that. If you are paid by the lines of code you write, it
> might be even profitable. A lot of people prefer the direct binding
> (which IMO is a POJO) instead of making a GUI bean (which would be a
> DTO).
> 
> Martijn
> 
> On 2/14/08, mfs <[EMAIL PROTECTED]> wrote:
>>
>> Well i meant the same in my question..i dont think making your Domain
>> Objects
>> implement IModel would give any benefit rather would make the DO
>> dependent
>> on wicket (or the presentation layer)...
>>
>> So you advocate the idea of having the domain object wrapped inside
>> wicket
>> models..rather than having a seperate screen specific POJO...like
>> AddressModelObject for AddressPanel, LoginModelObject for LoginPanel
>>
>> e.g.
>>
>>
>>
>>
>>
>> Mr Mean wrote:
>> >
>> > In our apps we always wrap our domain objects in models, not have them
>> > implement IModel.
>> > There is only 1 exception to this rule and that is because that
>> > particular object is not stored in the db but is initialized with
>> > loads of other objects. It turned out to be one very complex mofo not
>> > something i would recommend.
>> >
>> > Maurice
>> >
>> > On Feb 13, 2008 7:30 PM, mfs <[EMAIL PROTECTED]> wrote:
>> >>
>> >> Guys,
>> >>
>> >> I would want to know if using your business/domain objects as wicket
>> >> models
>> >> would be a good idea ?
>> >>
>> >> i remember in an earlier thread i was suggested not to use
>> >> business-objects
>> >> as wicket models, but it would want to hear more opinions..
>> >>
>> >> Thanks in advance..
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/Business-Domain-objects-used-as-wicket-model-object---opinions-please-tp15462661p15462661.html
>> >> Sent from the Wicket - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >> -
>> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >> For additional commands, e-mail: [EMAIL PROTECTED]
>> >>
>> >>
>> >
>> > -
>> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > For additional commands, e-mail: [EMAIL PROTECTED]
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Business-Domain-objects-used-as-wicket-model-object---op

Re: Picnik components

2008-03-22 Thread Roland Huss

Hi Ruediger,


Rüdiger_Schulz wrote:
> 
> I'm sure some of you heard about picnik.com, this awesome online image
> editor. As I'm in the process of integrating this in my website via their
> API, I wanted to implement this as a collection of reusable Wicket
> components. Has anyone already started with this? If not - I'm going to,
> and
> I'd be very happy to release this under Apache License 2.0, e.g. as a
> wicketstuff project.
> 

I'm very interested in such components, so when you have something to look
at, I would be happy to give it a try ...

...roland 
-- 
View this message in context: 
http://www.nabble.com/Picnik-components-tp16218381p16221631.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



wicketstuff-push and component replacing

2010-01-22 Thread Roland Vares
Hello,

I'm currently developing wicket based application, which displays alarms on map 
and allows their modification.
New alarms are sent to server through soap service and map with few other 
components on page for all browser clients needs to be refreshed.

I'm using wicketstuff-push for the push service implementation.
org.wicketstuff.push.timer.TimerPushService to be clear.



As an in examples I have method on wicket page which is activated when server 
sends notification about an event:
// set new listener for incoming events
final IPushTarget pushTarget = 
getTimerPushService().installPush(this);
getPushService().addMapListener(new 
MapServiceListener() {
public void onEventChange(final Event event) {
if 
(pushTarget.isConnected()) {
Label label = new Label("labelonpage","label"); //label to 
be replaced
pushTarget.addComponent(label);
pushTarget.trigger();
}
else { // remove inactive listener

LOG.debug("Removing map listener " + this);

getPushService().removeMapListener(this);
}
...

Problems start with line :
Label label = new Label("labelonpage","label");

which results with:
org.apache.wicket.WicketRuntimeException: There is no application attached to 
current thread btpool0-2
at org.apache.wicket.Application.get(Application.java:179)
at 
org.apache.wicket.Component.getApplication(Component.java:1323)
at org.apache.wicket.Component.(Component.java:920)

It seems that in this push method, context is lost, I have no session, 
request,...

Is there any way I gan regain it or make new?

Or how should I implement push service, which needs to replace some components 
on page?

Thanks in advance,
Roland


Re: AutoCompleteTextField - autocomplete multiple fields

2008-05-30 Thread Roland Huss

Hi Daniel,


Daniel Stoch-2 wrote:
> 
> The main
> problem is that the AutoCompleteTextField and related classes
> (behavior, renderer) are not easily to extend (eg. it is necessary to
> make a few modifications in wicket-autocomplete.js but in
> AbstractAutoCompleteBehavior the standard js is added in renderHead
> method, so there is no way to replace it, etc.). So I must made a copy
> of these standard classes and then made modifications in them.
> 

I had the same problem with extending AbstractAutoCompleteBehavior while 
working on wicketstuff-objectautocomplete and I already 
opened a Jira issue for that. You might want to vote for 
https://issues.apache.org/jira/browse/WICKET-1651 which provides a patch for
putting AACB's renderHead() logic into a protected initHead() method, which
then 
can be overwritten by a subclass and AACB.super.renderHead() is still
called. 

...roland
-- 
View this message in context: 
http://www.nabble.com/AutoCompleteTextField---autocomplete-multiple-fields-tp17500271p17553097.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



RE: users, please give us your opinion: what is your take on generics with Wicket

2008-06-04 Thread Roland Huss


Brill Pappin wrote:
> 
>  I don't know if you have every done true TDD (most people can't or think
> they can), but it actually changes your code and the way you write it.
> Starting with 2 users of your code makes a significant impact on what it
> looks like in the end.
> 

Just out of curiosity: Do you have an example for this or some pointer to
someone who has ?
-- 
View this message in context: 
http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17656527.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: generics

2008-07-02 Thread Roland Huss



igor.vaynberg wrote:
> 
> On Tue, Jul 1, 2008 at 11:28 PM, Eelco Hillenius
> <[EMAIL PROTECTED]> wrote:
> thats my point. you work on fields of one object, true, but it does
> not necessarily have to be the form's modelobject unless you use a
> compound property model. 
> 

The usage of a CompoundPropertyModel as a Form-model saved us quite some
typing and it's IMO 
a very common use case. In fact, this it propbably the most relevant use
case for a CPM anyway.
So, I'm in favor of having a Form with Model (or at least a variation like a
ModelForm ...)

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


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



Re: generics

2008-07-02 Thread Roland Huss

But at the end, I want my model object back to do some business with it, so I
could either store the CPM myself for later reference (but why would I want
to do this ?) or retrieve it from the Form's model (typesafe, if possible).
That's why a generified Form would be nice.

... roland


svenmeier wrote:
> 
> Just because you're using a CompoundPropertyModel on your Forms doesn't 
> mean you need it generified.
> 
> Sven
> 
> Roland Huss schrieb:
>>
>> igor.vaynberg wrote:
>>   
>>> On Tue, Jul 1, 2008 at 11:28 PM, Eelco Hillenius
>>> <[EMAIL PROTECTED]> wrote:
>>> thats my point. you work on fields of one object, true, but it does
>>> not necessarily have to be the form's modelobject unless you use a
>>> compound property model. 
>>>
>>> 
>>
>> The usage of a CompoundPropertyModel as a Form-model saved us quite some
>> typing and it's IMO 
>> a very common use case. In fact, this it propbably the most relevant use
>> case for a CPM anyway.
>> So, I'm in favor of having a Form with Model (or at least a variation
>> like a
>> ModelForm ...)
>>
>> ... roland
>>   
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

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


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



Re: Resource/SharedResource - Display an image

2008-07-09 Thread Roland Huss


greeklinux wrote:
> 
> 
> 
> 
> But now I get a NullPointerException:
>  at .PhotoUploadPage$1.getResourceStream(PhotoUploadPage.java:66)
> at org.apache.wicket.Resource.init(Resource.java:199)
> at
> org.apache.wicket.Resource.onResourceRequested(Resource.java:105)
> at
> org.apache.wicket.markup.html.image.resource.LocalizedImageResource.onResourceRequested(LocalizedImageResource.java:198)
> at
> org.apache.wicket.markup.html.image.Image.onResourceRequested(Image.java:147)
> 

Where in the code snippet that you posted is line 66 at which this NPE has
occured ?


...roland
-- 
View this message in context: 
http://www.nabble.com/Resource-SharedResource---Display-an-image-tp18348115p18359444.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Resource/SharedResource - Display an image

2008-07-09 Thread Roland Huss


greeklinux wrote:
> 
> the line where the NullPointerException is thrown is:
> 
> resourceStream = new ResourceReference(MyApplication.PROFILE_STANDARD)
>
> .getResource().getResourceStream();
> 
> If I am using only this ResourceReference then it works. But I dont know
> why
> the Exception is thrown.
> 

You need to bind (==register) the ResourceReference to the application
before you can get to the referenced Resource (which has been registered
either explicitely or implicitely, if is a PackageResource):

resourceReference =  new ResourceReference(MyApplication.PROFILE_STANDARD);
resourceReference.bind(Application.get());
resourceStream = resourceReferece.getResource().getResourceStream();


...roland
-- 
View this message in context: 
http://www.nabble.com/Resource-SharedResource---Display-an-image-tp18348115p18363876.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Resource/SharedResource - Display an image

2008-07-10 Thread Roland Huss

Hi,


greeklinux wrote:
> 
> your solution works. But the problem is that I am already registering the
> resource in
> an Initializer. But ok...
> 
When you bind a resource reference to an application, it's not about
registering the resource itself
but looking it up. My fault.

greeklinux wrote:
> 
> Now I am uploading the picture and after the reload, I see the standard
> pic. After a
> site refresh I am seeing the uploaded pic.
> 
> Do I have to set any headers?
> 
Though I don't know your setup, but you need to refresh your image component
(i.e. if it is done via an Ajax request). No headers needs to be set here.

... roland
-- 
View this message in context: 
http://www.nabble.com/Resource-SharedResource---Display-an-image-tp18348115p18393207.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: AutocompleteTextField

2008-07-18 Thread Roland Huss

Hi,

you might want to have a look at wicketstuff-objectautocomplete which
exactly adresses this scenario. It's not released though (and there are some
changes in the pipeline so that it plays a smarter role when used within a
form), but should work. The code is available via
http://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-objectautocomplete
. Look at the exampes for how to use it.

... roland
 

ulrik wrote:
> 
> Hello!
> 
> I have a question that I hope someone can help me with.
> 
> Lets say I have two classes like the ones here:
> http://papernapkin.org/pastebin/view/1760/ . 
> Lets say I want a page with a AutoCompleteTextField where I can search
> students by entering their name in the search field. Because there can be
> several students with the same name I want to be able to separate one from
> the other when I choose one of them from the list of choices. So, what I
> want to happen is that when I for example enter "Ad" into the search
> field, I want the search field to show A list with all students whos name
> is Adam, when I select one of them I want the ID for that specific adam to
> be stored in the Model associated with the search field. How do I do that?
> Anyone that has an idea? 
> 

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


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



Re: How to handle these nested tags

2007-09-10 Thread Roland Huss

Hi,

> 
> ¡¡  Welcome 

Could it be, that  is not supported as markup for a Label component
and that you should use something like  instead ?

... roland

-- 
View this message in context: 
http://www.nabble.com/How-to-handle-these-nested-%3Ctable%3E-tags-tf4412208.html#a12587601
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: File downloading with Wicket

2007-09-26 Thread Roland Kaercher
Hello Ian,

I think DownLoadLink (
http://people.apache.org/~tobrien/wicket/apidocs/org/apache/wicket/markup/html/link/DownloadLink.html
) is what you need.

Regards,
Roland

On 9/26/07, Ian Godman <[EMAIL PROTECTED]> wrote:
> Can any one give me a pointer or 2 on how to download a file from a wicket 
> page?
>
> I have a LinkTree representing a directory tree which is lazy loaded via 
> ajax. When the user clicks on a file node I need to download the file to 
> them. However the file is stored with a different name (allows for versioning 
> etc)   so it needs to arrive at the browser as a file with the name as 
> displayed in the tree not as saved on the hard disk.
>
> This was previously implemented in a Tapestry system using a servelet but I 
> just cant get my head around the issues of using a servlet in Wicket (does 
> not seem the right way to me).
>
> Any help in clearing the fog most appreciated, example code even more so
>
>
> Ian
>
>
>
>
>
>   ___
> Yahoo! Answers - Got a question? Someone out there knows the answer. Try it
> now.
> http://uk.answers.yahoo.com/

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



Re: File downloading with Wicket

2007-09-26 Thread Roland Kaercher
Hello Ian,

you will need to override newNodeComponent(final String id, final
IModel model) on the LinkTree to return your own panel with the
downloadlink for the nodes which should trigger a download and
super.newNodeComponent... for all others.

regards,
roland

On 9/26/07, Ian Godman <[EMAIL PROTECTED]> wrote:
> I have looked at the DownloadLink class and it does seem to do what i need.
>
> The issue I have now is that I am using a link tree which uses ajax to load 
> the directory contents as the tree is traversed. This works fine.
>
> What I think I need to do is change the behavior of the tree node for the 
> files such that it does not use ajax. I have looked at doing this but just 
> cant work it out.
>
> I have extended LinkIconPanel to determine if the node is a directory or a 
> file depending on the type of the user object in the model and not on if the 
> node has any children.
>
> I think this is were I need to make changes but I cant find out where the 
> ajax behavior is being added.
>
> The code I have derived from DownloadLink is
>
> IResourceStream resourceStream = new FileResourceStream(new 
> org.apache.wicket.util.file.File(file));
> getRequestCycle().setRequestTarget(new 
> ResourceStreamRequestTarget(resourceStream) {
> public String getFileName()
> {
> log.debug("returning: " + fileItem.getFileName() ) ;
> return fileItem.getFileName();
> }
> });
>
>
> I have this on the onNodeLinkClicked of my tree (extends LinkTree).
>
> To my understanding the download redirects the request to the file to be 
> downloaded, dont think this will work with an ajax request.
>
>
>
> - Original Message 
> From: Andrew Klochkov <[EMAIL PROTECTED]>
> To: users@wicket.apache.org
> Sent: Wednesday, 26 September, 2007 11:55:07 AM
> Subject: Re: File downloading with Wicket
>
> Have a look at the DownloadLink class
>
> Ian Godman wrote:
> > Can any one give me a pointer or 2 on how to download a file from a wicket 
> > page?
> >
> > I have a LinkTree representing a directory tree which is lazy loaded via 
> > ajax. When the user clicks on a file node I need to download the file to 
> > them. However the file is stored with a different name (allows for 
> > versioning etc)   so it needs to arrive at the browser as a file with the 
> > name as displayed in the tree not as saved on the hard disk.
> >
> > This was previously implemented in a Tapestry system using a servelet but I 
> > just cant get my head around the issues of using a servlet in Wicket (does 
> > not seem the right way to me).
> >
> > Any help in clearing the fog most appreciated, example code even more so
> >
> >
> > Ian
> >
> >
> >
> >
> >
> >   ___
> > Yahoo! Answers - Got a question? Someone out there knows the answer. Try it
> > now.
> > http://uk.answers.yahoo.com/
> >
>
>
> --
> Andrew Klochkov
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
>
>
>
>
>   ___
> Yahoo! Answers - Got a question? Someone out there knows the answer. Try it
> now.
> http://uk.answers.yahoo.com/

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



Re: Wicket Article on DevX

2007-10-15 Thread Roland Kaercher
Nathan has written a nice article on jetty which made me to switch to
jetty for deployment too:
http://technically.us/code/x/to-jettison-geronimo/

(and no, I did not regret it)

regards,
Roland

On 10/15/07, Sam Hough <[EMAIL PROTECTED]> wrote:
>
> Congratulaions on the article.
>
> I was interested by the "encourages the use of the Jetty container" bit. Is
> that more that the core Wicket developers prefer Jetty or is there a killer
> advantage over the more common Tomcat?
>
> Cheers
>
> Sam
> --

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



Re: Wicket Article on DevX

2007-10-15 Thread Roland Kaercher
Yes, you're right, I didn't read it again. But it also got me to
switch to jetty because IIRC the the memory overhead for using tomcat
5 (I heard tomcat 6 is different there) when just starting up my tiny
apps was significantly higher - although it might be less dramatic
than I have in memory ;-)

Regards,
Roland

On 10/15/07, Sam Hough <[EMAIL PROTECTED]> wrote:
>
> The article seems to be more advocating running multiple JVMs if you are
> prepared to run a front end proxy to put everything back under the same
> ip/port? Presumably you could do the same with Tomcat etc..?
>
> The runtime usage of Jetty vs Tomcat would be interesting but as always
> turns out it is very application specific and 9 times out of 10 the
> application(s) you are running will consume more memory/CPU than the
> container... Sure we've all seen the apps that are doing something
> complicated to the database for every request...
>
>
> Roland Kaercher wrote:
> >
> > Nathan has written a nice article on jetty which made me to switch to
> > jetty for deployment too:
> > http://technically.us/code/x/to-jettison-geronimo/
> >
> > (and no, I did not regret it)
> >
> > regards,
> > Roland
> >
> > On 10/15/07, Sam Hough <[EMAIL PROTECTED]> wrote:
> >>
> >> Congratulaions on the article.
> >>
> >> I was interested by the "encourages the use of the Jetty container" bit.
> >> Is
> >> that more that the core Wicket developers prefer Jetty or is there a
> >> killer
> >> advantage over the more common Tomcat?
> >>
> >> Cheers
> >>
> >> Sam
> >> --
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
>
> --
> View this message in context: 
> http://www.nabble.com/Wicket-Article-on-DevX-tf4623720.html#a13213821
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

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



Re: Displaying feedback

2007-11-12 Thread Roland Kaercher
Hello Joshua,

if you just want to display the feedback in your default feedback
panel all you have to do is add it to your page, there is no need to
tell the form which feedback panel to use then.

roland

On Nov 12, 2007 8:25 AM, Joshua Jackson <[EMAIL PROTECTED]> wrote:
> Dear all,
>
> How do I display the feedback/message upon validation failure/error?
> When I read the doc here:
> http://cwiki.apache.org/WICKET/newuserguide.html#Newuserguide-Validation
> , we insert the feedback instance into the Form constructor, but the
> latest Wicket release don't have a constructor that has FeedBackPanel
> as the argument.
>
> Does anyone know the way?
>
> Thanks in advance.
>
> --
> What you want today, may not exist tommorrow
>
> Blog: http://joshuajava.wordpress.com/
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

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



Re: Equivalent to

2008-01-04 Thread Roland Kaercher
Hi Haritha,
just use a panel where you would have included something.

regards,
roland

On Jan 4, 2008 7:24 PM, Haritha Juturu <[EMAIL PROTECTED]> wrote:
> Hi All,
> How do we achieve   Thanks
> Haritha
>
>
>
>
>   
> 
> Looking for last minute shopping deals?
> Find them fast with Yahoo! Search.  
> http://tools.search.yahoo.com/newsearch/category.php?category=shopping

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



Re: url mapping and wizards

2007-08-17 Thread Roland Kaercher
Hello Simon,

you could encrypt your URL as described here:
http://cwiki.apache.org/WICKET/obfuscating-urls.html

Roland

On 8/17/07, wicket user <[EMAIL PROTECTED]> wrote:
> Thanks Igor,
>
> I guess it makes sense that you wouldn't want to really bookmark a step
> halfway within a wizard. The main reason I wanted to do that though was that
> I was hoping to remove the word "wicket" from the url just from the point of
> view of wanting to remove evidence of the frameworks that I rely on.
>
> Simon
>
> On 16/08/07, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> >
> > this is not how wicket works. bookmarkable urls are entry points, but once
> > you change the state of the page you have to keep track of that instance
> > somehow - that is what :12: is in that url - a wicket page id. so once you
> > change the state of any page it is no longer bookmarkable and thus cannot
> > have a ncie url.
> >
> > -igor
> >
> > On 8/16/07, wicket user <[EMAIL PROTECTED]> wrote:
> > >
> > > Hi,
> > >
> > > I've just started using Wicket and I've managed to mount pages so that
> > the
> > > urls are cleaned up but for the life of me I can't seem to get it to
> > work
> > > with Wizard pages. Is there a trick to this?
> > >
> > > At the moment it looks like this:
> > > http://localhost:8080/myapp/app/?wicket:interface=:12
> > >
> > > I've tried mounting the wizard page as well as mounting the package that
> > > the
> > > wizard is in but with no luck.
> > >
> > > Many thanks
> > > Simon
> > >
> >
>

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



Re: Wicket.Ajax.post array parameters

2014-10-22 Thread Roland Dobsai
public abstract class SortableBehavior extends AbstractDefaultAjaxBehavior
{

@Override
protected void respond(AjaxRequestTarget target)
{
StringValue prevValue =
RequestCycle.get().getRequest().getRequestParameters().getParameterValue("prev");
StringValue draggedrValue =
RequestCycle.get().getRequest().getRequestParameters().getParameterValue("dragged");
StringValue nextValue =
RequestCycle.get().getRequest().getRequestParameters().getParameterValue("next");

update(target, parseIndex(prevValue), parseIndex(draggedrValue),
parseIndex(nextValue));
}

protected abstract void update(AjaxRequestTarget target, Long prev,
Long dragged, Long next);

protected Long parseIndex(StringValue sv) {
if (sv.isEmpty() || sv.isNull() ||
!sv.toString().matches("[0-9]+")) {
return null;
} else {
return sv.toLongObject();
}
}


@Override
public void renderHead(Component component, IHeaderResponse response)
{
StringBuilder js = new StringBuilder();
js.append("$(function() {");
js.append("  $( '#"+component.getMarkupId()+" ul' ).sortable( {");
js.append("update: function( event, ui ) {");
js.append("  var dragged = ui.item.attr('id');");
js.append("  var prev = ui.item.prev().attr( 'id' );");
js.append("  var next = ui.item.next().attr( 'id' );");
js.append("  var callBackUrl = '"+getCallbackUrl()+"';");
js.append("  Wicket.Ajax.ajax({ u: callBackUrl, ep: {prev:
prev, dragged: dragged, next: next}});");
js.append("}");
js.append("  });");
js.append("  $( '#"+component.getMarkupId()+" ul'
).disableSelection();");
js.append("});");

response.render(OnDomReadyHeaderItem.forScript(js));
super.renderHead(component, response);
}

here is a complete example with post exactly the same only you acces the
parameters with a like that:

StringValue parameterValue =
RequestCycle.get().getRequest().getPostParameters().getParameterValue("text");

I hope that's what you wanted

2014-10-22 18:51 GMT+01:00 armandoxxx :

> Hey guys
>
> need a little help with sending array parameter value with Wicket.Ajax.post
> (wicket 6.x)...
>
>
>
> any help appreciated
>
> regards
>
> Armando
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Wicket-Ajax-post-array-parameters-tp4668041.html
> Sent from the Users forum 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
>
>


replace getRequestCycle().scheduleRequestHandlerAfterCurrent

2015-01-26 Thread Roland Dobsai
Hi we're using getRequestCycle().scheduleRequestHandlerAfterCurrent,
various places in our application which causes 500 error, is there any we
to replace, lines  below because my solution which is:
String url = RequestCycle.get().urlFor(rs).toString();
  throw new RedirectToUrlException(url);
doesn't work.

///
ResourceStreamRequestHandler rs = new ResourceStreamRequestHandler(
new StringResourceStream(work, "text/csv"));
rs.setFileName("Workdone_" +
projectModel.getObject().getName().replaceAll("[^a-zA-Z0-9]", "") + ".csv");

this.getRequestCycle().scheduleRequestHandlerAfterCurrent(rs);

or another example I was trying to replace

ResourceStreamRequestHandler rs = new ResourceStreamRequestHandler(new
FileResourceStream(new File(file.getAbsolutePath(;
  rs.setFileName(df.getFileName());
this.getRequestCycle().scheduleRequestHandlerAfterCurrent(rs);

with this, but doesnt work either:
String url = (RequestCycle.get().urlFor(rs)).toString();
   throw new RedirectToUrlException(url);

thanks for any help


Re: replace getRequestCycle().scheduleRequestHandlerAfterCurrent

2015-01-26 Thread Roland Dobsai
thanks for a replay, yes  there is an exception in a log

here's an example


HTTP Status 500 - Cannot call sendRedirect() after the response has been
committed
--

*type* Exception report

*message* *Cannot call sendRedirect() after the response has been committed*

*description* *The server encountered an internal error that prevented it
from fulfilling this request.*

*exception*

java.lang.IllegalStateException: Cannot call sendRedirect() after the
response has been committed

org.apache.catalina.connector.ResponseFacade.sendRedirect(ResponseFacade.java:482)

javax.servlet.http.HttpServletResponseWrapper.sendRedirect(HttpServletResponseWrapper.java:137)

hub.app.servlet.RelativeUrlFilter$RelativeUrlServletResponseFilter.sendRedirect(RelativeUrlFilter.java:106)

org.apache.wicket.protocol.http.servlet.ServletWebResponse.sendRedirect(ServletWebResponse.java:268)

org.apache.wicket.protocol.http.BufferedWebResponse$SendRedirectAction.invoke(BufferedWebResponse.java:400)

org.apache.wicket.protocol.http.BufferedWebResponse.writeTo(BufferedWebResponse.java:588)

org.apache.wicket.protocol.http.HeaderBufferingWebResponse.stopBuffering(HeaderBufferingWebResponse.java:60)

org.apache.wicket.protocol.http.HeaderBufferingWebResponse.flush(HeaderBufferingWebResponse.java:97)

org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:269)

org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)

org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:282)
hub.app.servlet.RelativeUrlFilter.doFilter(RelativeUrlFilter.java:54)

com.wideplay.warp.persist.PersistenceFilter$3.run(PersistenceFilter.java:141)

com.wideplay.warp.persist.internal.Lifecycles.failEarlyAndLeaveNoOneBehind(Lifecycles.java:29)

com.wideplay.warp.persist.PersistenceFilter.doFilter(PersistenceFilter.java:155)

*note* *The full stack trace of the root cause is available in the Apache
Tomcat/7.0.55 logs.*


2015-01-26 13:59 GMT+00:00 Martin Grigorov :

> Hi,
>
> Error 500 means that there must be an exception in the logs. What is it ?
>
> What exactly "doesn't work" means in your case ? Another exception, or
> no-op behavior, or ... ? Please give more details.
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Mon, Jan 26, 2015 at 3:45 PM, Roland Dobsai 
> wrote:
>
> > Hi we're using getRequestCycle().scheduleRequestHandlerAfterCurrent,
> > various places in our application which causes 500 error, is there any we
> > to replace, lines  below because my solution which is:
> > String url = RequestCycle.get().urlFor(rs).toString();
> >   throw new RedirectToUrlException(url);
> > doesn't work.
> >
> > ///
> > ResourceStreamRequestHandler rs = new ResourceStreamRequestHandler(
> > new StringResourceStream(work, "text/csv"));
> > rs.setFileName("Workdone_" +
> > projectModel.getObject().getName().replaceAll("[^a-zA-Z0-9]", "") +
> > ".csv");
> >
> > this.getRequestCycle().scheduleRequestHandlerAfterCurrent(rs);
> >
> > or another example I was trying to replace
> >
> > ResourceStreamRequestHandler rs = new ResourceStreamRequestHandler(new
> > FileResourceStream(new File(file.getAbsolutePath(;
> >   rs.setFileName(df.getFileName());
> >
>  this.getRequestCycle().scheduleRequestHandlerAfterCurrent(rs);
> >
> > with this, but doesnt work either:
> > String url = (RequestCycle.get().urlFor(rs)).toString();
> >throw new RedirectToUrlException(url);
> >
> > thanks for any help
> >
>


Re: replace getRequestCycle().scheduleRequestHandlerAfterCurrent

2015-01-26 Thread Roland Dobsai
It seems we cannot reproduce this locally - only in production. Difference
being apache is in front of tomcat. If we comment out the following code we
have no issues:


setPageRendererProvider(new IPageRendererProvider() {
@Override public PageRenderer get(final RenderPageRequestHandler
context) {
   return new WebPageRenderer(context) {
 @Override protected RedirectPolicy getRedirectPolicy()
{
   RedirectPolicy result;
if (!((WebRequest)
RequestCycle.get().getRequest()).isAjax() && (context.getPage() instanceof
ExternalShareSecurePage || context.getPage() instanceof
ExternalShareDocumentPage)) {
  result =
RedirectPolicy.NEVER_REDIRECT;
   } else {
 result = super.getRedirectPolicy();
   } return result;
  }
  };
  }
 });

2015-01-26 14:17 GMT+00:00 Martin Grigorov :

> Wicket by default buffers the write/flush of the markup to the browser
> until the end of the the request cycle.
>
> The exception says that the application has already written some
> bytes/characters to the browser and it is not possible to make a redirect,
> because the response headers are already sent.
>
> Put a breakpoint at RelativeUrlServletResponseFilter#write() methods and
> see when and why it is being called earlier.
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Mon, Jan 26, 2015 at 4:06 PM, Roland Dobsai 
> wrote:
>
> > thanks for a replay, yes  there is an exception in a log
> >
> > here's an example
> >
> >
> > HTTP Status 500 - Cannot call sendRedirect() after the response has been
> > committed
> > --
> >
> > *type* Exception report
> >
> > *message* *Cannot call sendRedirect() after the response has been
> > committed*
> >
> > *description* *The server encountered an internal error that prevented it
> > from fulfilling this request.*
> >
> > *exception*
> >
> > java.lang.IllegalStateException: Cannot call sendRedirect() after the
> > response has been committed
> >
> >
> org.apache.catalina.connector.ResponseFacade.sendRedirect(ResponseFacade.java:482)
> >
> >
> javax.servlet.http.HttpServletResponseWrapper.sendRedirect(HttpServletResponseWrapper.java:137)
> >
> >
> hub.app.servlet.RelativeUrlFilter$RelativeUrlServletResponseFilter.sendRedirect(RelativeUrlFilter.java:106)
> >
> >
> org.apache.wicket.protocol.http.servlet.ServletWebResponse.sendRedirect(ServletWebResponse.java:268)
> >
> >
> org.apache.wicket.protocol.http.BufferedWebResponse$SendRedirectAction.invoke(BufferedWebResponse.java:400)
> >
> >
> org.apache.wicket.protocol.http.BufferedWebResponse.writeTo(BufferedWebResponse.java:588)
> >
> >
> org.apache.wicket.protocol.http.HeaderBufferingWebResponse.stopBuffering(HeaderBufferingWebResponse.java:60)
> >
> >
> org.apache.wicket.protocol.http.HeaderBufferingWebResponse.flush(HeaderBufferingWebResponse.java:97)
> >
> >
> org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:269)
> >
> >
> org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
> >
> >
> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:282)
> >
> > hub.app.servlet.RelativeUrlFilter.doFilter(RelativeUrlFilter.java:54)
> >
> >
> com.wideplay.warp.persist.PersistenceFilter$3.run(PersistenceFilter.java:141)
> >
> >
> com.wideplay.warp.persist.internal.Lifecycles.failEarlyAndLeaveNoOneBehind(Lifecycles.java:29)
> >
> >
> com.wideplay.warp.persist.PersistenceFilter.doFilter(PersistenceFilter.java:155)
> >
> > *note* *The full stack trace of the root cause is available in the Apache
> > Tomcat/7.0.55 logs.*
> >
> >
> > 2015-01-26 13:59 GMT+00:00 Martin Grigorov :
> >
> > > Hi,
> > >
> > > Error 500 means that there must be an exception in the logs. What is
> it ?
> > >
> > > What exactly "doesn't work" means in your case ? Another exception, or
> > > no-op behavior, or ... ? Please give more details.
> > >
> > > Martin Grigorov
> > > Wicket Training and Consulting
> > > https://twitter.com/mtgrigorov
> > >
> > > On Mon, Jan 26, 2015 at 3:45 PM, Roland Dobsai <
> roland.dob...@gmail.com>
> > > wrote:
> > >
> > > > Hi we're u