Re: VOTE: Generics of IDataProvider

2008-04-29 Thread Kent Tong

[ ] IDataProvider
[x] Iterator> , drop model
[ ] Leave as is.

Leaving it as is just doesn't make sense as it doesn't support the use case
on hand.

Using IDataProvider is OK too. For those whose I == T, we can always
have a convenient base class:

abstract class ModelProvider implements IDataProvider {
  IModel model(T object) {
return object;
  }
}

Iterator> will make the interface simpler. For those who
need to wrap domain objects as models, we can provide a wrapper
iterator:

abstract class ModelWrapperIterator implements Iterator {
  ModelWrapperIterator(Iterator source) {
...
  }
  abstract IModel map(T sourceElement);
}



-----
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: 
http://www.nabble.com/VOTE%3A-Generics-of-IDataProvider-tp16871723p16957615.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-03 Thread Kent Tong

   [x] Can best be done in a limited fashion, where we only generify
IModel but not components.
   [x] Whatever choice ultimately made, I'll happily convert/ start
using 1.4 and up.

I basically agree to what Igor says on this issue.


-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
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-tp17589984p17618364.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]



"required" for Checkbox

2008-01-07 Thread Kent Tong

Hi,

I observed that if "required" is set to true for a Checkbox, Wicket will
ensure that the Checkbox is checked. If it is cleared by the user, it
will be treated as an error. See 
https://issues.apache.org/jira/browse/WICKET-1221 and
https://issues.apache.org/jira/browse/WICKET-1260 for some
background.

For me, "required" means that a value must be provided. For a 
check box, if it is checked, it has a value of true. if it is unchecked, it 
has a value of false. So it always satisfy "required". Treating "required" 
as "having a value of true" doesn't sound correct to me.

If we consider the error message that should be used, for the case of
forcing the user to check the box (eg, [x] I have read the agreement), 
it should say "you must check xxx", which is quite different from the 
error message for "required": "you must provide xxx".

For the use case of forcing a checked check box, I think an CheckedValidator 
should be used, which can provide a much better default error message.

Not that it's an important, but just to see what others think.

-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: 
http://www.nabble.com/%22required%22-for-Checkbox-tp14662131p14662131.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: "required" for Checkbox

2008-01-07 Thread Kent Tong



Dan Kaplan-3 wrote:
> 
> But another way to look at it is this: When a checkbox is unchecked, it
> has
> a value of "unchecked".  Therefore, if you setRequired=true on a checkbox,
> it's always satisfied.  In otherwords, a checkbox always has a value so
> setRequired=true has no effect on a checkbox.  
> 

Yeah, that's exactly the correct behavior in my mind.


-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: 
http://www.nabble.com/%22required%22-for-Checkbox-tp14662131p14680214.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: Helloworld Application cant be started

2008-01-23 Thread Kent Tong


gbak1 wrote:
> 
> Im a newbie and am having problems with the helloworld example.
> I have created an ant script to create an application WAR and I can deploy
> this WAR to tomcat (running on fedora7).
> After deploy, Tomcat fails to start the application and displays the
> following message: FAIL - Application at context path
> /HelloWorldApplication could not be started.
> This only occurs when I include the filter tags which I copied and pasted
> from the example and which I modified to suit my own helloworld
> application.
> Im now down to guessing and hope someone can point me in the right
> direction.
> 

Most likely you're missing some jars. Wicket needs some jars not included in
the
distribution. You may follow my tutorial to get started (see my signature
for
the URL).


-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: 
http://www.nabble.com/Helloworld-Application-cant-be-started-tp15039388p15056909.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: Accessing prototype scoped panel beans using @SpringBean annotation

2008-02-22 Thread Kent Tong


Ned Collyer wrote:
> 
> There are a few ways to approach this, ie, having some class loader which
> resolves given string "class references", and those strings are wired in
> through spring.  This works - but feels a bit hacky.
> 

I don't know why you feel this hacky. It looks clean and easy to me:

public class TestPage extends WebPage {
@SpringBean(name = "config")
private Config config;

public TestPage() {
add(PanelFactory.getPanel(config, "testPanelOne"));
}
}

public class PanelFactory {
public static Panel getPanel(Config config, String id) {
Class c =
Class.forName(config.getPanelClass()).asSubclass(Panel.class);
Constructor constructor = 
c.getConstructor(String.class);
return constructor.newInstance(id);
}
}



-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: 
http://www.nabble.com/Accessing-prototype-scoped-panel-beans-using-%40SpringBean-annotation-tp15627974p15648766.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: Accessing prototype scoped panel beans using @SpringBean annotation

2008-02-23 Thread Kent Tong


Ned Collyer wrote:
> 
> Spring is meant to be the factory :).  Isn't that a big part of why we use
> Spring?
> 
> Incidently there is a Classes class that has some handy "cached" stuff for
> resolving class references.
> see org.apache.wicket.util.lang.Classes
> 

You can certain make the PanelFactory a spring bean:

public class TestPage extends WebPage {
@SpringBean(name = "panelFactory")
private PanelFactory panelFactory;

public TestPage() {
add(panelFactory.getPanel("testPanelOne"));
}

}


myapp.TestPanel







The Wicket Classes class is not meant for performance. Normal classloaders
probable 
provide better caching support. It was introduced to fix concurrency
problems.


-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: 
http://www.nabble.com/Accessing-prototype-scoped-panel-beans-using-%40SpringBean-annotation-tp15627974p15651407.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: Wicket LinkTree subtree collapse/expand

2008-02-23 Thread Kent Tong


Sebastiaan van Erk wrote:
> 
> Ok, thanks for the quick reply. :-)
> 
> https://issues.apache.org/jira/browse/WICKET-1366
> 

I've added some comments to it. For a workaround, try:

tree = new LinkTree("t", model) {
protected Component newNodeComponent(String id, IModel model) {
return new LinkIconPanel(id, model, this) {
protected void onNodeLinkClicked(TreeNode node,
BaseTree tree, AjaxRequestTarget 
target) {
tree.getTreeState().selectNode(node,

!tree.getTreeState().isNodeSelected(node));
onClicked(node, tree, target);
}
protected Component newContentComponent(String 
componentId,
BaseTree tree, IModel model) {
return new Label(componentId, 
getNodeTextModel(model));
}
};
}

protected void onClicked(TreeNode node, BaseTree tree,
AjaxRequestTarget target) {
if (!node.isLeaf()) {
if (tree.getTreeState().isNodeExpanded(node)) {
collapseAll(node);
} else {
expandAll(node);
}
tree.updateTree(target);
} else {
System.out.println(Arrays
.toString(((DefaultMutableTreeNode) 
node)
.getUserObjectPath()));
    }
}
};



-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: 
http://www.nabble.com/Wicket-LinkTree-subtree-collapse-expand-tp15639680p15651849.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: Custom validation message for 'int'?

2008-02-23 Thread Kent Tong


florin.g wrote:
> 
> I cannot seem to find a way to provide a custom validation message for
> 'int'. (I learned for most others).
> fieldName.int does not work
> fieldName.Integer does not work
> fieldName.Number does not work
> 

fieldName.int


-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: 
http://www.nabble.com/Custom-validation-message-for-%27int%27--tp15651406p15652093.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: Custom validation message for 'int'?

2008-02-23 Thread Kent Tong


florin.g wrote:
> 
> I cannot seem to find a way to provide a custom validation message for
> 'int'. (I learned for most others).
> fieldName.int does not work
> fieldName.Integer does not work
> fieldName.Number does not work
> 

fieldName.int is the one to use. Make sure you have reloaded your app.
Otherwise, post 
your code.

-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: 
http://www.nabble.com/Custom-validation-message-for-%27int%27--tp15651406p15652102.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: AjaxFormSubmitBehavior and setDefaultFormProcessing(false)?

2008-02-23 Thread Kent Tong


Juha Alatalo wrote:
> 
> In this case I have to visit different page when browse is chosen. When 
> I come back form is cleared, isn't it?
> 

Have you tried just clearing the feedback messages?

-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: 
http://www.nabble.com/AjaxFormSubmitBehavior-and-setDefaultFormProcessing%28false%29--tp15609891p15652225.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: Wicket as a front controller ?

2008-02-23 Thread Kent Tong


smallufo wrote:
> 
> I have a normal wicket webapp , but I need one "endpoint" to process
> Yahoo's
> bbAuth's request.
> Yes , I can write normal servlet to process this , but normal servlet
> lacks
> of spring injection and cannot access to wicket's environment.
> 

Have you tried using a bookmarkabke page as the endpoint? Something like
http://foo.com/MyApp/app/?wicket:bookmarkablePage=:com.foo.MyApp.MyPage


-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: 
http://www.nabble.com/Wicket-as-a-front-controller---tp15656646p15660420.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: Howto use .xhtml instead of .html for template file extension

2008-02-23 Thread Kent Tong


MYoung wrote:
> 
> Firefox wants to download the file instead of showing the page.
>  http://www.nabble.com/file/p15641885/no-go-xhtml.jpg 
> 
> IE7 cannot even download the file.
> 

The mime type Wicket returns to the browser is text/. In
your case it's text/xhtml which is not correct. Instead, one should use 
application/xhtml+xml or text/html. The problem is that IE doesn't support
XHTML at all, so you have to use text/html and let all browsers treat the
response as html, not xhtml.

Wicket could be enhanced to differentiate between the template file
extension and the mime type.

For your case, try below as a workaround (or simply name your files
as *.html):

public class MyPage extends WebPage {
public String getMarkupType() {
return "xhtml";
}
protected void configureResponse() {
super.configureResponse();
getResponse().setContentType("text/html");
}
}


-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: 
http://www.nabble.com/Howto-use-.xhtml-instead-of-.html-for-template-file-extension-tp15641885p15660676.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: Wicket as a front controller ?

2008-02-24 Thread Kent Tong


smallufo wrote:
> 
> Thank you , but I want a (bookmarkable) page without HTML
> Is it possible ?
> 

What do you want to output?

-----
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: 
http://www.nabble.com/Wicket-as-a-front-controller---tp15656646p15664148.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: Wicket as a front controller ?

2008-02-25 Thread Kent Tong
smallufo  gmail.com> writes:

> I just need to redirect.
> If bbAuth token is correct , then set correct Wicket Session and redirect to
> proper page.
> If incorrect , then redirect to another page.

To redirect, try:

public class P1 extends WebPage {
@Override
protected void onBeforeRender() {
super.onBeforeRender();
throw new RestartResponseException(P2.class);
    }

}
--
Kent Tong
Wicket book with free chapters at http://www.agileskills2.org/EWDW



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



Re: Small shared resource question...

2008-02-27 Thread Kent Tong


Sebastiaan van Erk wrote:
> 
> In my web page with the resource link I do the following:
> 
>   fragment.add(new ResourceLink("cvEnglishLink", new 
> ResourceReference("cvs_en.pdf")) {
>   @Override
>   public boolean isVisible() {
>   return "en".equals(getLocale().getLanguage());
>   }
>   });
> 

Try:

public class P1 extends WebPage {
public P1() {
ResourceReference resourceRef = new 
ResourceReference("cvs.pdf") {
protected Resource newResource() {
return new PDFResource(getLocale());
}
};
resourceRef.setLocale(getLocale()); //THIS IS THE LINE
ResourceLink link = new ResourceLink("link", resourceRef);
add(link);
}
}



-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: 
http://www.nabble.com/Re%3A-Small-shared-resource-question...-tp15663443p15714682.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: Small shared resource question...

2008-02-27 Thread Kent Tong


Sebastiaan van Erk wrote:
> 
> As far as I can tell, there's still only 1 resource, which has the 
> locale of the page (at creation time).
> 

Every time the page is rendered, it will generate a different variant of
the resource reference due to the setLocale() call.


Sebastiaan van Erk wrote:
> 
> But I have a link on the page which allows you to change the locale. 
> This link is stateful, so it just calls the callback on the current page 
> and sets the locale.
> 

No problem. If the link is a normal link (not ajax), you'll render the
page again and thus will have a new resource reference. If it's
ajax, you need to put the setLocale() call into a callback and
refresh the link.


-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: 
http://www.nabble.com/Re%3A-Small-shared-resource-question...-tp15663443p15727184.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: Small shared resource question...

2008-02-28 Thread Kent Tong

Try:

public class P1 extends WebPage {
private ResourceReference resourceRef;

static {
WebApplication app = (WebApplication) Application.get();
mount(app, Locale.ENGLISH);
mount(app, Locale.CHINESE);
}

private static void mount(WebApplication app, Locale locale) {
ResourceReference resourceRef = makeResourceReference();
resourceRef.setLocale(locale);
app.mountSharedResource("/download/cvs_" + locale + ".pdf", 
resourceRef
.getSharedResourceKey());
}

@Override
protected void onBeforeRender() {
super.onBeforeRender();
resourceRef.setLocale(getLocale());
}

public P1() {
resourceRef = makeResourceReference();
ResourceLink link = new ResourceLink("link", resourceRef);
add(link);
Link changeLocale = new Link("changeLocale") {
private int n = 0;

@Override
public void onClick() {
n++;
Locale newLocale = (n % 2 == 0) ? Locale.ENGLISH
: Locale.CHINESE;
getSession().setLocale(newLocale);
}
};
add(changeLocale);
}

private static ResourceReference makeResourceReference() {
return new ResourceReference("cvs.pdf") {
@Override
protected Resource newResource() {
return new PDFResource(getLocale());
}
};
}

}
public class PDFResource extends DynamicWebResource {

public PDFResource(Locale locale) {
super(locale);
}

@Override
protected ResourceState getResourceState() {
ResourceState state = new ResourceState() {

@Override
public byte[] getData() {
return readPDF();
}

@Override
public String getContentType() {
return "application/pdf";
}

};
return state;
}

protected byte[] readPDF() {
try {
File f = new File("c:/tmp/cvs_"+getLocale()+".pdf");
FileInputStream s = new FileInputStream(f);
byte[] content = new byte[(int) f.length()];
s.read(content);
s.close();
return content;
} catch (IOException e) {
    throw new RuntimeException(e);
}
}

}


-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: 
http://www.nabble.com/Re%3A-Small-shared-resource-question...-tp15663443p15737491.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: Testing (Ajax)TabbedPanel

2008-02-29 Thread Kent Tong


Sven Schliesing wrote:
> 
> This works quite good. But I'm having problems with using too much 
> "internal knowledge" (e.g. the tabs-container id) of the AjaxTabbedPanel.
> 

You can always create your own TabPanelTester that may have a getTab(id) 
method. This class will encapsulate the internal knowledge.


-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: 
http://www.nabble.com/Testing-%28Ajax%29TabbedPanel-tp15739429p15772312.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: Wicket Wizard form need to add custom validation to each panel

2008-02-29 Thread Kent Tong


AshleyAbraham wrote:
> 
>I am working on a wicket wizard component, I am trying to add an
> AbstractFormValidation to each wizardStep, so when the wizardStep is
> added/replaced the wizard form will know how to custom validate that
> particular wizardStep.
> 

Why not add the form validator to the wizard step? It has an add() method
exactly
for this purpose.


-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: 
http://www.nabble.com/Wicket-Wizard-form-need-to-add-custom-validation-to-each-panel-tp15746917p15772387.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: Page markup caching

2008-02-29 Thread Kent Tong


hbf wrote:
> 
> Has anybody implemented page caching for Wicket? If possible, I'd  
> like to store the markup of a page in ehcache so that subsequent requests
> can be
> served without invoking the rendering mechanism of the framework at all.
> 

You may try overriding the onRender() method in the Page class in
your own page class to retrieve the cached output.

However, I really don't think this is necessary as Wicket pages involves
no compilation of any kind like OGNL, the render time should be quite
consistent.


-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context: 
http://www.nabble.com/Page-markup-caching-tp15734416p15772444.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: Append anchor to form redirect URL?

2007-09-04 Thread Kent Tong


Jeremy Thomerson-3 wrote:
> 
> Is there a way to append an anchor to the URL generated for the
> SubmitLink?
> 

Try:

form.add(new AttributeModifier("action", null) {
protected String newValue(String currentValue,
String replacementValue) {
return currentValue + "#myanchor";
}
});


-- 
View this message in context: 
http://www.nabble.com/Append-anchor-to-form-redirect-URL--tf4369650.html#a12475266
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: FeedbackPanel + Link problem

2007-09-05 Thread Kent Tong



fero wrote:
> 
> I found what was wrong but I can not explain it
> 
> In markup of LabelLink I had
> 
>   
> 
> 
> When I changed "button" tags to "a" it was working, but I want my links to
> look like buttons
> 
> 
> 
> 
> 
> 

I tried using a button and it works fine. Here is my code (using v1.3
beta2):

LabelLink.html:




LabelLink.java: same as yours.

Test.html:









Test.java:
public class Test extends WebPage {
public Test() {
add(new FeedbackPanel("fb"));
Form form = new Form("form");
add(form);
form.add(new LabelLink("ll", new Model("hello")) {

@Override
public void onClick() {
error("error!");
}

});
}
}



-- 
View this message in context: 
http://www.nabble.com/FeedbackPanel-%2B-Link-problem-tf4380134.html#a12494894
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: AjaxFallbackLink inside ListView

2007-09-06 Thread Kent Tong



pokkie wrote:
> 
> My question is, how do I use this information to get the selected entity
> which represents a row in my listView? 
> 

Try:

public class Test extends WebPage {

public Test() {
List list = Arrays.asList(new String[] { "a", "b", "c" 
});
ListView eachItem = new ListView("eachItem", list) {
@Override
protected void populateItem(ListItem item) {
item.add(new IndicatingAjaxFallbackLink("link") 
{
@Override
public void onClick(AjaxRequestTarget 
target) {

handleClick(getParent().getModelObjectAsString());
}

});
}
};
add(eachItem);
}

private void handleClick(String clickedItem) {
System.out.println(clickedItem);
}
}
-- 
View this message in context: 
http://www.nabble.com/AjaxFallbackLink-inside-ListView-tf4389622.html#a12520727
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: AjaxFallbackLink inside ListView

2007-09-06 Thread Kent Tong



pokkie wrote:
> 
> Worked like a charm, thanks Kent. 
> 
> You the same Kent Tong that wrote a online Tapestry book?
> 

Yep.
-- 
View this message in context: 
http://www.nabble.com/AjaxFallbackLink-inside-ListView-tf4389622.html#a12534270
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: CompressedResourceReference: cannot serve static ".html"-files but ".htm"-files [SOLVED but needs JAVADOC comments]

2007-09-08 Thread Kent Tong


pixotec wrote:
> 
> YOU GUESS WHAT?!!
> I JUST RENAMED THE FILE TO "dialogTable.htm" AND NOW IT IS WORKING!!
> it is the fact of not being able to serve "html"-files!
> 
> I think this fact should be documented in the JAVADOC of the
> Resource-classes!
> 

Just upgrade to the latest v1.3 beta and this problem will be gone.

-- 
View this message in context: 
http://www.nabble.com/CompressedResourceReference%3A-cannot-serve-static-%22.html%22-files-but-%22.htm%22-files--SOLVED-but-needs-JAVADOC-comments--tf4403564.html#a12567319
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: Calling all translators - UrlValidator translation

2007-09-08 Thread Kent Tong



Alastair Maw-2 wrote:
> 
> The English in question is:
> '${input}' is not a valid URL.
> 

The Traditional Chinese (zh_TW) version is:

UrlValidator='${input}'\u4e0d\u662f\u4e00\u500b\u5408\u6cd5\u7684URL\u3002

The Simplified Chinese (zh_CN) version is:

UrlValidator='${input}'\u4e0d\u662f\u4e00\u4e2a\u5408\u6cd5\u7684URL\u3002

-- 
View this message in context: 
http://www.nabble.com/Calling-all-translators---UrlValidator-translation-tf4401987.html#a12569613
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: Using Include and placing pages under WEB-INF

2007-09-08 Thread Kent Tong


Jason Mihalick wrote:
> 
> However, if I try to move my pages under WEB-INF, wicket has a problem
> loading resources that are bound via the
> org.apache.wicket.markup.html.include.Include class.  In my case, I have
> several static pages that I want to load dynamically which are located in
> my 'help/' directory (see above). 
> 

Try:
File context = new
File(((WebApplication)getApplication()).getServletContext().getRealPath("/"));
File file = new File(context, "WEB-INF/help/Topic1.html");
Include i = new Include("i", file.toURL().toString());

-- 
View this message in context: 
http://www.nabble.com/Using-Include-and-placing-pages-under-WEB-INF-tf4403861.html#a12569783
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: AjaxRequestTarget null... in onClick of AjaxFallbackLink

2007-09-08 Thread Kent Tong



John Carlson-5 wrote:
> 
> I get the following error output in the console when I click on the link
> on the actual page...
> 
> INFO  - uestTargetResolverStrategy - component not enabled or visible,
> redirecting to calling page, component: null
> 

It probably means the your container which contains the link is invisible
when 
the request arrives. Try posting your code.
-- 
View this message in context: 
http://www.nabble.com/AjaxRequestTarget-null...-in-onClick-of-AjaxFallbackLink-tf4404402.html#a12570006
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 force a delete (from disk) of the session from the session store?

2007-09-08 Thread Kent Tong



Chris Lintz wrote:
> 
> Hi,
> When a user logouts of the site, i want to kill the session and have it be
> removed from disk immediately.  I have extended WebSession properly, but
> no methods on the WebSession class seem to do the trick for me.
> 
> Is there a way to to trigger the removal of the session cleanly from disk
> via the SessionStore or some other approach?
> 

I think this is done automatically when you call session.invalidate().
-- 
View this message in context: 
http://www.nabble.com/How-to-force-a-delete-%28from-disk%29-of-the-session-from-the-session-store--tf4404925.html#a12570175
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: Two small questions

2007-09-08 Thread Kent Tong



Sebastiaan van Erk wrote:
> 
> Ok, to answer my own question, it seems that ExternalLink does not have 
> the ability to be disabled like Link.
> 

Looks like a bug to me. I'd suggest that you submit a JIRA issue at
http://issues.apache.org/jira/browse/WICKET
-- 
View this message in context: 
http://www.nabble.com/Two-small-questions-tf4404428.html#a12570244
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: Using Include and placing pages under WEB-INF

2007-09-08 Thread Kent Tong



Jason Mihalick wrote:
> 
> Thank you for the suggestion.  This looks like it ought to work fine for
> exploded WARs, but it seems like it would be a problem when then app is
> deployed in a WAR.  Is there any way to do this that will work when the
> app is deployed in a WAR archive?  Or is there perhaps another wicket
> component that I should be using that won't require me to create a
> companion Java class for each help snippet?
> 

Try:

URL url = ((WebApplication)
getApplication()).getServletContext().getResource("/WEB-INF/help/topic1.html");
add(new Include("i", url.toString()));

-- 
View this message in context: 
http://www.nabble.com/Using-Include-and-placing-pages-under-WEB-INF-tf4403861.html#a12576037
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: Using Include and placing pages under WEB-INF

2007-09-08 Thread Kent Tong


Thanks, yes, my solution was close to this, but I opted instead to subclass
the Include class.  I think the solution that you propose below may cause
wicket to create an absolute URL to the HTML files under the WEB-INF dir
which will be inaccessible by the browser. /quote>

No. The URL is never sent to the browser. In fact, logically your code is
exactly the same as mine.
-- 
View this message in context: 
http://www.nabble.com/Using-Include-and-placing-pages-under-WEB-INF-tf4403861.html#a12576120
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: Adding an image in imageMap?

2007-09-08 Thread Kent Tong



bhupat parmar wrote:
> 
> hi
> i have to add an iamge in my ImageMap.RectangleLink which is not
> predefined
> THE IMAGE IS  LOADED from database?
> 

You can try using an AttributeModifier to modify the "src" attribute of the  
tag. You can
subclass ResourceReference to load the image from your DB and call
urlFor(ref) to get the URL.
-- 
View this message in context: 
http://www.nabble.com/Adding-an-image-in-imageMap--tf4392221.html#a12576166
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: Wicket Validation Error

2007-09-08 Thread Kent Tong



spencer.c wrote:
> 
> StringValidator.maximum=${label} must be no longer than ${maximum}
> characters.
> sendForm.senderField.Required=You must provide your email address to
> proceed.
> 

Try:
sendForm.senderField.StringValidator.maximum=${label} must be no longer than
${maximum} characters.
sendForm.senderField.Required=You must provide your email address to
proceed.

-- 
View this message in context: 
http://www.nabble.com/Wicket-Validation-Error-tf4386270.html#a12576183
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 Kent Tong


Kevin Liu-4 wrote:
> 
>   Unable to find component with id 'userName' in [MarkupContainer
> [Component id = _relative_path_prefix_14, page =
> com.cmip.web.pages.TopFrame, path =
> 3:topForm:_relative_path_prefix_13:_relative_path_prefix_14.WebMarkupContainer,
> isVisible = true, isVersioned = true]]. This means that you declared
> wicket:id=userName in your markup, but that you either did not add the
> component to your page at all, or that the hierarchy does not match.
> 

Please file a bug report at http://issues.apache.org/jira/browse/WICKET. The
bug is, 
RelativePathPrefixHandler creates auto-components but are not marking them
as
transparent resolver:

public boolean resolve(MarkupContainer container, MarkupStream
markupStream, ComponentTag tag)
{
if 
(WICKET_RELATIVE_PATH_PREFIX_CONTAINER_ID.equals(tag.getId()))
{
final Component wc;
String id = WICKET_RELATIVE_PATH_PREFIX_CONTAINER_ID +
container.getPage().getAutoIndex();
if (tag.isOpenClose())
{
wc = new WebComponent(id);
}
else
{
//problem:
wc = new WebMarkupContainer(id);
//I think it should be:
//wc = new TransparentWebMarkupContainer(id);
}
container.autoAdd(wc, markupStream);
return true;
}
return false;
}


-- 
View this message in context: 
http://www.nabble.com/How-to-handle-these-nested-%3Ctable%3E-tags-tf4412208.html#a12595047
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: Wicket Web Beans 1.0-rc1 Released

2007-09-12 Thread Kent Tong

Hi Dan,

It looks very powerful! BTW, why chose to use a config file (beanprops)
instead of Java code?
I think doing in Java for everything other than the standard web stuff
(HTML/CSS/js) is a 
basic principle of Wicket.

-- 
View this message in context: 
http://www.nabble.com/Re%3A-Wicket-Web-Beans-1.0-rc1-Released-tf4431603.html#a12647439
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: compressing resources which are not in the classpath

2007-09-15 Thread Kent Tong



Andrew Klochkov wrote:
> 
> Hi!
> 
> How to compress  resources (css, java scripts) which are lying not in 
> the classpath but in /css and /js in the webapp context folder? How can 
> I create a CompressedResourceReference to such a resource?
> 

Try:

public class MyApp extends WebApplication {
protected void init() {
getSharedResources().add(
"r1",
new CompressingWebResource(new 
ContextRelativeResource(
"/css/f1.css")));
mountSharedResource("foo", "org.apache.wicket.Application/r1");
}
}

public class CompressingWebResource extends WebResource {
private abstract class CompressingResourceStream implements 
IResourceStream
{
private static final long serialVersionUID = 1L;
/** Cache for compressed data */
private SoftReference cache = new SoftReference(null);
/** Timestamp of the cache */
private Time timeStamp = null;

/**
 * @see org.apache.wicket.util.resource.IResourceStream#close()
 */
public void close() throws IOException {
}
/**
 * @see 
org.apache.wicket.util.resource.IResourceStream#getContentType()
 */
public String getContentType() {
return getOriginalResourceStream().getContentType();
}
/**
 * @see 
org.apache.wicket.util.resource.IResourceStream#getInputStream()
 */
public InputStream getInputStream()
throws ResourceStreamNotFoundException {
if (supportsCompression()) {
return new 
ByteArrayInputStream(getCompressedContent());
} else {
return 
getOriginalResourceStream().getInputStream();
}
}
/**
 * @see 
org.apache.wicket.util.resource.IResourceStream#getLocale()
 */
public Locale getLocale() {
return getOriginalResourceStream().getLocale();
}
/**
 * @see 
org.apache.wicket.util.watch.IModifiable#lastModifiedTime()
 */
public Time lastModifiedTime() {
return getOriginalResourceStream().lastModifiedTime();
}
/**
 * @see org.apache.wicket.util.resource.IResourceStream#length()
 */
public long length() {
if (supportsCompression()) {
return getCompressedContent().length;
} else {
return getOriginalResourceStream().length();
}
}
/**
 * @see
org.apache.wicket.util.resource.IResourceStream#setLocale(java.util.Locale)
 */
public void setLocale(Locale locale) {
getOriginalResourceStream().setLocale(locale);
}
/**
 * @return compressed content
 */
private byte[] getCompressedContent() {
IResourceStream stream = getOriginalResourceStream();
try {
byte ret[] = (byte[]) cache.get();
if (ret != null && timeStamp != null) {
if 
(timeStamp.equals(stream.lastModifiedTime())) {
return ret;
}
}
ByteArrayOutputStream out = new 
ByteArrayOutputStream();
GZIPOutputStream zout = new 
GZIPOutputStream(out);
Streams.copy(stream.getInputStream(), zout);
zout.close();
stream.close();
ret = out.toByteArray();
timeStamp = stream.lastModifiedTime();
cache = new SoftReference(ret);
return ret;
} catch (IOException e) {
throw new RuntimeException(e);
} catch (ResourceStreamNotFoundException e) {
throw new RuntimeException(e);
}
}
protected abstract IResourceStream getOriginalResourceStream();
}

private final WebResource wrappedResource;
   

Re: wicket doesn't show its debugging?

2007-09-15 Thread Kent Tong


Potje rode kool wrote:
> 
> I used the log config files from the wicket example that comes with wicket
> (apache-wicket-1.3.0-beta3) and set it to debug.
> 
> Any idea what I am missing to see the debugging of Wicket for the
> org.apache.wicket.util.resource package?
> 

Are you sure you're using the log4j.properties in wicket-example? I think
you might be using the one generated by the quickstart archetype which
is using the old package name:

log4j.logger.wicket=INFO
log4j.logger.wicket.protocol.http.HttpSessionStore=INFO
log4j.logger.wicket.version=INFO
log4j.logger.wicket.RequestCycle=INFO

For your purpose you should add a line:

log4j.logger.org.apache.wicket.util.resource=DEBUG

-- 
View this message in context: 
http://www.nabble.com/wicket-doesn%27t-show-its-debugging--tf734.html#a12696493
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: Question With Detachable Models

2007-09-15 Thread Kent Tong


Jonathan Locke wrote:
> 
> Your QueryDetachableModel will break under clustering.  The transient
> "instance" Object will become null when the container deserializes it and
> your load method will be unable to reload the object.  
> 
> If you're using these QueryDetachableModels, yes, the object instance is
> being stored in your session.  But no, it will not be replicated
> correctly.
> 

Are you sure about that? If the default item reuse strategy is used, new
models and new items will 
be created just before the page is rendered.

In addition, as the object instance is marked as transient, it shouldn't be
stored in the session.
-- 
View this message in context: 
http://www.nabble.com/Question-With-Detachable-Models-tf4446686.html#a12696767
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: Question With Detachable Models

2007-09-16 Thread Kent Tong


carloc wrote:
> 
> Somehow, it seems that transient objects are stored in the session.
> WHen I try to look at the session in eclipse's debug mode, 
> I can actually see my User object in there even though I marked as
> transient.
> 

Yeah, it is in there because it hasn't been serialized and deserialized.

-- 
View this message in context: 
http://www.nabble.com/Question-With-Detachable-Models-tf4446686.html#a12697263
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: Number of available parameters in IndexedParamUrlCodingStrategy

2007-09-16 Thread Kent Tong



james yong wrote:
> 
> I am using IndexedParamUrlCodingStrategy. Is there is a good way to check
> the number of available parameters? Currently i have to use
> getString("0"), getString("1") etc. to check for null before I arrived at
> the size of the available parameters.
> 

Have you tried:

  PageParameters pp;
  ...
  pp.size();

-- 
View this message in context: 
http://www.nabble.com/Number-of-available-parameters-in-IndexedParamUrlCodingStrategy-tf4436939.html#a12697314
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: Question With Detachable Models

2007-09-16 Thread Kent Tong



Kent Tong wrote:
> 
> Yeah, it is in there because it hasn't been serialized and deserialized.
> 

If your code was like:

public class QueryDetachableModel extends LoadableDetachableModel {
public QueryDetachableModel(Object instance) {
super(instance);
}
protected Object load() {
return null;
}
} 

then your obj should no longer be in the session.
-- 
View this message in context: 
http://www.nabble.com/Question-With-Detachable-Models-tf4446686.html#a12697331
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: compressing resources which are not in the classpath

2007-09-17 Thread Kent Tong


Andrew Klochkov wrote:
> 
> Wow, Kent, thanks a lot for the code!!
> 
> I wonder shouldn't something like this be in the framework core?
> 

I simply adapted the code from the CompressedPackageResource.

As reusable components should have their resources bundled with 
them in the classpath, CompressedPackageResource should be enough 
for most people. If they really need to compress context resources,
one may use the container to do that (eg, for Tomcat, see
http://bravedave.wordpress.com/2007/03/22/data-compression-in-tomcat).

-- 
View this message in context: 
http://www.nabble.com/compressing-resources-which-are-not-in-the-classpath-tf4441543.html#a12732734
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: Question about use Palette with DropDownChoice

2007-09-17 Thread Kent Tong


JohnSmith333 wrote:
> 
> I have use a Palette with DropDownChoice. I want to  change the
> DropDownChoice's selected value and then update the Palette's lists. And
> when I click the Palette's value ,I hope to save the change result.
> But it's not work normally. Could anyone kind to help me? Thanks! 
> 

Your code contains quite a lot of bugs. Try this instead:

public class PaletteChoice extends WebPage implements Serializable {
private static final long serialVersionUID = 1L;
private Form form;
private DropDownChoice choice;
private Palette palette;
private Map mainMap = new HashMap();
private String mainChoice;
private Map availibleMap;
private Map selectedMap;

public PaletteChoice() {
availibleMap = new HashMap();
selectedMap = new HashMap();
// data
mainMap.put("A", "0");
mainMap.put("B", "1");
Set mainKeySet = mainMap.keySet();
Iterator it = mainKeySet.iterator();
while (it.hasNext()) {
Object ok = it.next();
ArrayList availibleList = new ArrayList();
for (int i = 0; i < 5; i++) {
availibleList.add(String.valueOf(ok) + i);
}
availibleMap.put(ok, availibleList);
List selectedList = new ArrayList();
selectedMap.put(ok, selectedList);
}
List mainList = new ArrayList();
Set tmpSet = mainMap.keySet();
Iterator tmpIt = tmpSet.iterator();
while (tmpIt.hasNext()) {
mainList.add((Serializable) tmpIt.next());
}
form = new Form("form", new CompoundPropertyModel(this));
form.setOutputMarkupId(true);
add(form);
choice = new DropDownChoice("mainChoice", mainList) {
protected void onSelectionChanged(java.lang.Object 
newSelection) {
}
protected boolean wantOnSelectionChangedNotifications() 
{
return true;
}
};
choice.setOutputMarkupId(true);
form.add(choice);
palette = new Palette("palette",
new PropertyModel(this, "selectedList"), new 
PropertyModel(
this, "availibleList"), new 
ChoiceRenderer("toString",
"toString"), 10, false);
palette.setOutputMarkupId(true);
palette.getRecorderComponent().add(
new AjaxFormSubmitBehavior(form, "onchange") {
protected void 
onSubmit(AjaxRequestTarget target) {
target.addComponent(form);
}
});
form.add(palette);
}
public List getAvailibleList() {
return mainMap.containsKey(mainChoice) ? (List) availibleMap
.get(mainChoice) : Collections.EMPTY_LIST;
}
public void setAvailibleList(List availibleList) {
if (mainMap.containsKey(mainChoice)) {
availibleMap.put(mainChoice, availibleList);
}
}
public List getSelectedList() {
return mainMap.containsKey(mainChoice) ? (List) selectedMap
.get(mainChoice) : Collections.EMPTY_LIST;
}
public void setSelectedList(List selectedList) {
if (mainMap.containsKey(mainChoice)) {
selectedMap.put(mainChoice, selectedList);
}
}
public String getMainChoice() {
return mainChoice;
}
public void setMainChoice(String mainChoice) {
this.mainChoice = mainChoice;
}
}

-- 
View this message in context: 
http://www.nabble.com/Question-about-use-Palette-with-DropDownChoice-tf4447817.html#a12738225
Sent from the Wicket - User mailing list archive at Nabble.com.


Re: Question about use Palette with DropDownChoice

2007-09-17 Thread Kent Tong



Helo! Kent  Thanks for your help.
But I still have the same question.
That's if I choice A with select A1 to selectedList and then choice B with
selected nothing to selectedList.
It's ok when I choice A again and see the A1 at selectedList.
But if I choice A with select A1 to selectedList and then choice B with
selected anything (ex:B1) to selectedList. Then when I choice A again ,there
will see that A1 not at selectedList.
So I choice before would be disappear! Why? I have any idea yet!


Have you actually tried my code? I did and it works as you described above.
-- 
View this message in context: 
http://www.nabble.com/Question-about-use-Palette-with-DropDownChoice-tf4447817.html#a12748126
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: Question about use Palette with DropDownChoice

2007-09-17 Thread Kent Tong


Yes,sir. I have run the code more three times before.
Maybe it's because I run the code with wicket 1.2.6 and
wicket-extensions-1.2.6 and jdk 1.4.12.
Really I don't know what happen! Thank's your help again. Thanks!


Then try using 1.3 beta3.
-- 
View this message in context: 
http://www.nabble.com/Question-about-use-Palette-with-DropDownChoice-tf4447817.html#a12748565
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: Testing wicket 1.3

2007-09-18 Thread Kent Tong



Nino.Martinez wrote:
> 
> I was wondering how I should be testing with wicket. I've created the 
> bbcodecomponent, I have a bbcodeLabel. And I would like to write a test 
> for that. I can see that I can't use the assertLabel as that just gets 
> modelObjectToString, in the bbcodeLabel some formatting are done during 
> onComponentTagBody. Is this completely wrong, how should testing be 
> done? I can see that the dateLabel uses an approach with converters, 
> although im not sure how this are done. But are this more propper?
> 

try something like:

WicketTester tester = new WicketTester();
tester.startPage(Home.class);
tester.assertContains("foo");

-- 
View this message in context: 
http://www.nabble.com/Re%3A-Testing-wicket-1.3-tf4469190.html#a12758401
Sent from the Wicket - User mailing list archive at Nabble.com.


Re: Setting focus to a TextField

2007-09-21 Thread Kent Tong



Doug Leeper wrote:
> 
> I know this is probably one of the most trivial things to do...but I am
> stumped.  No example that I found on the Wicket example site has shown
> this.  I know that AjaxRequestTarget#focusComponent plays a part in this
> but not sure how.  Could someone post a quick code snippet or place on the
> Wiki on how do to this in 1.3?
> Thanks
> 

For example, your TextField is f1, then:


AjaxLink link = new AjaxLink("link") {
public void onClick(AjaxRequestTarget target) {
target.addComponent(...);
target.focusComponent(f1);
}
};

-- 
View this message in context: 
http://www.nabble.com/Setting-focus-to-a-TextField-tf4490766.html#a12814170
Sent from the Wicket - User mailing list archive at Nabble.com.


Re: How to add RadioGroup column to DataTable?

2007-09-21 Thread Kent Tong



igor.vaynberg wrote:
> 
> heh, "there is something wrong" doesnt really give me any context to help
> you :)
> 
> i would guess you need to put the radiogroup around the entire datatable.
> 

At least make sure there is a form component enclosing the RadioGroup.

-- 
View this message in context: 
http://www.nabble.com/How-to-add-RadioGroup-column-to-DataTable--tf4485992.html#a12814262
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: CheckGroup form submission bug

2007-09-21 Thread Kent Tong


Nick Busey wrote:
> 
> So I've got what appears to be a very strange bug. I have a CheckGroup
> with a ListView of Checks among other things. Everything seems to work
> fine if you render the form and submit it without any errors the first
> time. However, if you hit any errors (like not selecting any Checks), and
> are bounced back to the form with an error rendered, if you select a Check
> and re-submit it, it dies with the following error:
> 

I can't reproduce this behavior. My code seems to work fine. Try it.




-- 
View this message in context: 
http://www.nabble.com/CheckGroup-form-submission-bug-tf4489122.html#a12832939
Sent from the Wicket - User mailing list archive at Nabble.com.


Re: Ajax Problem on Page with IFRAME

2007-09-21 Thread Kent Tong


SantiagoA wrote:
> 
> One of them has an IFrame.
> If this TabbedPanel is active, then the onUpdate-Methode of the
> InputFields won´t be reached.
> Is one of the TabbedPanels without an IFrame active, everything works
> fine.
> This happens that way for IE and Firefox.
> 

It works fine for me. Try my code:

Home page:



MyPanel:



FramedPage:



-- 
View this message in context: 
http://www.nabble.com/Ajax-Problem-on-Page-with-IFRAME-tf4487902.html#a12833344
Sent from the Wicket - User mailing list archive at Nabble.com.


Re: Versioning Problems With DataTable, Spring Hibernate

2007-09-21 Thread Kent Tong


carloc wrote:
> 
> public CCTIDetachableModel extends Loadable DetachableModel {
> 
> private String id;
> private Integer version;
> private Dao dao;
> 
> public Object load() {
> MyObject myobj = dao.get(id);
> if (version == null) {
>   version = myobj.getVersion();
> }
> else  if (!myobject.getVersion().equals(version)) {
>   throw new MyVersionMismatchException(MyObject.class, id, version);
> }
> 
> return myobj;
>   }
> }
> 

The code shouldn't compile as "myobject" is undefined:

... if (!myobject.getVersion().equals(version)) {

-- 
View this message in context: 
http://www.nabble.com/Versioning-Problems-With-DataTable%2C-Spring-Hibernate-tf4484198.html#a12833349
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: Custom AjaxFormSubmitBehavior

2007-09-21 Thread Kent Tong


NateBot2000 wrote:
> 
> I created an extension of AjaxSubmitLink that accepts a static html form
> id string as an argument (AjaxFormSubmitBehavior forces setOutputMarkupId
> on the Form by default).  In so doing, I extended
> AjaxFormSubmitBehavior... and then I add this custom behavior to my custom
> AjaxSubmitLink.  
> 
> My question is: what is the proper way of removing / overriding the old
> AjaxFormSubmitBehavior that's added by the parent class?  I am currently
> doing a MarkupContainer.removeAll() on the link before I add my custom
> behavior (this seems to work fine), but that seems wrong and potentially
> dangerous.
> 

Why not just extend AbstractSubmitLink and add your behavior to it?
-- 
View this message in context: 
http://www.nabble.com/Custom-AjaxFormSubmitBehavior-tf4481784.html#a12833535
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: Can't access Javascript/CSS when in servletMode

2007-09-21 Thread Kent Tong


Adam Koch wrote:
> 
> In fact, I couldn't get the JS/CSS in any way when using the servlet. I
> tried putting the JS in my app.war in these directories:
> / (root)
> /classes/com/.../someJS.js
> /WEB-INF/classes/com/.../someJS.js (same directory as Class and html)
> 

Are you mapping the Wicket servlet to root? Try mapping it to something else
like /app.
-- 
View this message in context: 
http://www.nabble.com/Can%27t-access-Javascript-CSS-when-in-servletMode-tf4481265.html#a12833582
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: Howto handle exceptions?

2007-09-22 Thread Kent Tong


Newgro wrote:
> 
> is there a wicket way for handling exceptions? I call my beans from my 
> controller which manages the wicket-view (Panel, Page ...). Some
> exceptions i 
> want to handle in the controller. But sometimes there are NPEs or IAEs. I 
> would like to send them all to an error page, but without handling the 
> exception. Is wicket presenting automatically a not handled exception?
> 

This is done automatically in deployment mode. In development mode, you can
enable it like:

public class MyApp extends WebApplication {
protected void init() {
getExceptionSettings().setUnexpectedExceptionDisplay(
IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE);
}
}

This will display wicket's internal error page. If you need to provide your
own
page, try:

getApplicationSettings().setInternalErrorPage(MyErrorPage.class);

-- 
View this message in context: 
http://www.nabble.com/Howto-handle-exceptions--tf4498352.html#a12834389
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: ExternalLink documentation enhancement

2007-09-22 Thread Kent Tong


Chris Colman wrote:
> 
> I would have thought that an external link without any protocol prefix
> should always default to an absolute link to an http:// page and not a
> relative link from the current page. Being an external link, by
> definition, it could never be a relative link from the current page I
> wouldn't think.
> 

You can indeed use a relative url without a scheme such as:

   //foo.com/bar.html 

then it will mean http://foo.com/bar.html if the current url uses the 
http scheme. It can't force you to use http though as you may
want mailto or https or something else.
-- 
View this message in context: 
http://www.nabble.com/Stripping-Javascript-comments-breaks-application-tf4478522.html#a12834564
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: Ajax Problem on Page with IFRAME

2007-09-22 Thread Kent Tong


Martijn Dashorst wrote:
> 
> I think you need to resend again, this time escaping the markup. It
> seems like nabble have changed something in their interface, as this
> is a recurring theme lately.
> 

No problem.

Home:





public class Home extends WebPage {
public Home() {
List tabs = new ArrayList();
tabs.add(new AbstractTab(new Model("tab1")) {
public Panel getPanel(String panelId) {
return new MyPanel(panelId);
}
});
TabbedPanel tabPanel = new TabbedPanel("tabPanel", tabs);
add(tabPanel);
}
}

MyPanel:



public class MyPanel extends Panel {

public MyPanel(String id) {
super(id);
WebComponent iframe = new WebComponent("iframe");
iframe.add(new AttributeModifier("src", true, new 
AbstractReadOnlyModel()
{
public Object getObject() {
return urlFor(FramedPage.class, null);
}
}));
add(iframe);
}
}

FramedPage:








public class FramedPage extends WebPage {
private String foo = "";
private TextField f2;

public FramedPage() {
Form form = new Form("form");
add(form);
TextField f1 = new TextField("f1", new PropertyModel(this, 
"foo"));
f2 = new TextField("f2",
new PropertyModel(this, 
"capitalFoo"));
f2.setOutputMarkupId(true);
form.add(f1);
form.add(f2);
f1.add(new OnChangeAjaxBehavior() {
protected void onUpdate(AjaxRequestTarget target) {
target.addComponent(f2);
}
});
}
public String getCapitalFoo() {
return foo.toUpperCase();
}
public void setCapitalFoo(String capitalFoo) {
foo = capitalFoo.toLowerCase();
}
}

-- 
View this message in context: 
http://www.nabble.com/Ajax-Problem-on-Page-with-IFRAME-tf4487902.html#a12834657
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: LinkTree lazy loading possible?

2007-09-22 Thread Kent Tong


pixotec wrote:
> 
> I want to use LinkTree to represent a very very large hierarchy (the
> loading of the whole thing is expensive...).
> Is there an AJAX way of loading the children of a node just when clicking
> on the "plus-icon" for expanding?
> 

You may try my code below which seems to work, even though it's not using
ajax:


public class TreePage extends WebPage {
private DefaultTreeModel treeModel;
private TreeChildrenProvider provider;

private class MyTreeNode extends DefaultMutableTreeNode {
public MyTreeNode(String nodeName) {
super(nodeName);
}
public String getName() {
return (String) getUserObject();
}
public boolean isLeaf() {
return provider.getChildren(getName()).isEmpty();
}
}

public TreePage() {
provider = makeMockProvider();
MyTreeNode a = new MyTreeNode("a");
treeModel = new DefaultTreeModel(a);
LinkTree tree = new LinkTree("tree", new PropertyModel(this,
"treeModel"));
add(tree);
ITreeState treeState = tree.getTreeState();
treeState.collapseAll();
treeState.addTreeStateListener(new ITreeStateListener() {
public void nodeUnselected(TreeNode node) {
}
public void nodeSelected(TreeNode node) {
}
public void nodeExpanded(TreeNode node) {
if (!node.isLeaf() && node.getChildCount() == 
0) {
MyTreeNode myTreeNode = ((MyTreeNode) 
node);
for (String childName : 
provider.getChildren(myTreeNode
.getName())) {
myTreeNode.add(new 
MyTreeNode(childName));
}
}
}
public void nodeCollapsed(TreeNode node) {
}
public void allNodesExpanded() {
}
public void allNodesCollapsed() {
}
});
}
private TreeChildrenProvider makeMockProvider() {
return new TreeChildrenProvider() {
public List getChildren(String nodeName) {
if (nodeName.equals("a")) {
return Arrays.asList(new String[] { 
"b", "c" });
}
if (nodeName.equals("b")) {
return Arrays.asList(new String[] { 
"d", "e" });
}
return Collections.EMPTY_LIST;
}
};
}
public DefaultTreeModel getTreeModel() {
return treeModel;
}
}

public interface TreeChildrenProvider {
List getChildren(String nodeName);
}

-- 
View this message in context: 
http://www.nabble.com/LinkTree-lazy-loading-possible--tf4493231.html#a12842551
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Label associated with an open/close tag

2007-09-23 Thread Kent Tong

Hi,

I think this is one of the most common gotcha's in Wicket: a Label
associated with 
an open/close tag like  will silently output nothing. As I really can't
think of 
a use case when this behavior is the desired behavior (wanting the Label to
output
nothing?), I'd suggest that either it changes it to , or simply throw 
an exception or log a warning.
-- 
View this message in context: 
http://www.nabble.com/Label-associated-with-an-open-close-tag-tf4506567.html#a12852634
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: Label associated with an open/close tag

2007-09-24 Thread Kent Tong


Gwyn wrote:
> 
> Please raise an issue - https://issues.apache.org/jira/browse/WICKET
> Feel free to have a go at a patch, as that'll help it's chances of
> getting done!
> 

Done (https://issues.apache.org/jira/browse/WICKET-1004). No time to make a
patch though...
-- 
View this message in context: 
http://www.nabble.com/Label-associated-with-an-open-close-tag-tf4506567.html#a12861556
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: Ajax Problem on Page with IFRAME

2007-09-24 Thread Kent Tong


SantiagoA wrote:
> 
> Sorry, doesn´t work for me either.
> 
> The Problem is, that the refreshing in the "main"-page does not work, if
> the particular Panel is active.
> The inputs and the ajax are nested in the main page, the panel shows a
> "readonly" Iframe with no inputs.
> 

Sorry that I don't understand what you're saying. Please state the precise
steps you're 
performing, the expected result and the actual result.

-- 
View this message in context: 
http://www.nabble.com/Ajax-Problem-on-Page-with-IFRAME-tf4487902.html#a12861635
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: Ajax Problem on Page with IFRAME

2007-09-25 Thread Kent Tong


SantiagoA wrote:
> 
> I have a mainpage with some inputfields with ajax in, a submitbutton and a
> TabbePanel with three panels.
> The panels are for output only.
> one of the panels holds an Iframe.
> 
> But if the panel with the Iframe is active, means the Tab for the panel
> was clicked, none of the ajax above works anymore. With this panel active
> an input/change in the mainpage seems to be not recognized. the
> onUpdate(AjaxRequestTarget target)-methode of a component of the mainpage
> is not reached, like the debugger shows me.
> 

I tried it and it works fine. Are you using 1.3 beta3? Try my code as
attached. http://www.nabble.com/file/p12893436/Home.html Home.html 
http://www.nabble.com/file/p12893436/Home.java Home.java 
http://www.nabble.com/file/p12893436/MyPanel1.html MyPanel1.html 
http://www.nabble.com/file/p12893436/MyPanel1.java MyPanel1.java 
http://www.nabble.com/file/p12893436/MyPanel2.html MyPanel2.html 
http://www.nabble.com/file/p12893436/MyPanel2.java MyPanel2.java 
http://www.nabble.com/file/p12893436/FramedPage.html FramedPage.html 
http://www.nabble.com/file/p12893436/FramedPage.java FramedPage.java 
-- 
View this message in context: 
http://www.nabble.com/Ajax-Problem-on-Page-with-IFRAME-tf4487902.html#a12893436
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: Need combo to determine action but validation fails

2007-09-25 Thread Kent Tong


Francisco Diaz Trepat - gmail wrote:
> 
> What it is happening is that because of some fields are invalid (Empty) I
> cannot get to the selected option of the DropDownChoice, and by that
> change
> part of the form.
> 

Try:

private void showHideDetailsOnForm(AjaxRequestTarget target) {
cDetailsChoices.processInput();
...
}
-- 
View this message in context: 
http://www.nabble.com/Need-combo-to-determine-action-but-validation-fails-tf4511066.html#a12893753
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: Can't access Javascript/CSS when in servletMode

2007-09-26 Thread Kent Tong


Adam Koch wrote:
> 
> It is mapped to an app and not to the root. The directories I listed
> are in the war file, but I tried to access them with
> http://localhost/myapp/ ... 
> 

Then I'd suggest you:
1) deploy your app in Tomcat to see if it works.
2) file a jira issue and upload a bare minimal app showing the problem.

-- 
View this message in context: 
http://www.nabble.com/Can%27t-access-Javascript-CSS-when-in-servletMode-tf4481265.html#a12913394
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: substitute same value in several places

2007-09-28 Thread Kent Tong


Peter Dotchev wrote:
> 
> I'd like to use the same value in several places of a page, e.g. two
> labels with same content.
> Let's say I want to substitute the same property using
> CompoundPropertyModel.
> 

Try:

public class Home extends WebPage {
private String l1 = "abc";

public Home() {
setModel(new CompoundPropertyModel(this));
Label l1 = new Label("l1");
add(l1);
Label l2 = new Label("l2", l1.getModel());
add(l2);
}
}
-- 
View this message in context: 
http://www.nabble.com/substitute-same-value-in-several-places-tf4530268.html#a12951473
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: Reach into a component to change XML attribute

2007-09-28 Thread Kent Tong


Sam Hough wrote:
> 
> In my ignorance it seems tough to make that work the second time if the
> list has changed. It is also less pretty as the only extension points I
> have are renderIterator and renderChild. I can think of nasty hacks like
> using IdentityHashMap to hold onto Components I've already added an
> AttributeAppender (the HTML monkey is class happy) to...
> 

Try using a modifier like this:
private static class BoundHighlighter extends AttributeModifier {
private Component owner;

public BoundHighlighter() {
super("class", true, null);
}
protected String newValue(String currentValue, String 
replacementValue) {
int idx = getItemIndex();
return idx == 0 ? "first" : (idx == getItemCount() - 1 
? "last"
: null);
}
public void bind(Component component) {
super.bind(component);
this.owner = component;
}
private int getItemIndex() {
return getItem().getIndex();
}
private Item getItem() {
Component parent = owner.getParent();
while (!(parent instanceof Item)) {
parent = parent.getParent();
}
return (Item) parent;
}
private int getItemCount() {
return getItem().getParent().size();
}
}

The code below uses it for a Label contained in a repeater Item:

public Home() {
RefreshingView view = new RefreshingView("view") {
protected Iterator getItemModels() {
List models = new ArrayList();
int n = 2+new Random().nextInt(10);
for (int i = 0; i < n; i++) {
models.add(new Model(i));
}
return models.iterator();
}
protected void populateItem(Item item) {
item.add(new Label("label", item.getModel())
.add(new BoundHighlighter()));
}
};
add(view);
}
-- 
View this message in context: 
http://www.nabble.com/Reach-into-a-component-to-change-XML-attribute-tf4527906.html#a12951781
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: DataTable question

2007-09-28 Thread Kent Tong


cblehman wrote:
> 
> It looks like they insert default classes "headers" "even" and "odd"
> into the table header and rows, but I was wondering if there is an easy
> way for me to either set a property or create a subclass so that I can
> use my own class names rather than these defaults?
> 

Try:

public class MyDataTable extends DataTable {
public MyDataTable(String id, IColumn[] columns,
ISortableDataProvider dataProvider, int rowsPerPage) {
super(id, columns, dataProvider, rowsPerPage);
addTopToolbar(new NavigationToolbar(this));
addTopToolbar(new MyHeadersToolbar(this, dataProvider));
addBottomToolbar(new NoRecordsToolbar(this));
}
protected Item newRowItem(String id, int index, IModel model) {
Item item = super.newRowItem(id, index, model);
item.add(new AttributeModifier("class", true, new Model(
index % 2 == 0 ? "myEven" : "myOdd")));
return item;
}
}

public class MyHeadersToolbar extends HeadersToolbar {
public MyHeadersToolbar(DataTable table, ISortStateLocator 
stateLocator) {
super(table, stateLocator);
}
}

MyHeadersToolbar.html:




[header-label]



-- 
View this message in context: 
http://www.nabble.com/DataTable-question-tf4535291.html#a12951941
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: RefreshingView example broken

2007-09-28 Thread Kent Tong



Nick Busey wrote:
> 
> Hey, I'm trying to use a RefreshingView, but can't figure it out. On top
> of that, the examples are broken: 
> http://wicketstuff.org/wicket13/repeater/?wicket:bookmarkablePage=%3Aorg.apache.wicket.examples.repeater.RefreshingPage
> http://wicketstuff.org/wicket13/repeater/?wicket:bookmarkablePage=%3Aorg.apache.wicket.examples.repeater.RefreshingPage
> .
> 
> Can someone either fix that example or point me to another example? 
> 

A quick example:

public Home() {
RefreshingView view = new RefreshingView("view") {
protected Iterator getItemModels() {
List models = new
ArrayList();
int n = new Random().nextInt(10);
for (int i = 0; i < n; i++) {
models.add(new Model(i));
}
return models.iterator();
}
protected void populateItem(Item item) {
item.add(new Label("label",
item.getModel()));
}
};
add(view);
}

-- 
View this message in context: 
http://www.nabble.com/RefreshingView-example-broken-tf4536092.html#a12951981
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: Reach into a component to change XML attribute

2007-09-29 Thread Kent Tong


Sam Hough wrote:
> 
> I'm full of cold so probably being very thick but that doesn't work for
> RepeatingView does it as it implies notification of objects being attached
> to a parent :(  It looks very clever but I'm not having one of those "god
> that is so simple why didn't I think of that" moments... Have you been
> following the "remove final for add, remove, removeAll" etc thread? Seems
> like I could do a simple (if ugly) and efficient version that those
> changes. To add to the horror I've got my own add(int i, Component c)
> method , that igor didn't like, that I want to honour.
> 

The code below seems to work for a RepeatingView. Of course it is a hack as
it depends on the
order in which the children are visited. However, it doesn't depend on
notification of objects
being attached to the parent. The bind() method is called when the behavior
is added to the
component.

public class Home extends WebPage {
private static class BoundHighlighter extends AttributeModifier {
private Component owner;

public BoundHighlighter() {
super("class", true, null);
}
protected String newValue(String currentValue, String 
replacementValue) {
int idx = getItemIndex();
return idx == 0 ? "first" : (idx == getItemCount() - 1 
? "last"
: null);
}
public void bind(Component component) {
super.bind(component);
this.owner = component;
}
private int getItemIndex() {
final int[] idx = { -1 };
Object result = owner.getParent().visitChildren(new 
IVisitor() {
public Object component(Component component) {
idx[0]++;
return component == owner ? idx[0]
: 
CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER;
}
});
return (Integer) result;
}
private int getItemCount() {
return owner.getParent().size();
}
}

public Home() {
RepeatingView view = new RepeatingView("view");
view.add(new Label("x", "a").add(new BoundHighlighter()));
view.add(new Label("y", "b").add(new BoundHighlighter()));
view.add(new Label("z", "c").add(new BoundHighlighter()));
view.add(new Label("t", "d").add(new BoundHighlighter()));
add(view);
}
}
-- 
View this message in context: 
http://www.nabble.com/Reach-into-a-component-to-change-XML-attribute-tf4527906.html#a12961809
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: Reach into a component to change XML attribute

2007-09-30 Thread Kent Tong


Sam Hough wrote:
> 
> Your still breaking my requirement that this behaviour is encapsulated
> within MyFancyRepeatingView ;) I really do appreciate all your code and I
> think I'm learning a lot even if I sound horribly ungrateful. I'm warming
> to every child component having a special behaviour object. Although it
> seems expensive does show nice encapsulation.
> 
> How about MyFancyRepeatingView has a singleton behaviour object that it
> checks is attached to all its children (should be quick as identity
> operation - in childIterator). Requires only single instance for whole
> application... I might be able to convince the HTML monkey that he only
> needs class="first" so I don't need to iterate through all the siblings.
> 

Then add the behaviors in onBeforeRender():

public class MyRepeatingView extends RepeatingView {
public MyRepeatingView(String id) {
super(id);
}
protected void onBeforeRender() {
super.onBeforeRender();
int idx = 0;
Iterator iter = iterator();
while (iter.hasNext()) {
Component child = (Component) iter.next();
if (idx == 0 || idx == size() - 1) {
child.add(new AttributeModifier("class", true, 
new Model(
idx == 0 ? "first" : "last")) {
public boolean isTemporary() {
return true;
}
});
}
idx++;
}
}
}
-- 
View this message in context: 
http://www.nabble.com/Reach-into-a-component-to-change-XML-attribute-tf4527906.html#a12965598
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 do I change the label/text for the wizard buttons?

2007-09-30 Thread Kent Tong


lizz wrote:
> 
> How do I change the label on the previous, next and finish buttons in the
> wizard? 
> I would like to change the label of the FinishButton to "save".
> 

In your .properties file, add:

org.apache.wicket.extensions.wizard.next=Proceed
org.apache.wicket.extensions.wizard.previous=Go back
org.apache.wicket.extensions.wizard.finish=Save

-- 
View this message in context: 
http://www.nabble.com/How-do-I-change-the-label-text-for-the-wizard-buttons--tf4543907.html#a12972587
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 do I force evaluate in a Wizard steps condition to run?

2007-09-30 Thread Kent Tong



lizz wrote:
> 
> A parameter in my wizard step decides whether the next step is valid or
> not.
> The end user can change this parameter and I therefore need to be able to
> reevaluate the next wizard steps when this is changed. I use ICondition
> and I guess there is a way for me to force the evaluate method to be
> called again. 
> How do I do that? 
> 

What do you mean? IConditions are evaluated dynamically. So they will always
return 
their current values.
-- 
View this message in context: 
http://www.nabble.com/How-do-I-force-evaluate-in-a-Wizard-steps-condition-to-run--tf4545108.html#a12972600
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: Wicket menu with submenu "dialog window"

2007-10-01 Thread Kent Tong


lizz wrote:
> 
> Has anyone made a menu (with menu items and submenus) in wicket? I would
> like a menu that looks more or less like the Swing JMenu.
> 
> I saw a reference to
> http://wicket-stuff.svn.sourceforge.net/viewvc/wicket-stuff/trunk/wicket-extensions-menubar/
> but didn’t find that project.
> 
> I need a menu that contains menu items and submenus. The menu items are
> easy to make but I dont know how to make the submenu.
> 

As a way to learn YUI, I've made a wicket YUI menu component. You can
download
and adapt it for your needs (no warranty of any kind). 
http://www.nabble.com/file/p12974699/yui-menu.zip yui-menu.zip 
-- 
View this message in context: 
http://www.nabble.com/Wicket-menu-with-submenu-%22dialog-window%22-tf4543964.html#a12974699
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 do I force evaluate in a Wizard steps condition to run?

2007-10-01 Thread Kent Tong


lizz wrote:
> 
> I have three wizard steps A, B and C
> In step B I have a drop down choice. Whether step c is valid or not
> depends on the selection in the drop down choice in step B.
> 
> Everytime the user changes the selection in the drop down choice the
> wizard must be updated (the evaluate method must be run) since for some
> selections the next button will be disabled since step b is the last step,
> while for other selections c is the last step and the next button is
> enabled.
> 

When I'd suggest you add an artificial step D as the final step saying
"You're completed the whole process".
This step is always enabled. Then no matter step C should be enabled or not,
the user will always see
a "Next" button.

Another option is try enabling wantOnSelectionChangedNotifications() to
refresh the whole page.
-- 
View this message in context: 
http://www.nabble.com/How-do-I-force-evaluate-in-a-Wizard-steps-condition-to-run--tf4545108.html#a12979454
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 do I force evaluate in a Wizard steps condition to run?

2007-10-01 Thread Kent Tong


lizz wrote:
> 
> I really dont want to add more steps that the ones I already have. for the
> case when step c is no longer valid I woild like the next button to be
> disabled and the finish button to be enabled. Isn't there a method for
> updating the button panel? 
> 

As I said, you can enable wantOnSelectionChangedNotifications() to refresh
the whole page. Here
is some sample code:

public class WizardTest extends WebPage {
private String selected = "A";

public WizardTest() {
WizardModel wizardModel = new WizardModel();
wizardModel.addListener(new IWizardModelListener() {
public void onFinish() {
setResponsePage(Completed.class);
}
public void onCancel() {
}
public void onActiveStepChanged(IWizardStep newStep) {
}
});
wizardModel.add(new MyStep("a"));
wizardModel.add(new MyStep2(new PropertyModel(this, 
"selected")));
wizardModel.add(new MyStep("c"), new ICondition() {
public boolean evaluate() {
return "A".equals(selected);
}
});
Wizard w = new Wizard("w", wizardModel);
add(w);
}
}

public class MyStep2 extends WizardStep {
public MyStep2(IModel model) {
List options = new ArrayList();
options.add("A");
options.add("B");
add(new DropDownChoice("s", model, options) {
protected boolean wantOnSelectionChangedNotifications() 
{
return true;
}
});
}
}

-- 
View this message in context: 
http://www.nabble.com/How-do-I-force-evaluate-in-a-Wizard-steps-condition-to-run--tf4545108.html#a12991207
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: Page.detachModels() not working like it used to

2007-10-01 Thread Kent Tong


Dan Syrstad-2 wrote:
> 
> This has broken a JUnit test that was testing a detachable model using
> WicketTester. The same test passes in Wicket 1.2.6. Is there something
> different I should be doing in 1.3?
> 

If it was calling detach() instead of detachModels(), then it should
continue
to pass.

I think the change was made so that a component (not a page) can detach 
its children and their models without relying on the page. This is needed 
when handling an AJAX request.
-- 
View this message in context: 
http://www.nabble.com/Page.detachModels%28%29-not-working-like-it-used-to-tf4549247.html#a12991427
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: hide/show components - role based

2007-10-01 Thread Kent Tong


Juan Gabriel Arias wrote:
> 
> Im trying to dinamically show or hide html components, like links,
> buttons,
> etc.
> 

something like:

public class MyPage {
  public MyPage() {
 Link myLink = ...;
 MetaDataRoleAuthorizationStrategy.authorize(myLink, RENDER,
"role1,role2");
  }
}

-- 
View this message in context: 
http://www.nabble.com/hide-show-components---role-based-tf4550513.html#a12991489
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: Page.detachModels() not working like it used to

2007-10-02 Thread Kent Tong


Dan Syrstad-2 wrote:
> 
> Nope. I tried detach() too and that doesn't work - the test still fails. I
> had to write my own method which was basically was a copy of the old
> Page.detachModels() code.
> 
> The thing is that  In beta3, Page now just acts like a Component as far as
> detachModels() is concerned and Component.detachModels()/detach() does
> notdetach all of the child models.
> Component.detach(), in fact, calls detachChildren() which is an empty
> method.
> 

detachChildren() is overriden by MarkupContainer which does detach its
children
(see below). So there must be something wrong with your unit test.

void detachChildren()
{
// Loop through child components
final Iterator iter = iterator();
while (iter.hasNext())
{
// Get next child
final Component child = (Component)iter.next();

// Call end request on the child
child.detach();
}
super.detachChildren();
}
-- 
View this message in context: 
http://www.nabble.com/Page.detachModels%28%29-not-working-like-it-used-to-tf4549247.html#a13000103
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: CompoundPropertyModel stops working when form validation fails.

2007-10-05 Thread Kent Tong


Fabio Fioretti wrote:
> 
> This is what I do, basically:
> 1) Select a choice from the ListChoice;
> 2) The form automatically fills with the data of the selected
> recommendation instance;
> 3) Modify the data in the form so that validation will fail;
> 4) Submit data --> validation fails;
> 5) Select another choice from the ListChoice;
> 6) The form doesn't get updated anymore (and keeps showing old data of
> the recommendation instance that failed validation)
> 

I suppose you're using wantOnSelectionChangedNotifications() to trigger
the refresh? In that case it won't refresh any input entered by the user.
Validation plays no role here because such a form refresh does NOT invoke
the validation logic.

In order to refresh the data and erase what the user has entered, call
clearInput() on the form:

ListChoice recommendation = new ListChoice("recommendation", ...) {
protected boolean wantOnSelectionChangedNotifications() {
return true;
}
protected void onSelectionChanged(Object newSelection) {
recommendationForm.clearInput();
}
};

--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
-- 
View this message in context: 
http://www.nabble.com/CompoundPropertyModel-stops-working-when-form-validation-fails.-tf4562483.html#a13057990
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: Page.detachModels() not working like it used to

2007-10-05 Thread Kent Tong


Dan Syrstad-2 wrote:
> 
> Actually, Page.detach() is not callable from a JUnit test that uses
> WicketTester in 1.3.0beta3. It throws an exception:
> 

I used your code and the test passed. Here is my test page:




test


public class Test extends WebPage {
public Test() {
ListView listView = new ListView("listView", Arrays
.asList(new String[] { "a", "b" })) {

protected void populateItem(final ListItem item) {
item.add(new Label("labelWithDetachableModel", 
new
LoadableDetachableModel() {
protected Object load() {
return item.getModelObject();
}
}));
}

};
add(listView);
}
}


However, I really think your test case is broken. After startPage() returns,
the page has been detached. Why it passes on my computer is because
of your call to debugComponentTrees(). Therefore, you should really be
testing if the model is now detached. That's it. By checking the output 
you can be sure that the model was once attached.

--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
-- 
View this message in context: 
http://www.nabble.com/Page.detachModels%28%29-not-working-like-it-used-to-tf4549247.html#a13057290
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: Page.detachModels() not working like it used to

2007-10-05 Thread Kent Tong


Dan Syrstad-2 wrote:
> 
> Your page code is almost exactly the same as mine. However, your HTML does
> not look correct - it has no tag with a wicket:id in it. So maybe your
> component never rendered.
> 

No, your mail client has stripped the code. Let me show you the code again:



test



public class Test extends WebPage {
public Test() {
ListView listView = new ListView("listView", Arrays
.asList(new String[] { "a", "b" })) {

protected void populateItem(final ListItem item) {
item.add(new Label("labelWithDetachableModel", 
new
LoadableDetachableModel() {
protected Object load() {
return item.getModelObject();
}
}));
}

};
add(listView);
}
}

Run the test case and it will pass (although for the wrong reason).


-- 
View this message in context: 
http://www.nabble.com/Page.detachModels%28%29-not-working-like-it-used-to-tf4549247.html#a13063392
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: CompoundPropertyModel stops working when form validation fails.

2007-10-05 Thread Kent Tong


Fabio Fioretti wrote:
> 
> The ListChoice uses the same AbstractModel on which the panel inside
> the form builds its CompoundPropertyModel (see my previous posts):
> when user's selection changes, the AbstractModel correctly replaces
> its object with the newly selected instance and the form gets
> refreshed by an AjaxFormComponentUpdatingBehavior (attached to
> ListChoice's "onclick" event) to display the new instance (read from
> the same AbstractModel).
> 

Even though you're not using wantOnSelectionChangedNotifications(),
what I said applies: you need to call clearInput() like:

ListChoice lc = new ListChoice("lc", ...);
lc.add(new OnChangeAjaxBehavior() {
protected void onUpdate(AjaxRequestTarget target) {
recommendationForm.clearInput(); //THIS LINE IS WHAT 
YOU NEED
target.addComponent(recommendationPanel);
}
});


-- 
View this message in context: 
http://www.nabble.com/CompoundPropertyModel-stops-working-when-form-validation-fails.-tf4562483.html#a13069881
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: CompoundPropertyModel stops working when form validation fails.

2007-10-05 Thread Kent Tong


Fabio Fioretti wrote:
> 
> The ListChoice uses the same AbstractModel on which the panel inside
> the form builds its CompoundPropertyModel (see my previous posts):
> when user's selection changes, the AbstractModel correctly replaces
> its object with the newly selected instance and the form gets
> refreshed by an AjaxFormComponentUpdatingBehavior (attached to
> ListChoice's "onclick" event) to display the new instance (read from
> the same AbstractModel).
> 

Even though you're not using wantOnSelectionChangedNotifications(),
what I said applies: you need to call clearInput() like:

ListChoice lc = new ListChoice("lc", ...);
lc.add(new OnChangeAjaxBehavior() {
protected void onUpdate(AjaxRequestTarget target) {
recommendationForm.clearInput(); //THIS LINE IS WHAT 
YOU NEED
target.addComponent(recommendationPanel);
}
});

--
Kent Tong
Free tutorials on Wicket at http://www.agileskills2.org/EWDW
-- 
View this message in context: 
http://www.nabble.com/CompoundPropertyModel-stops-working-when-form-validation-fails.-tf4562483.html#a13069882
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: Form.onComponentTagBody()

2007-10-05 Thread Kent Tong


cblehman wrote:
> 
> Does anyone have a suggest for how to insert a  tag as the first
> item before any components that were added to the Form, but after the
> hidden fields that Form adds? I basically want to render the following:
> 

Instead of inserting a , I'd suggest that you use CSS to do the
layout.
See http://www.quirksmode.org/css/forms.html for a simple example.

--
Kent Tong
Free tutorials on Wicket at http://www.agileskills2.org/EWDW
-- 
View this message in context: 
http://www.nabble.com/Form.onComponentTagBody%28%29-tf4575419.html#a13070025
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: hot redeploy of java classes

2007-10-05 Thread Kent Tong


Artur W. wrote:
> 
> I tried to do the same in tomcat 5.5. I added autoDeploy="true" to the
>  but it doesn't
> work. Anyone has any idea how to force tomcat to do that?
> 

You need reloadable in , not autoDeploy. There is step-by-step in
my free 
tutorial (see my signature below).

--
Kent Tong
Free tutorials on Wicket at http://www.agileskills2.org/EWDW
-- 
View this message in context: 
http://www.nabble.com/hot-redeploy-of-java-classes-tf4573767.html#a13070054
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: Ajax dropdownchoice doesn't work after submit

2007-10-05 Thread Kent Tong


Larva wrote:
> 
>   public final void onSubmit()
>   {
>   SiconaraBasePage page = (SiconaraBasePage)getPage();
>   List pageFilters = page.getFilterProperties();
>   
>   if (pageFilters != null)
>   pageFilters.clear();
> 
>   ParFiltro f1 = new ParFiltro("afiliado.delegacion.tipo",
> getTipoDelegacion());
>   ParFiltro f2 = new ParFiltro("afiliado.delegacion.alias",
> getDelegacion());
>   if (f1.getValue() != null && !f1.getValue().equals(""))
>   pageFilters.add(f1);
>   if (f2.getValue() != null && !f2.getValue().equals(""))
>   pageFilters.add(f2);
>   page.render();
>   }
> 
> The ParFiltro class is a utility class wich contains a pair property-value
> used in the page to filter data.
> That's because I need to invoke the page.render() method.
> I'm doing something wrong? There is another way to do it?
> 

Am I missing something here? You should call:

setResponsePage(page);
//page.render();

--
Kent Tong
Free tutorials on Wicket at http://www.agileskills2.org/EWDW

-- 
View this message in context: 
http://www.nabble.com/Ajax-dropdownchoice-doesn%27t-work-after-submit-tf4574920.html#a13070084
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: WicketNotSerializableException !

2007-10-07 Thread Kent Tong


chickabee wrote:
> 
> Any idea why I am getting :
> 
> org.apache.wicket.util.io.SerializableChecker$WicketNotSerializableException:
> Unable to serialize class: sun.font.AttributeMap
> 

This is fixed in beta 4 (https://issues.apache.org/jira/browse/WICKET-819).

--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
-- 
View this message in context: 
http://www.nabble.com/WicketNotSerializableException-%21-tf4579510.html#a13091513
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: CompoundPropertyModel stops working when form validation fails.

2007-10-08 Thread Kent Tong


Fabio Fioretti wrote:
> 
> You were right Kent, thanks a lot! Calling clearInput() in the
> updating behavior really fixes the problem.
> 
> What I miss now is why the CompoundPropertyModel breaks if the form is
> not manually reset by calling clearInput(). Is it a bug or a feature?
> :)
> 

It's a feature. When the selection changes, the user might have entered
something into say a text field. Generally we don't want to lose that
input (because all you want to do may be to show or hide a certain component
depending on the selection), therefore it is saved and redisplayed to the 
user. By default it is clear only when the form is submitted and validation 
is passed successfully.


-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
-- 
View this message in context: 
http://www.nabble.com/CompoundPropertyModel-stops-working-when-form-validation-fails.-tf4562483.html#a13092730
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: Decouple parts of a form

2007-10-09 Thread Kent Tong


Gerolf Seitz wrote:
> 
> ditch the form and let CaptchaPanel extend FormComponentPanel. for the
> captcha and do a check for the form in onBeforeRender (since it's not yet
> added to the hierarchy in the constructor).
> just use "getForm();" to check for the existence of an ancestor form. this
> method throws an exception if no form was found.
> 

I'd suggest that it extend Panel, not FormComponentPanel as there is no
composite data structure here. The best place to validate the input is
in a custom validator. Here is some sample code (there is also step-by-
step instruction on validation in my tutorials; see my signature):

public class CaptchaPanel extends Panel {
private static class CaptchaValidator extends AbstractValidator {
protected void onValidate(IValidatable validatable) {
String value = (String) validatable.getValue();
if (value matches the image) {
return;
}
error(validatable);
}
}
public CaptchaPanel(String id) {
super(id);
RequiredTextField t = new RequiredTextField("captchaInput", new 
Model());
t.add(new CaptchaValidator());
add(t);
add(new Image("captchaImage", ...));
}
}


-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
-- 
View this message in context: 
http://www.nabble.com/Decouple-parts-of-a-form-tf4591493.html#a13112961
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: Lazy loading pageable listview

2007-10-09 Thread Kent Tong


wfaler wrote:
> 
> I have found a bunch of stuff around IDataProvider, DataView etc, but I
> haven't found any meaningful examples that helps a great deal..
> 

Some sample code below. There is a whole chapter on this topic in my e-book
(see my signature for location).

public class LazyLoad extends WebPage {

public LazyLoad() {
IColumn[] columns = new IColumn[] {
new PropertyColumn(new Model("col1"), 
"intValue"),
new PropertyColumn(new Model("col2"), "class") 
};
ISortableDataProvider dataProvider = new SortableDataProvider() 
{

public int size() {
return 30;
}

public IModel model(Object object) {
return new Model((Integer) object);
}

public Iterator iterator(int first, int count) {
return loadEntriesFromDatabase(first, 
count).iterator();
}

private List loadEntriesFromDatabase(int 
first, int count) {
List items = new ArrayList();
for (int i = 0; i < count; i++) {
items.add(new Integer(first + i));
}
return items;
}

};
DefaultDataTable t = new DefaultDataTable("t", columns, 
dataProvider, 3);
add(t);
}
}


-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
-- 
View this message in context: 
http://www.nabble.com/Lazy-loading-pageable-listview-tf4587413.html#a13113194
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: Empty ListChoice

2007-10-12 Thread Kent Tong


Matt Jensen-2 wrote:
> 
> Is there any way to get a ListChoice to render as empty (no options) 
> when its choice model is empty?  By default, "Choose One" appears.  If I 
> set nullValid to true, an empty item appears which is still selectable.  
> I would like to have the list come up completely empty if the choice 
> model is empty, and I'd like to do it without creating a new component 
> (though obviously I will do that if it is what is needed.)
> 

Try:

ListChoice lc = new ListChoice("lc", ...) {
protected CharSequence getDefaultChoice(Object selected) {
    return "";
}
};

-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
-- 
View this message in context: 
http://www.nabble.com/Empty-ListChoice-tf4604759.html#a13172939
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: Validating a NonZero Values and Validators Project in General

2007-10-12 Thread Kent Tong


Francisco Diaz Trepat - gmail wrote:
> 
> Although I think maybe there are some validators we would all use like
> those
> already included in wicket.
> 

nonzero positive: NumberValidator.minimum(1)
nonzero negative: NumberValidator.maximum(-1)
nonzero positive or negative: do as Gwyn suggested. If you insist on using a
pre-built
validator, try PatternValidator("[+|-]?(\\d)*[1-9](\\d)*") but then the
model has to
be a String, not a number.


-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
-- 
View this message in context: 
http://www.nabble.com/Validating-a-NonZero-Values-and-Validators-Project-in-General-tf4609372.html#a13172551
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: Empty ListChoice

2007-10-12 Thread Kent Tong


Matt Jensen-2 wrote:
> 
> I believe that doing this causes the list to contain one empty, but 
> still selectable, element.  That is what I am trying to avoid--I just 
> want a plain empty list.  I'm starting to wonder whether empty lists are 
> considered to not be the "Wicket way," as it seems like it should be 
> easier than this.  Does ListChoice *intentionally* not allow for an 
> empty list?  I expected to find something like 
> "allowEmpty(boolean)"...but no dice.
> 

Have you tried my code? The list has no selectable entry.


-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
-- 
View this message in context: 
http://www.nabble.com/Empty-ListChoice-tf4604759.html#a13186476
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Wicket tutorials updated for beta4

2007-10-12 Thread Kent Tong

Hi,

I've updated my free Wicket tutorials to beta4. They're available at 
http://www.agileskills2.org/EWDW/index.html


-----
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
-- 
View this message in context: 
http://www.nabble.com/Wicket-tutorials-updated-for-beta4-tf4617202.html#a13186497
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: Locale change on Image with Resource results in broken images

2007-10-13 Thread Kent Tong


Jonas-21 wrote:
> 
> I think LocalizedImageResource.setSrcAttribute(...) shouldn't
> reset the resource field if locales (and styles) don't match, since
> Resource doesn't seem to be locale/style specific (unlike
> ResourceReference) and cannot be reloaded/recomputed
> as the commentary suggests if the
> Image(String id, Resource imageResource) constructor was
> used.
> 

This indeed looks like a bug to me.


-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
-- 
View this message in context: 
http://www.nabble.com/Locale-change-on-Image-with-Resource-results-in-broken-images-tf4613589.html#a13190540
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: Ajax paging navigation link exception

2007-10-13 Thread Kent Tong


kent lai wrote:
> 
>   Anyway I am using AjaxPagingNavigator, and wheneven i do a double  
> click(or however many times, my mouse *is* kinda faulty in that it  
> triggers multiple clicks sometimes), i get the following,
> 
>   WicketMessage: Unable to find AjaxPagingNavigator component in  
> hierarchy starting from [MarkupContainer [Component id = pageLink,  
> page = , path = 0:pageLink.AjaxPagingNavigationLink]]
> 

Are you using the latest v1.3?

-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
-- 
View this message in context: 
http://www.nabble.com/Ajax-paging-navigation-link-exception-tf4612911.html#a13195781
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: Configuring DatePicker

2007-10-13 Thread Kent Tong


Christopher Gardner-2 wrote:
> 
> Does anyone have any examples of configuring DatePicker?  I'd like to
> limit the minimal date, for example.  I subclassed it and overrode
> configure() to set what I thought the Yahoo documentation said to to
> specify the minimal date, but to no avail.
> 

The code below works fine for me:

TextField d = new TextField("d");
d.add(new DatePicker() {
protected void configure(Map widgetProperties) {
widgetProperties.put("mindate", "10/3/2007");
super.configure(widgetProperties);
}
});


-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
-- 
View this message in context: 
http://www.nabble.com/Configuring-DatePicker-tf4616962.html#a13195942
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: RFE: DataTable && colgroup

2007-10-13 Thread Kent Tong


Jan Kriesten wrote:
> 
> might be, but it's a nice feature for just styling col-width and
> col-alignment.
> actually, this would be an optional add-on, no replacement for
> IStyledColumn.
> 
> since it is pretty easy to implement, what are the pitfalls when have it
> added?
> 

All mozilla-based browsers don't support it due to an alleged contradiction
between 
HTML4 and CSS (see https://bugzilla.mozilla.org/show_bug.cgi?id=915#c27).


-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
-- 
View this message in context: 
http://www.nabble.com/RFE%3A-DataTablecolgroup-tf4618089.html#a13196020
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: facebook support

2007-11-08 Thread Kent Tong


Matt Jensen-2 wrote:
> 
> I am working on this, though I'm trying to leave the door open to also 
> supporting MySpace in the future.  I have not done much yet--and nothing 
> Wicket-specific--but I do plan to include a Wicket module.
> 

Have you considered Google's OpenSocial API?

-
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
-- 
View this message in context: 
http://www.nabble.com/facebook-support-tf4773546.html#a13660095
Sent from the Wicket - User mailing list archive at Nabble.com.


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



  1   2   >