Re: enclosure and repeater

2007-10-31 Thread Dmitry Kandalov
On Monday 29 October 2007 22:30:57 skatz wrote:
 Is there a way to get an enclosure to work with a repeater.  Perhaps I am
 missing something, but I can't get:

 ...
 ul class=someclass
 wicket:enclosure child=item
li wicket:id=repeater  /li
 /wicket:enclosure
 /ul

 to work.  What I get is an exception telling me there is no component
 matching item.

Enclosure can switch visibility depending only on one component, but repeater 
can create a lot of items. It won't work this way.

You can make enclosure use specific child component using something like 
wicket:enclosure child=repeater:markupContainer:item.

Dima

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



Re: One Page Load Producing Three GETs

2007-11-03 Thread Dmitry Kandalov
On Saturday 03 November 2007 01:27:53 Devin Venable wrote:
 I've been trying to figure out why when I hit my wicket page, it loads
 three times.  I discovered this while debugging...my constructor was
 called three times for my derived WebPage.

 I've captured the call stack produced by the three calls.  (See below)
  In my web browser I'm merely pasting the URL and pressing enter once.
   It seems I'm getting three HTTP GETs.  Stranger still, this seems to
 be Firefox specific.  IE or WGET only create on GET.  

I've seen similar thing. Most likely that is firefox requesting the page 
several times because you spend some time on breakpoints.

Dima

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



Re: Jira issue moved to the list: constructors and init of components

2007-11-03 Thread Dmitry Kandalov
On Saturday 03 November 2007 21:18:17 Brill Pappin wrote:

 This is a common Java pattern. There should be only one place in the code
 where properties are set from a constructor, all other constructors should
 pass on their parameters, defaults if required, to the one constructor that
 actually sets the properties.

IMHO it does make sense. When I see several different super(...) calls in 
constructors the first thing that crosses my mind is that these superclass 
constructors have different logic. But it's not true for wicket and in most 
Component subclasses I can call super(id, (IModel)null). Can I?

Dima

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



Re: Jira issue moved to the list: constructors and init of components

2007-11-03 Thread Dmitry Kandalov
On Sunday 04 November 2007 02:37:39 Johan Compagner wrote:

 You just should call super of the same constructor you are in.
 just give the super call everything you got. If you got a model, give it
 but you don;t have to you can set it in the constructor with setModel
 afterwards.

That's what I do. But it makes my code look like those super calls have 
different logic unless you know they are similar.

 I still don't get what this discussion is more about

I was trying to say that in my view this would be more readable.

protected WebPage(final IPageMap pageMap)
{
this(pageMap, null);
//  commonInit();
}

protected WebPage(final IPageMap pageMap, final PageParameters parameters)
{
  super(pageMap, parameters);
  commonInit();
}


 If you really want to have an init phase thats called after the constructor
 is called (and finished)
 then i think you should choose a different web framework, That uses managed
 components/pages

No, I didn't mean that. I like wicket :)

Dima

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



Re: Problem with selecting default value with DropDownChoice

2007-11-05 Thread Dmitry Kandalov
On Monday 05 November 2007 16:39:02 James Perry wrote:
 I have a problem with the DropDownChoice. More specifically, I have a
 Product class which is like:

 public class Product implements Serializable {

 private static final long serialVersionUID = 1L;

 private Manufacturer manufacturer;
 //other states

 //getters and setters

 }

 I have a form which allows to edit a product, which allows to change the
 manufacturer object with a DropDownChoice. However, an Xbox product for
 instance, it should display its Microsoft manufacturer object as selected
 but it selects 'Choose One' instead. 

May be choices and value in the DDC are different java objects and you didn't 
implement equals(), hashCode() in Manufacturer class?

Dima

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



Re: Problem with selecting default value with DropDownChoice

2007-11-05 Thread Dmitry Kandalov
On Monday 05 November 2007 18:55:07 James Perry wrote:
 Also what about wrapping the List in a PropertyModel; would that help?

 On 11/5/07, James Perry [EMAIL PROTECTED] wrote:
  Hello Dima,
 
  That was my initial assumption but I already have overrided my
  equals()/hashCode() methods for Manufacturer's business key in
  Hibernate and ensured my HQL query retrieves Manufacturer objects. Do I
  need to add an implementation of IChoiceRendered as an argument to DDC?
 
  Thanks,
  James.

I think wrapping list in PropertyModel won't help. You can add IChoiceRendered 
but it should work without it.

If you have wicket sources you can put breakpoint at 
AbstractSingleSelectChoice#getModelValue and see if object is really in the 
choices list.

Dima

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



Re: Problem with selecting default value with DropDownChoice

2007-11-05 Thread Dmitry Kandalov
On Tuesday 06 November 2007 00:55:23 James Perry wrote:
 I empirically found out what the solution was to the problem of not
 selecting the correct default choice of the Manufacturer within Product!

 I added a ChoiceRendered to the constructor of DDC and it did the trick!

It seems like equals() doesn't work correctly.

Dima

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



Re: DataView question, please help, thanks!

2007-11-08 Thread Dmitry Kandalov
On Thursday 08 November 2007 14:13:22 raybristol wrote:
 /table 

 then in code behind I use protected void populateItem(Item item) to
 specified each table cell's data, because I can put any String in td tag so
 I can easily put any javascript function call, however, I want to do that
 for each row as well, so the tr tag, such as when use click on a row,
 something happen, but I can't find where I can put this ability from the
 code behind?

You can add javascript file to the page header like this:
add(HeaderContributor.forJavaScript(MyPage.class, myscript.js));

And javascript calls like this:
add(new DataView(boxList, dataProvider)){
protected void populateItem(Item item) {
item.add(new SimpleAttributeModifier(onclick,row_clicked()));
item.add(new Label(boxID).add(new 
SimpleAttributeModifier(onclick,boxID_clicked()));
...
}
});


Dima

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



Re: Component.wrap and IChainingModel

2007-11-08 Thread Dmitry Kandalov
On Wednesday 07 November 2007 01:18:32 ChuckDeal wrote:

 SortingModel (IChainingModel) - AppendingListModel
 (IComponentAssignmentModel) - HibernateListModel (database oriented model
 that returns a list of items from the db, unsorted).

Perhaps I didn't get the explanation but why can't you wrap models in this 
order?

AppendingListModel(
SortingModel(
HibernateListModel()
)
)

 I was able to make a Model that implements IChainingModel,
 IComponentAssignmentModel, and IWrappedModel that follows the chain until
 it either encounters a IComponentAssignmentModel or exhausts the chain.  If
 it found a IComponentAssignmentModel, then it calls wrapOnAssignment and
 calls setChainedModel on the model containing the IComponentAssignmentModel
 to get it back into the hierarchy.

 It appears to be working for me now.  If you are interested, I can post the
 code.

I'd like to.


Dima

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



Re: Enable and Disable using Ajax

2007-11-09 Thread Dmitry Kandalov
On Friday 09 November 2007 11:22:20 Toscano wrote:
 Hello,

 I found some questions related to this topic, but I couldn't make it to
 work.
 I have two dropdowns, countries and regions. The easy thing is that I load
 the regions when the country has been selected, and I use
 AjaxFormComponentUpdatingBehavior for this and works.
 The thing is that we don't have Regions for all the countries, so in that
 cases I want to disable the dropdown.

 This is the code I have:


 // countryWork is the first dropdown
 countryWork.add(new AjaxFormComponentUpdatingBehavior(onchange)
 {
 protected void onUpdate(AjaxRequestTarget target)
 {target.addComponent(regionWork);}
 });

 // and regionWork is the region

  IModel regionModelChoices = new AbstractReadOnlyModel()
 {
 public Object getObject(Component component)
 {
if (professionalInfo.getCountryWork()!=null)
  regions =
 getRegionDaoInterface().getRegions(professionalInfo.getCountryWork().getCou
ntryID()); if (regions.size()==0)
regionWork.setEnabled(false);
else
regionWork.setEnabled(true);
return regions;
 }
 };

   regionWork  = new DropDownChoice(regionWork, new Model(),
 regionModelChoices,
   new ChoiceRenderer(regionName, regionID));
   regionWork.setOutputMarkupId(true);

 The dropdown changes, but with one refresh delay. For example, I have
 regions for Canada but not for Spain. If I change to Canada, nothing
 happens, but the next change in the country will enable the dropdown.

 Any ideas?

 Thank you very much for your time,
 Oskar

Probably that is because this component is already rendered.

In general you shouldn't change components state inside a model because this 
code is called at render stage. In your case you can call 
regionWork.setEnabled() inside onUpdate(AjaxRequestTarget target).


Dima

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



Re: Component.wrap and IChainingModel

2007-11-09 Thread Dmitry Kandalov
On Thursday 08 November 2007 23:28:40 ChuckDeal wrote:
  Perhaps I didn't get the explanation but why can't you wrap models in
  this order?
 
  AppendingListModel(
      SortingModel(
          HibernateListModel()
      )
  )

 In that order the list would be sorting PRIOR to appending the item, which
 could result in an unsorted list.  In the order I specified, the item would
 get appeneded and then the sort would take place.

You're right. But if you were not using List you could return SortedSet from 
SortingModel and it would work :)


Dima

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



Re: Enable and Disable using Ajax

2007-11-09 Thread Dmitry Kandalov
On Friday 09 November 2007 12:24:12 Dmitry Kandalov wrote:
 Probably that is because this component is already rendered.

I mean the component has been already checked for being enabled :)


Dima

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



bookmarkable page with one instance per session

2007-11-09 Thread Dmitry Kandalov
Hi,

I was recently wondering is there request coding strategy which would allow me 
to have one page instance of certain class per session, so after requesting 
mounted url user would always use the same page instance or a new one would 
be created if there was no instance of that class.

One of the reasons I thought about it is because I wanted very nice urls, so 
that after clicking links/ submitting forms url would remain exactly the same 
as mount. And another reason is that I wanted to be able to return to the 
page without passing its instance to another page.

Do you think such coding strategy is sensible?


I actually tried to implement it by extending 
AbstractRequestTargetUrlCodingStrategy. The idea was that I would have one 
pagemap for each mounted page and in the pagemap there would be the only 
instance of that page. Here is some naive code:

private final String pagemapName;
...
public IRequestTarget decode(RequestParameters requestParameters) {
final IPageMap pageMap = PageMap.forName(pagemapName);

// didn't find how to get the latest version of the page
if (pageMap.containsPage(0, 0)) {
final Page page = pageMap.get(0, 0);
return new PageRequestTarget(page);
} else {
// the page created by this bookmarkable target is not in the 
// pagemap pagemapName, didn't find how to put it there
return new BookmarkablePageRequestTarget(pagemapName, pageClass);
}
}


ps sorry if such strategy is already there and I just didn't understand it's 
what I want

Dima

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



Re: bookmarkable page with one instance per session

2007-11-11 Thread Dmitry Kandalov
On Saturday 10 November 2007 03:49:51 Johan Compagner wrote:
 wicket doesn't have support for these kind of pages (yet)

Does yet mean it's planned/ in progress?

 You have to implement that yourself. You could have a map of pages per
 class in your session and resolve to them. You can do that with creating
 your own IPageFactory
 Which the first looks in the current session

Thanks, Johan. I wrapped DefaultPageFactory and now everything works just as I 
wanted. I didn't really expect it would be so easy to implement :)

It's not a problem for me, but may be it would be a bit simpler if it was 
possible to do this:

return new BookmarkablePageRequestTarget(pagemapName, pageClass) {
protected Page newPage(Class pageClass, RequestCycle requestCycle) {
final Page page = super.newPage(pageClass, requestCycle);
page.setPageMap(pageMap); // can't actually do it
return page;
}
};

In this case there would be no need for IPageFactory which is aware of mounts.


Dima

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



Re: bookmarkable page with one instance per session

2007-11-11 Thread Dmitry Kandalov
On Sunday 11 November 2007 14:29:02 Dmitry Kandalov wrote:
 return new BookmarkablePageRequestTarget(pagemapName, pageClass) {
     protected Page newPage(Class pageClass, RequestCycle requestCycle) {
         final Page page = super.newPage(pageClass, requestCycle);
         page.setPageMap(pageMap); // can't actually do it
         return page;
     }
 };

 In this case there would be no need for IPageFactory which is aware of
 mounts.

Nevermind. It was a bad idea.


Dima

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



Re: bookmarkable page with one instance per session

2007-11-11 Thread Dmitry Kandalov
On Sunday 11 November 2007 14:36:10 Johan Compagner wrote:
 why do you want to move it to another pagemap? the probelm is that you
 cant do that because then the other browser instance cant find it
 anymore or that on is also changing and accessing the same page, in
 1.3 you are then better of by not using pagemaps

Sorry, I somehow didn't see your message and replied to myself. I tried to 
store pages in the pagemap so that not to depend on my session 
implementation, but you're right it doesn't work well.


Dima

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



Re: Label: Render HTML content from String

2007-11-12 Thread Dmitry Kandalov
On Monday 12 November 2007 23:40:51 Francisco Diaz Trepat - gmail wrote:
 Hi, I have a Label who's model maight come with markup for bold italic,
 bullets, etc. (e.g. bThis/b is a iMessage/i)

 Obviously I get bThis/b is a iMessage/i rendered.

 Is there a way to get the label to render:

 *This* is a *Message*

Hm.. just in case you wanted label look bold and italic you can use 
label.setEscapeModelStrings(false)


Dima

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



Re: Component.wrap and IChainingModel

2007-11-12 Thread Dmitry Kandalov
On Monday 12 November 2007 22:13:33 ChuckDeal wrote:
  You're right. But if you were not using List you could return SortedSet
  from
  SortingModel and it would work :)

 But then I'd be using a Set instead of a List.  DropDownChoice (via
 AbstractChoice) expects the choices model to represent a List.

Well, you could have yet another model that lazily wraps a Set in a List. And 
you could enhance DDC with this model to support Sets (I've always wanted DDC 
and ListView to support sets). But I admit it's quite hackish to solve your 
initial problem like that.

Dima

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



Re: PageLogic works different with Firefox and IE

2007-11-20 Thread Dmitry Kandalov
On Saturday 17 November 2007 19:15:23 Georg Sendt wrote:
 Hi,

 I have a problem with page logic works different in Firefox and IE.

 The code shows 4 buttons but only 2 are visible at the same time. There is
 a Candidate/NotCandidate-Button pair and a Observer/Not-Observer pair.

 With Firefox it works perfectly but with IE only the candidate logic is
 processed
 regardless which button you press.

 Any hints?

I also experienced that problem which seems to be a bug in IE6. If it's still 
important, I used input type=submit/ tag rather than button.../ as a 
workaround.

Dima

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



Re: mounting large number of url

2007-11-28 Thread Dmitry Kandalov
On Wednesday 28 November 2007 14:00:30 Roy van Rijn wrote:
 And second, if you want to experiment with mounting you can also make
 your own coding strategy by implementing
 IRequestTargetUrlCodingStrategy. This is pretty straight-forward and,
 I imagine, fun to do :-)

I attempted to do something like that recently though it turned out to be a 
bit more complicated. This strategy is intended to match any path found in 
DB. Do you think it is a right way to go?


private static class MyIRequestTargetUrlCodingStrategy implements 
IRequestTargetUrlCodingStrategy {
public String getMountPath() {
throw new UnsupportedOperationException();
}

public CharSequence encode(IRequestTarget requestTarget) {
throw new UnsupportedOperationException();
}

public boolean matches(IRequestTarget requestTarget) {
return false;
}

public IRequestTarget decode(RequestParameters requestParameters) {
final PageEntry entry = DB.findEntry(requestParameters.getPath());
final WebPage page = new MyPage(entry.data);
return new PageRequestTarget(page);
}

public boolean matches(String path) {
return DB.findEntry(path) != null;
}
}

private static class MyWebRequestCodingStrategy extends 
WebRequestCodingStrategy {
/**
 * Overriden because WicketFilter checks it for being null.
 */
public IRequestTargetUrlCodingStrategy urlCodingStrategyForPath(String 
path) {
if (DB.findEntry(path) != null) {
return new MyIRequestTargetUrlCodingStrategy();
}
return super.urlCodingStrategyForPath(path);
}
}

private static class MyWebRequestCycleProcessor extends 
WebRequestCycleProcessor {
public IRequestCodingStrategy getRequestCodingStrategy() {
return new MyWebRequestCodingStrategy();
}
}

@Override
protected IRequestCycleProcessor newRequestCycleProcessor() {
return new MyWebRequestCycleProcessor();
}


Dima

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



Re: the flow of wicket

2008-01-12 Thread Dmitry Kandalov
On Saturday 12 January 2008 19:56:41 Igor Vaynberg wrote:

 should we document how our xml parser works? how about how wicket
 assembles parts of markup into different markup fragments? all these
 things have no effect on you as a wicket user.

 a question for you, in what way will knowing the internal workflow of
 wicket request processing affect your programming decisions?

I mostly agree but request processing is more exposed to user than xml parser. 
I mean it's easier to came across AjaxRequestTarget, 
RequestCycle#onBegin/EndRequest() or mounting method for 
IRequestTargetUrlCodingStrategy than IXmlPullParser.

  And I really don't understand in which way this could prevent you to
  change - eventually - in future wicket versions.

 it takes away freedom. eg eelco and martijn thoroughly document this
 in their book about wicket 1.3. that means we cant change this
 significantly in at least 1.3 because we dont want leave people who
 bought the book to have the no longer valid idea. having no
 documentations for what we consider private parts allows us complete
 freedom.

IMHO it would be possible to have a chapter on the topic with warning that 
content is relevant only for specific version of Wicket and may be changed in 
the future.

  The request flow handling is one of the most important topic to know in a
  web application framework, being so I think it would be very interesting
  to have only a brief description, for example a sequence diagram showing
  the components interaction starting from the WicketFilter (and/or the
  WicketServlet) involved in a web request handling.

 Why is it so interesting? Do you know how the Valve workflow of tomcat
 works? Anyways, this has been on the wiki since October, maybe you
 guys need to learn how the search box works :)

 http://cwiki.apache.org/confluence/display/WICKET/Wicket+inside

I'm changing it and at the moment it doesn't have some of the pictures. 
They'll be there with text updates in a couple of days.


Dima

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



Re: the flow of wicket

2008-01-12 Thread Dmitry Kandalov
On Saturday 12 January 2008 23:25:43 Igor Vaynberg wrote:
 sure, and all you need to know is that you subclass
 requestcycle.onbeginrequest() and add your own code there and it is
 called at the beginning of the request. why do you need to know the
 sequence of calls that leads to onbeginrequest() being called?

I don't. I can image someone may want to be sure that this method is called 
before anything else he overrides, or to know that he can't get requested 
page at this step, but probably it's a very rare case.

Though creating things like IRequestTargetUrlCodingStrategy requires knowledge 
about targets and request processor.

On the whole I think it's the matter of knowing the big picture and not using 
framework as a black box. I don't mean everyone should do it.


Dima

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



Re: the flow of wicket

2008-01-13 Thread Dmitry Kandalov
On Sunday 13 January 2008 04:19:30 Igor Vaynberg wrote:
 Ok, so rarely you need to roll your own
 IRequestTargetUrlCodingStrategy, we do provide implementations to
 cover most common cases. And even if you do, you only need to know
 about IRequestTarget - which has good javadoc, and so does the coding
 strategy. You dont need to know anything about the
 irequestcycleprocessor, in fact it might even go away at a later
 release.

May be it's just me but I didn't get how to use 
IRequestTargetUrlCodingStrategy after reading javadocs (I don't say they're 
bad). Though you're right request processor is not that important in this 
case, probably WebRequestCodingStrategy is.

Anyway if you do something not very straightforward it may be quite useful to 
know at least something about the context in which your code is called. 
Coming back to onBeginRequest() I think it's not obvious to user whether he 
can use in it application, request, response or session object unless he 
knows workflow.

If request cycle processor goes away I'm sure you'll do it right. I liked the 
way wicket changed from 1.2 to 1.3.


Dima

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



Re: the flow of wicket

2008-01-13 Thread Dmitry Kandalov
On Sunday 13 January 2008 12:47:44 Dmitry Kandalov wrote:
 On Sunday 13 January 2008 04:19:30 Igor Vaynberg wrote:
  Ok, so rarely you need to roll your own
  IRequestTargetUrlCodingStrategy, we do provide implementations to
  cover most common cases. And even if you do, you only need to know
  about IRequestTarget - which has good javadoc, and so does the coding
  strategy. You dont need to know anything about the
  irequestcycleprocessor, in fact it might even go away at a later
  release.

 If request cycle processor goes away I'm sure you'll do it right. I liked
 the way wicket changed from 1.2 to 1.3.

Ah.. sorry it wasn't relevant to what you said.

Dima

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



[OT] Re: How to handle Runtime Exception in wicket?

2008-01-17 Thread Dmitry Kandalov
On Wednesday 16 January 2008 22:40:52 Hoover, William wrote:
 In your WebApplication...

 getApplicationSettings().setPageExpiredErrorPage(PageExpiredErrorPage.class
); getApplicationSettings().setAccessDeniedPage(AccessDeniedPage.class);
 getApplicationSettings().setInternalErrorPage(InternalErrorPage.class);

 // show internal error page rather than default developer page
 getExceptionSettings().setUnexpectedExceptionDisplay(IExceptionSettings.SHO
W_INTERNAL_ERROR_PAGE);

 http://cwiki.apache.org/confluence/x/FyMB

Just in case you didn't see there is similar entry here 
http://cwiki.apache.org/confluence/display/WICKET/FAQs


Dima

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



Re: Reusable component and customization

2008-01-23 Thread Dmitry Kandalov
On Wednesday 23 January 2008 11:47:26 Martijn Lindhout wrote:
 users need to open the jar, pick the right markup file, copy it, changes
 css attributes, etc. That's not what I expect from component reuse, right?
 Or do I miss something?

The other option is to create overridable methods which provide styling. Like 
FeedbackPanel#getCSSClass() or BaseTree#getCSS().

Dima

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



Re: Reusable component and customization

2008-01-23 Thread Dmitry Kandalov
On Wednesday 23 January 2008 12:55:17 Martijn Lindhout wrote:
 I like that one with the ResourceReference. What about providing a setter
 on the component, so that no subclassing is needed?

IMO setter or constructor parameter should be ok, though Wicket classes use 
getters (probably to reduce session size?).

Dima

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



Re: Delaying AutoCompleteTextField by n characters?

2008-02-08 Thread Dmitry Kandalov
On Tuesday 05 February 2008 23:16:03 Igor Vaynberg wrote:
 wicket has a throttle which works on time not on number of
 characthers, for that you need to roll your own javascript

How can I roll my javascript which doesn't use ajax before n characters for 
AutoCompleteTextField? I could only do it by copying three classes from 
extensions :(


Dima

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



Re: Autocomplete on a modal window

2008-02-08 Thread Dmitry Kandalov


Cristi Manole wrote:
 
 thank you both for your answers, but there are still problems...
 
 I already tried what Don suggested, but that only allows for the
 autocomplete text to be displayed correctly in IE, but not in FF (at
 least not in 2.0.0.9).
 
 I really cannot figure out why.
 

I had very similar problem. I solved it by cleaning FF cache every time I
changed javascript (Edit-Preference-Network-Clean Now).
-- 
View this message in context: 
http://www.nabble.com/Autocomplete-on-a-modal-window-tp13662912p15354234.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: Feedback on proposed Groovy DSL syntax for Wicket

2008-03-07 Thread Dmitry Kandalov
On Thursday 06 March 2008 18:59:59 graemer wrote:
 So as some of you may know I've been updating the Grails Wicket plug-in.

I didn't know but I tried the plug-in a couple of weeks ago (with help of your 
blog) and it worked fine expect that I couldn't make wicket classes reload. I 
should look at the updated version ;)

 There is quite a few users on the Grails list who have shown interest in it
 and the ability to use a component framework backed onto the rest of the
 Grails stack (GORM, transactional services, plugin system etc.)

 However, the plugin provides a very basic level of integration and I was
 thinking it would be nice to create a Groovy DSL for Wicket. I looked into
 the WicketBuilder, but really I think we can take this further. So based on
 the example here:
 http://www.theserverside.com/tt/articles/article.tss?l=IntroducingApacheWic
ket

 I came up with the below syntax to represent this application (note i
 havent actually implemented anything yet this is just a syntax proposal).
 Thoughts/feedback/suggestions welcome:

I also looked a while ago at the WicketBuilder, Kevin Galligan blog and 
discussion at wicket and groovy mailing lists.

As I understand there are two major problems with using groovy and wicket:
 - groovy doesn't have anonymous classes but they are used a lot in wicket;
 - if you somehow substitute anonymous classes with closures (what seems to be 
the most sane way), groovy's closures are not serializable but components in 
wicket must be serializable.

So IMHO the main purpose of creating a builder (actually it doesn't have to be 
a builder) would be in the first place to solve the above problems.

From what I remember from the WicketBuilder sources to solve the problems 
WicketBuilder:
 - generates groovy class (as text) which implements/overrides methods, then 
builder add closures calls to this methods.
 - stores the class of the closure (class is serializable :)) and when the 
closure needs to be called, builder creates new instance of the class and 
execute it. The consequence is that closures cannot reference local 
variables.

Some time ago I myself created a small builder to try groovy out and see how 
useful nice syntax can be. To solve the above problems I:
 - manually created subclasses for some basic wicket classes, added closures 
calls in implemented methods and added setters for these closures. (I know 
manual subclassing is lame, but it was the simplest thing I could 
do.)
 - created closure wrapper which is serializable and can serialize closure 
casting all its properties to Serializable. This way closures can reference 
page's local variables. It works fine for my simple use cases, though it 
might be not a very good solution.


 [skipped]

 Contact.findByNameLike(%${params.searchString}%) }  as
 LoadableDetachableModel

 [skipped]

 view  label(lastName, new PropertyModel(item.model,
 lastName))
 item  view
             item  link(edit, item.model) {
                 onClick {
                     redirect page:new EditContact(model.id)
                 }
             }

 [skipped]

If I got it right, the main difference compared to WicketBuilder is that you 
put event handlers like onClick in a closure where child components are 
added. I like the idea, it seems to be more readable than adding closures as 
attributes to the builder method. I also like the idea of using , IMHO 
it's a bit easier to notice in the code than add.


What I did in my humble builder is more weird, because I added component id to 
the builder methods names. It looks like this (it's working code from 
test):

builder.build {
myLabel()
myLink(onClick: this.callback) {
my2Label()
}
myForm(onSubmit: this.callback) {
anotherLabel()
myButton(onSubmit: this.callback)
myList([1,2,3], onItem: {})
}
}

I used here link to instance method (this.callback) because I didn't like 
putting callback code in the builder hierarchy.


The next idea was that it would be ugly to put all the configuration into 
builder, so after calling the builder it's possible to access components 
without declaring local variables (it only works on a groovy specific page):

builder.build {...}
myLabel.visible = false
myLabel.markupId = myLabelMarkupId


Another idea is that there should _not_ be any builders since components 
hierarchy is already declared in markup files. In this case components could 
be created like that (it's also working code from test):

public PageWithImplicitLabel() {
// creating label by calling non-existent method
myLabel(label text)
// accessing label by name
myLabel.markupId = myLabelMarkupId
}

Component hierarchy could be built at the end of the constructor with static 
call like that:

public PageWithImplicitLabel() {
...
HierarchyBuilder.build(this); // reads markup, rearranges components
}

I've also created very basic HierarchyBuilder. I wonder if someone really use 
something 

Re: Status of Wicket and Groovy?

2008-06-08 Thread Dmitry Kandalov
On Saturday 07 June 2008 22:09:02 Ashley Aitken wrote:
 So my question is: what is the status (now and going forward) with  
 regards to using Groovy to develop with Wicket?  I know there has been  
 much discussion of generifying Wicket but perhaps moving to a dynamic  
 language could be an alternative future.

 Of course, using Groovy with Wicket wouldn't require the framework  
 itself to be implemented in Groovy or even that everyone uses Groovy.  
 And, as you all probably know Groovy can easily call an Java class  
 library.

I like the idea of using groovy and in general using dynamic language would be 
interesting indeed. But I think you might be not 100% correct about using 
groovy as it is. The main problem in my view is the lack of anonymous classes 
in groovy which are widely used by wicket.

I wrote a little bit more about it a while ago here 
http://www.nabble.com/Feedback-on-proposed-Groovy-DSL-syntax-for-Wicket-tt15873183.html

 So what do people think about Groovy and Wicket?

IMHO they cannot be easily used together at the moment.


Dima

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



Re: Status of Wicket and Groovy?

2008-06-09 Thread Dmitry Kandalov
On Monday 09 June 2008 10:47:45 Eelco Hillenius wrote:
  IMHO they cannot be easily used together at the moment.

 Hmmm, interesting. My only experience with Groovy is years ago, and
 back then we abandoned and switched to PNuts (which I guess should
 work with Wicket as well) due to Groovy's immaturity back then.

 Dima, are these problems hard to overcome in your opinion? And did you
 look at other dynamic languages with Wicket by any chance?

I wouldn't say the problems are hard but they are not easy either. When I 
attempted to implement some kind of my own wicketbuilder, the problems boiled 
down to making closures serializable and creating wrappers for wicket classes 
to make them use closures instead of anonymous classes. Unfortunately I 
switched from it to other things.

I haven't looked at other dynamic languages. May be I should try jruby.


Dima

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