Re: radio and radiogroup default "checked" not working?

2009-09-04 Thread Seven Corners

I have a similar issue, but I don't know which radio should be checked until
runtime.  So I can't hard-code it in the HTML; I have to determine it from
my DAO in the radiogroup's parent panel constructor.  I'm using the model to
determine which radio to select, and it works fine once you click, but my
problem is that nothing is selected when the page first loads.  Here is the
code:

// This sets up the radiobuttons
private enum eContentTypeControl { TEXTFIELD, DROPDOWN };
private class ContentTypeControlBean implements Serializable
{
private static final long serialVersionUID = 1L;
private eContentTypeControl m_control = null;

public ContentTypeControlBean( eContentTypeControl control )
{
m_control = control;
}

public eContentTypeControl getControl()
{
return m_control;
}

public void setControl( eContentTypeControl control )
{
m_control = control;
}
}

// Figure out which radiobutton should be selected
List mimeTypeList = model.getCommonMimeTypes();
eContentTypeControl contentTypeControl = null;
if ( mimeTypeList.contains(
model.getCachedDefaults().getContentType() ) )
{
contentTypeControl = eContentTypeControl.DROPDOWN;
}
else
{
contentTypeControl = eContentTypeControl.TEXTFIELD;
}

// Create the radiogroup with the right 
m_ContentTypeRadioGroupBean = new ContentTypeControlBean(
contentTypeControl );
RadioGroup contentTypeRadioGroup = 
new RadioGroup( 
"contentTypeRadioGroup", 
new PropertyModel(
m_ContentTypeRadioGroupBean, "control" ) );
...
m_rbUseTextFieldContentType = 
new Radio( 
"textfieldContentType", 
new Model( new
ContentTypeControlBean( eContentTypeControl.TEXTFIELD ) ),
contentTypeRadioGroup );
contentTypeRadioGroup.add( m_rbUseTextFieldContentType );

m_rbUseDropDownContentType = 
new Radio( 
"dropdownContentType", 
new Model( new
ContentTypeControlBean( eContentTypeControl.DROPDOWN ) ),
contentTypeRadioGroup );
contentTypeRadioGroup.add( m_rbUseDropDownContentType );

and here is the HTML:

 

 

The dropdown radio is checked when the page loads if I have "checked =
'true'" in the HTML but since I don't know whether it should be checked at
compile time, I can't do that.  I tried using an AttributeModifier in the
parent panel's constructor but it has no effect:

if ( contentTypeControl == eContentTypeControl.TEXTFIELD )
{
m_rbUseTextFieldContentType.add( new AttributeModifier(
"checked", new Model( "true" ) ) );
m_rbUseDropDownContentType.add( new AttributeModifier(
"checked", new Model( "false" ) ) );
}
else
{
m_rbUseTextFieldContentType.add( new AttributeModifier(
"checked", new Model( "false" ) ) );
m_rbUseDropDownContentType.add( new AttributeModifier(
"checked", new Model( "true" ) ) );
}

Any ideas?

-- 
View this message in context: 
http://www.nabble.com/radio-and-radiogroup-default-%22checked%22-not-working--tp22248204p25294447.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Disable LinkTree iconLink

2009-07-28 Thread Seven Corners
I have a LinkTree wherein I need to disable the links on certain nodes.  It
was easy to disable the contentLink but I haven't been able to figure out
how to disable the iconLink.  My links are BookmarkablePageLinks, but
iconLink is not a proper link; rather it appears that it's a  element
with an onclick handler, that contains an  element that has no
surrounding anchor or onclick handlers.  While nothing happens on my
disabled icons when you click the mouse, the mouse still transforms into a
link mouse (a hand instead of a pointer), and I'd like to prevent that.

Short of cheating and tweaking the style to set the pointer, I don't know
how to really disable the thing.

Any ideas?


Re: Link not getting onclick event

2009-03-30 Thread Seven Corners

Thanks for getting back to me.  I figured it out; I had a mismatched div tag
that Firefox forgave.  It wasn't a Wicket issue at all.
-- 
View this message in context: 
http://www.nabble.com/Link-not-getting-onclick-event-tp22725492p22781576.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Form validation with coupled components

2009-03-27 Thread Seven Corners

OK, good, thank you, Martin!

Shelah

-- 
View this message in context: 
http://www.nabble.com/Form-validation-with-coupled-components-tp22741741p22742000.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Form validation with coupled components

2009-03-27 Thread Seven Corners

I have a form that contains a few checkboxes, and the form should fail
validation only if ALL of them are unchecked.  How can I do this?  I see how
to validate that a single control is required but not to check for coupled
controls.
-- 
View this message in context: 
http://www.nabble.com/Form-validation-with-coupled-components-tp22741741p22741741.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Link not getting onclick event

2009-03-26 Thread Seven Corners

I have link that is not receiving an onclick event.  It links to a page in my
application, and I do not want it bookmarkable.  It's in a RefreshingView. 
The browser renders the link with the correct style for a link, but if you
hover over the link, you don't get the URL to show up in the status bar.  So
something is very whacked.

The HTML looks like this:

...
  
  
  
...


and the code is like this:

private class SNMPTrapEventSubscriptionView extends
RefreshingView
{
...
@Override
protected void populateItem( Item
item )
{
final SNMPTrapEventSubscriptionBean bean =
item.getModelObject();

WebMarkupContainer cell = new WebMarkupContainer( "trapIdCell"
);
Link snmpLink = new Link( "snmpLink" )
{
private static final long serialVersionUID = 1L;

@Override
public void onClick()
{
--> we never gettry 
here{
PageParameters params = new PageParameters();
params.add( SettingsPage.kbMANAGE_SNMP,
Boolean.toString( true ) );  
params.add( SettingsPage.kiSUBSCRIPTION_ID,
Integer.toString( bean.getId() ) );

EventSubscriptionsPanel.this.setResponsePage(
SettingsPage.class, params );
}   
catch( Throwable t )
{
logger.error( t.getMessage(), t );
}
}
};
snmpLink.add( new Label( "id" ) );
cell.add( snmpLink );
item.add( cell );
...

Place a breakpoint in the onClick() handler and we never get there.  In the
browser, the anchor text shows up blue, indicating that the browser knows
it's a link, but you click on it and nothing happens.  In the HTML output,
this is the link's href:

href="?wicket:interface=:4:rightHandContentPanel:tabs:panel:tableWrapper:snmpSubscription:3:trapIdCell:snmpLink::ILinkListener::"

It doesn't look like the href has the right class but I don't know.

The model is a CompoundPropertyModel of my SNMPTrapEventSubscriptionBean
bean; I had a provider that's a
LoadableDetachableModel>, and I load a
list of data from the server.  I am getting accurate data; it's the link
that isn't working.

Anyone have a clue what I'm doing wrong?

Thanks in advance.

 
-- 
View this message in context: 
http://www.nabble.com/Link-not-getting-onclick-event-tp22725492p22725492.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Shared string resources

2009-03-12 Thread Seven Corners

No, I'm not using Spring.  It's an XML properties file with the same name as
my application.



Jeremy Thomerson-5 wrote:
> 
> In which app.xml file is it in?  An XML properties file?  Or in some
> Spring
> (etc) config file?
> 
> String loading from Wicket's built in resources framework is quite robust.
> If you have a .properties file (or .xml properties file if you choose -
> certain languages require this format because of encoding) named the same
> as
> your application (MyApp.java = MyApp.properties or MyApp.xml), then you
> can
> use string loading just like if it were MyComponent.java and
> MyComponent.properties.  This is well documented in Wicket in Action,
> which
> leads me to believe that you are talking rather about some app.xml Spring
> config.  In which case, you'll probably need to add a resource locator in
> your application's init method to locate resources in custom locations.
> 
> --
> Jeremy Thomerson
> http://www.wickettraining.com
> 
> 
> 
> On Thu, Mar 12, 2009 at 12:30 PM, Seven Corners
> wrote:
> 
>>
>> Thank you for giving such an explicit answer, Steve.  The thing is, I do
>> that
>> all the time, and this is the answer for when you have an associated
>> component.  I am looking for how to do it with strings shared throughout
>> the
>> WebApplication; i.e., there is no component and the string is in the
>> application's xml file.  I've looked all over Wicket in Action and
>> perhaps
>> it's in there, but I just can't find it.  That's why I'm posting.
>>
>> So I have the string I need in my app.xml.  Within a panel on one of the
>> pages, I instantiate a StringResourceModel with a string ID from the
>> app.xml
>> file like so:
>>
>> class MyPanel extends Panel
>> {
>>...
>>add( new Label( strLabelId, new StringResourceModel( strRescId, null )
>> )
>> );
>>...
>> }
>>
>> I'm guessing I need to use the StringResourceModel(String resourceKey,
>> IModel model)  ctor because the string is not associated with a
>> component, and I'm setting the model to null because ultimately I'd be
>> getting the value from a bean if I did and the bean can't return the
>> string
>> for the same reason I'm having troubles, namely that it's not a component
>> so
>> it can't have a properties file associated with it.
>>
>> I get a runtime exception that it can't find that string for my
>> component,
>> which makes perfect sense.  I understand why it fails.  I can kludge a
>> workaround.  I don't want to; I know you have the capability to create a
>> shared string table and I want to do it right.
>>
>> So what am I doing wrong?
>>
>>
>> Steve Swinsburg-2 wrote:
>> >
>> > You can also just use ResourceModel("some.string.property") if you
>> > don't have any thing that needs to be substituted into the strings
>> > when they are rendered.
>> > ie
>> > some.string.property=this is some text
>> >
>> > or StringResourceModel( various constructors ) if you need some
>> > dynamic value in there:
>> > ie
>> > some.string.property=This is a {0} string
>> >
>> > This will work from the same YourApplicationName.properties file.
>> >
>> >
>> > cheers,
>> > Steve
>> >
>> >
>> >
>> > On 11/03/2009, at 7:24 PM, Jeremy Thomerson wrote:
>> >
>> >> Put them in YourApplicationName.properties and use
>> >> StringResourceModel.  See
>> >> internationalization help in Wicket in Action.
>> >>
>> >> --
>> >> Jeremy Thomerson
>> >> http://www.wickettraining.com
>> >>
>> >>
>> >>
>> >> On Wed, Mar 11, 2009 at 2:20 PM, Seven Corners
>> >>  wrote:
>> >>
>> >>>
>> >>> I have some strings that I'd like to access from a common string
>> >>> table that
>> >>> is not tied to any particular component.  How can I do this?
>> >>> --
>> >>> View this message in context:
>> >>> http://www.nabble.com/Shared-string-resources-
>> >>> tp22462537p22462537.html
>> >>> Sent from the Wicket - User mailing list archive at Nabble.com.
>> >>>
>> >>>
>> >>> -
>> >>> To unsub

Re: Shared string resources

2009-03-12 Thread Seven Corners

No, I'm not using Spring.  It's an XML properties file with the same name as
my application.



Jeremy Thomerson-5 wrote:
> 
> In which app.xml file is it in?  An XML properties file?  Or in some
> Spring
> (etc) config file?
> 
> String loading from Wicket's built in resources framework is quite robust.
> If you have a .properties file (or .xml properties file if you choose -
> certain languages require this format because of encoding) named the same
> as
> your application (MyApp.java = MyApp.properties or MyApp.xml), then you
> can
> use string loading just like if it were MyComponent.java and
> MyComponent.properties.  This is well documented in Wicket in Action,
> which
> leads me to believe that you are talking rather about some app.xml Spring
> config.  In which case, you'll probably need to add a resource locator in
> your application's init method to locate resources in custom locations.
> 
> --
> Jeremy Thomerson
> http://www.wickettraining.com
> 
> 
> 
> On Thu, Mar 12, 2009 at 12:30 PM, Seven Corners
> wrote:
> 
>>
>> Thank you for giving such an explicit answer, Steve.  The thing is, I do
>> that
>> all the time, and this is the answer for when you have an associated
>> component.  I am looking for how to do it with strings shared throughout
>> the
>> WebApplication; i.e., there is no component and the string is in the
>> application's xml file.  I've looked all over Wicket in Action and
>> perhaps
>> it's in there, but I just can't find it.  That's why I'm posting.
>>
>> So I have the string I need in my app.xml.  Within a panel on one of the
>> pages, I instantiate a StringResourceModel with a string ID from the
>> app.xml
>> file like so:
>>
>> class MyPanel extends Panel
>> {
>>...
>>add( new Label( strLabelId, new StringResourceModel( strRescId, null )
>> )
>> );
>>...
>> }
>>
>> I'm guessing I need to use the StringResourceModel(String resourceKey,
>> IModel model)  ctor because the string is not associated with a
>> component, and I'm setting the model to null because ultimately I'd be
>> getting the value from a bean if I did and the bean can't return the
>> string
>> for the same reason I'm having troubles, namely that it's not a component
>> so
>> it can't have a properties file associated with it.
>>
>> I get a runtime exception that it can't find that string for my
>> component,
>> which makes perfect sense.  I understand why it fails.  I can kludge a
>> workaround.  I don't want to; I know you have the capability to create a
>> shared string table and I want to do it right.
>>
>> So what am I doing wrong?
>>
>>
>> Steve Swinsburg-2 wrote:
>> >
>> > You can also just use ResourceModel("some.string.property") if you
>> > don't have any thing that needs to be substituted into the strings
>> > when they are rendered.
>> > ie
>> > some.string.property=this is some text
>> >
>> > or StringResourceModel( various constructors ) if you need some
>> > dynamic value in there:
>> > ie
>> > some.string.property=This is a {0} string
>> >
>> > This will work from the same YourApplicationName.properties file.
>> >
>> >
>> > cheers,
>> > Steve
>> >
>> >
>> >
>> > On 11/03/2009, at 7:24 PM, Jeremy Thomerson wrote:
>> >
>> >> Put them in YourApplicationName.properties and use
>> >> StringResourceModel.  See
>> >> internationalization help in Wicket in Action.
>> >>
>> >> --
>> >> Jeremy Thomerson
>> >> http://www.wickettraining.com
>> >>
>> >>
>> >>
>> >> On Wed, Mar 11, 2009 at 2:20 PM, Seven Corners
>> >>  wrote:
>> >>
>> >>>
>> >>> I have some strings that I'd like to access from a common string
>> >>> table that
>> >>> is not tied to any particular component.  How can I do this?
>> >>> --
>> >>> View this message in context:
>> >>> http://www.nabble.com/Shared-string-resources-
>> >>> tp22462537p22462537.html
>> >>> Sent from the Wicket - User mailing list archive at Nabble.com.
>> >>>
>> >>>
>> >>> -
>> >>> To unsub

Re: Shared string resources

2009-03-12 Thread Seven Corners

Thank you for giving such an explicit answer, Steve.  The thing is, I do that
all the time, and this is the answer for when you have an associated
component.  I am looking for how to do it with strings shared throughout the
WebApplication; i.e., there is no component and the string is in the
application's xml file.  I've looked all over Wicket in Action and perhaps
it's in there, but I just can't find it.  That's why I'm posting.

So I have the string I need in my app.xml.  Within a panel on one of the
pages, I instantiate a StringResourceModel with a string ID from the app.xml
file like so:

class MyPanel extends Panel
{
...
add( new Label( strLabelId, new StringResourceModel( strRescId, null ) )
);
...
}

I'm guessing I need to use the StringResourceModel(String resourceKey,
IModel model)  ctor because the string is not associated with a
component, and I'm setting the model to null because ultimately I'd be
getting the value from a bean if I did and the bean can't return the string
for the same reason I'm having troubles, namely that it's not a component so
it can't have a properties file associated with it.

I get a runtime exception that it can't find that string for my component,
which makes perfect sense.  I understand why it fails.  I can kludge a
workaround.  I don't want to; I know you have the capability to create a
shared string table and I want to do it right.

So what am I doing wrong?


Steve Swinsburg-2 wrote:
> 
> You can also just use ResourceModel("some.string.property") if you  
> don't have any thing that needs to be substituted into the strings  
> when they are rendered.
> ie
> some.string.property=this is some text
> 
> or StringResourceModel( various constructors ) if you need some  
> dynamic value in there:
> ie
> some.string.property=This is a {0} string
> 
> This will work from the same YourApplicationName.properties file.
> 
> 
> cheers,
> Steve
> 
> 
> 
> On 11/03/2009, at 7:24 PM, Jeremy Thomerson wrote:
> 
>> Put them in YourApplicationName.properties and use  
>> StringResourceModel.  See
>> internationalization help in Wicket in Action.
>>
>> --
>> Jeremy Thomerson
>> http://www.wickettraining.com
>>
>>
>>
>> On Wed, Mar 11, 2009 at 2:20 PM, Seven Corners  
>>  wrote:
>>
>>>
>>> I have some strings that I'd like to access from a common string  
>>> table that
>>> is not tied to any particular component.  How can I do this?
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Shared-string-resources- 
>>> tp22462537p22462537.html
>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>
>>>
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 
> 
> 

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


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



Re: Shared string resources

2009-03-12 Thread Seven Corners

Thank you for giving such an explicit answer, Steve.  The thing is, I do that
all the time, and this is the answer for when you have an associated
component.  I am looking for how to do it with strings shared throughout the
WebApplication; i.e., there is no component and the string is in the
application's xml file.  I've looked all over Wicket in Action and perhaps
it's in there, but I just can't find it.  That's why I'm posting.

So I have the string I need in my app.xml.  Within a panel on one of the
pages, I instantiate a StringResourceModel with a string ID from the app.xml
file like so:

class MyPanel extends Panel
{
...
add( new Label( strLabelId, new StringResourceModel( strRescId, null ) )
);
...
}

I'm guessing I need to use the StringResourceModel(String resourceKey,
IModel model)  ctor because the string is not associated with a
component, and I'm setting the model to null because ultimately I'd be
getting the value from a bean if I did and the bean can't return the string
for the same reason I'm having troubles, namely that it's not a component so
it can't have a properties file associated with it.

I get a runtime exception that it can't find that string for my component,
which makes perfect sense.  I understand why it fails.  I can kludge a
workaround.  I don't want to; I know you have the capability to create a
shared string table and I want to do it right.

So what am I doing wrong?


Steve Swinsburg-2 wrote:
> 
> You can also just use ResourceModel("some.string.property") if you  
> don't have any thing that needs to be substituted into the strings  
> when they are rendered.
> ie
> some.string.property=this is some text
> 
> or StringResourceModel( various constructors ) if you need some  
> dynamic value in there:
> ie
> some.string.property=This is a {0} string
> 
> This will work from the same YourApplicationName.properties file.
> 
> 
> cheers,
> Steve
> 
> 
> 
> On 11/03/2009, at 7:24 PM, Jeremy Thomerson wrote:
> 
>> Put them in YourApplicationName.properties and use  
>> StringResourceModel.  See
>> internationalization help in Wicket in Action.
>>
>> --
>> Jeremy Thomerson
>> http://www.wickettraining.com
>>
>>
>>
>> On Wed, Mar 11, 2009 at 2:20 PM, Seven Corners  
>>  wrote:
>>
>>>
>>> I have some strings that I'd like to access from a common string  
>>> table that
>>> is not tied to any particular component.  How can I do this?
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Shared-string-resources- 
>>> tp22462537p22462537.html
>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>
>>>
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 
> 
> 

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


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



Shared string resources

2009-03-11 Thread Seven Corners

I have some strings that I'd like to access from a common string table that
is not tied to any particular component.  How can I do this?
-- 
View this message in context: 
http://www.nabble.com/Shared-string-resources-tp22462537p22462537.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Shared string resources

2009-03-11 Thread Seven Corners

Thanks so much!


Seven Corners wrote:
> 
> I have some strings that I'd like to access from a common string table
> that is not tied to any particular component.  How can I do this?
> 

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


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



Ajax table/grid questions

2009-03-06 Thread Seven Corners

I have to write a table that updates via AJAX on a timer that polls data from
the server (the data comes as collection, not as a database call).  

My first question is what class I need to use; I've looked at a few of the
available classes and I think the AjaxFallbackDefaultDataTable is too
heavyweight because I don't need to sort or page.  I need to use my own CSS
and I also need to set the background colors of cells dependent upon the
values in the model.  It looks like a DataView would be adequate with a
provider that wraps a LoadableDetachableModel if I hook it up to a timer and
set the output markup ID to true.  

So if I'm using a DataView, I get stumped at a point that should be easy. 
All the examples let you instantiate a DataView but I'm using Wicket 1.4-m3
and DataView is abstract, so I'd have to subclass it and provide my own
HTML.  Fine, but I can't figure out how to plug the table into its parent
panel.

So if I have in the enclosing panel:



  
  ...

  



and I've called my DataView subclass StorageUnitAJAXDataView, then in my
enclosing panel, the code:

StorageUnitAJAXDataView dataView = new StorageUnitAJAXDataView(
"storageUnits", new StorageServerUnitsDataProvider( m_strClientRole,
m_strPlatformId ) );

isn't going to work.  According to the sample, I need to make the ID the ID
of the repeating rows.  My HTML for the DataView looks like this:



  
 

  






  


  





  
  


  



So the real question is, since I have to subclass and have a separate HTML
file for the DataView, how do I get the right ID in there?  What should the
HTML look like?

-- 
View this message in context: 
http://www.nabble.com/Ajax-table-grid-questions-tp22379387p22379387.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Dynamically changing CSS style attribute

2009-02-24 Thread Seven Corners

Ooh, that's a good idea, although I just got the JavaScript working to do
exactly the same thing with an appendJavascript() call.


svenmeier wrote:
> 
> Why not keep the fixed settings in a style class and just update the 
> style attribute with the current value (utilizing an AttributeModifier)?
> 
> .Needle {
>   z-index: 1;
>   width: 2px;
>   ...
> }
> 
> 
> 
> Seven Corners schrieb:
>> I have a control with a needle that moves.  The needle's value is
>> continually
>> changing, so on a timer I ask the server its value and set its position
>> with
>> the "left" CSS attribute, as in:
>>
>> .Needle
>> {
>>   z-index: 1;
>>   width: 2px;  
>>   ...
>>   left: 20%;
>> }
>>
>> I do have a bean that returns a percentage string for the value, and I
>> have
>> verified I hit that getter when the update occurs.
>>
>> It looks like I need to create an AttributeModifier for this object's
>> style
>> attribute, and spit out ALL the style attributes in the model, not just
>> the
>> value for the "left" style attribute.  I don't want to do that, because
>> it
>> hard-codes irrelevant styles attributes and I might want to change them
>> in
>> the future.
>>
>> I could use an AttributeAppender, but wouldn't that just add a "left" to
>> the
>> end of the "style" attribute, so that over time (the timer goes off every
>> minute), the "style" attribute would become a really long string?  Don't
>> want to do that either.
>>
>> Is there some way just to tweak a single CSS attribute?
>>
>> Thanks.
>>   
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Dynamically-changing-CSS-style-attribute-tp22187801p22189563.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Dynamically changing CSS style attribute

2009-02-24 Thread Seven Corners

Thanks for responding, but that link is closed to me, and I get this error
message:

"Sorry, but access to this page is closed now.  If you search study
materials or ebooks for cisco certification - request it in our Cisco Career
Certifications forum"

I'm fiddling right now with the JavaScript.  It looks like I'll have to
parse and tweak the style string and then set that attribute.

-- 
View this message in context: 
http://www.nabble.com/Dynamically-changing-CSS-style-attribute-tp22187801p22188808.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Dynamically changing CSS style attribute

2009-02-24 Thread Seven Corners

I have a control with a needle that moves.  The needle's value is continually
changing, so on a timer I ask the server its value and set its position with
the "left" CSS attribute, as in:

.Needle
{
  z-index: 1;
  width: 2px;  
  ...
  left: 20%;
}

I do have a bean that returns a percentage string for the value, and I have
verified I hit that getter when the update occurs.

It looks like I need to create an AttributeModifier for this object's style
attribute, and spit out ALL the style attributes in the model, not just the
value for the "left" style attribute.  I don't want to do that, because it
hard-codes irrelevant styles attributes and I might want to change them in
the future.

I could use an AttributeAppender, but wouldn't that just add a "left" to the
end of the "style" attribute, so that over time (the timer goes off every
minute), the "style" attribute would become a really long string?  Don't
want to do that either.

Is there some way just to tweak a single CSS attribute?

Thanks.
-- 
View this message in context: 
http://www.nabble.com/Dynamically-changing-CSS-style-attribute-tp22187801p22187801.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Setting TreeState in new page

2009-02-13 Thread Seven Corners

Never mind, I figured it out.  Caching the TreeState didn't get me there
because it didn't contain the information I needed.  I had to do my own
bookkeeping, but overriding LinkTree.newTreeState() was ultimately where
things got set aright.
-- 
View this message in context: 
http://www.nabble.com/Setting-TreeState-in-new-page-tp21996538p22003438.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Setting TreeState in new page

2009-02-13 Thread Seven Corners

I have a LinkTree where each node contains links to pages, and each of these
pages derives from the same base class, so they all contain that LinkTree. 
When a user drills down into the tree on one page and then clicks a link for
another page, I'd like the new page we go to to open the tree to its state
in the last page.

I can save the TreeState to the session and retrieve it in the new page, but
that's not the problem.

Right now, in the new page, the new tree displays collapsed.  When you leave
your constructor, only the topmost tree node has been constructed.  The node
I want to drill down to isn't created until you click on a junction link.

I could have designed this where the application has only one URL and only
the right-hand panel changes as you click through AjaxLinks -- and I had
that working with a minimum of trouble, but then I learned I have a
requirement that each "view" of the system -- i.e., where the right-hand
panel shows different content -- must correspond to a bookmarkable link. 
This requirement also eliminates the option of using frames wherein the
navigation tree stays the same and the part that's supposed to change, the
right-hand panel, is the target of the links.

So how do I open up my tree when I get to the new page?

Thanks for your help.


-- 
View this message in context: 
http://www.nabble.com/Setting-TreeState-in-new-page-tp21996538p21996538.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



LinkTree with BookmarkablePageLinks

2009-02-11 Thread Seven Corners

I have a LinkTree with BookmarkablePageLinks, wherein the nodes correspond to
different types of objects.  The models within the nodes tell me what kind
of page I need to instantiate, with what parameters.  I had some troubles
implementing it, but I got it working.  Since this kind of pattern is common
within UIs and I have been helped on other occasions by people here, I'm
posting what I figured out in order to give back to the community.

public class MyLinkTree extends LinkTree
{
public MyLinkTree(String id, TreeModel model)
{
super(id, model);
setLinkType(
org.apache.wicket.markup.html.tree.BaseTree.LinkType.REGULAR );
}

@Override
protected Component newNodeComponent( String id, IModel model )
{
return new LinkIconPanel( id, model, MyLinkTree.this )
{
private static final long serialVersionUID = 1L;

@Override
protected void addComponents( final IModel model, final BaseTree
tree )
{
final Object obj = ( ( DefaultMutableTreeNode
)model.getObject() ).getUserObject(); 

BaseTree.ILinkCallback callback = new
BaseTree.ILinkCallback() 
{ 
private static final long serialVersionUID = 1L;

public void onClick( AjaxRequestTarget target ) 
{ 
PageParameters params = new PageParameters(); 
if ( obj instanceof BeanA )
{
   
target.appendJavascript("window.location="+MyLinkTree.this.urlFor(
PageA.class, params ) );
}
else if ( obj instanceof BeanB )
{
params.add( "myParamKey", "myParamVal" );
   
target.appendJavascript("window.location="+MyLinkTree.this.urlFor(
PageB.class, params ) );
}
}
};

MarkupContainer iconContainer = tree.newLink( "iconLink",
callback ); 
iconContainer.add(newImageComponent("icon", tree, model)); 
add( iconContainer );

PageParameters params = new PageParameters(); 
if ( obj instanceof BeanA )
{
final BeanA myBean = ( BeanA )obj;
BookmarkablePageLink contentLink = new
BookmarkablePageLink( "contentLink", PageA.class, params );
contentLink.add( new Label( "content", 
myBean.toString() )
);
add( contentLink );
}
else if ( obj instanceof BeanB )
{
final BeanB myBean = ( BeanB )obj;
params.add( "myParamKey", "myParamVal" );
BookmarkablePageLink contentLink = new
BookmarkablePageLink( "contentLink", PageB.class, params );
add( contentLink );
}
}
};
}
}
-- 
View this message in context: 
http://www.nabble.com/LinkTree-with-BookmarkablePageLinks-tp21962723p21962723.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Flicker on AJAX tree updates

2009-01-29 Thread Seven Corners

I have a LinkTree where the nodes represent systems, servers, or services
within a system.  The nodes have specific images associated with their
semantics and their health, and the health is polled at intervals to see if
I need to change the resource, e.g., to represent if a server is down.  I
have the code working but there's a lot of flicker whenever the timer goes
off.  It looks like under the scenes, the table repaints itself completely,
contracts to the root node and expands again to its previous state.  The
timers are associated with each node, so I don't see why the whole tree
should repaint.

I've added logic so we only change the image resource references when the
health actually changes, so theoretically the tree should never repaint if
it's just sitting there without anyone clicking it and the health doesn't
change.

Here is some of my code.  Is it obvious what I'm doing wrong?  Thanks for
your time.

public class SystemLinkTree extends LinkTree
{
...
protected Component newNodeComponent(java.lang.String id, IModel model)
{
return new LinkIconPanel(id, model, SystemLinkTree.this)
{
private static final long serialVersionUID = 1L;

@Override
protected Component newImageComponent(java.lang.String
componentId, BaseTree tree, IModel model)
{
Object obj = ( ( DefaultMutableTreeNode 
)model.getObject()
).getUserObject();
if ( obj instanceof PlatformInfoBean )
{
PlatformInfoBean.eRole role =
((PlatformInfoBean)obj).getRole();
switch ( role )
{
case system:
{   
final Image img = new Image(
componentId, getSystemStatusIcon(((PlatformInfoBean)obj).getSystemHealth())
);
img.setOutputMarkupId(true);
hashImageToHealth.put( img.getMarkupId(
true ), ((PlatformInfoBean)obj).getSystemHealth() );
img.add( new
AjaxSelfUpdatingTimerBehavior(standardUpdateDuration)
{
@Override
protected void
onPostProcessTarget(AjaxRequestTarget target)
{
final String strRole =
((SignInSession)Session.get()).getRoleName();
ServiceHealth.Health previousHealth =
hashImageToHealth.get( img.getMarkupId( true ) );
ServiceHealth.Health currentHealth =
getSystemHealth( strRole );
if ( previousHealth != currentHealth )
{
hashImageToHealth.put(
img.getMarkupId(), currentHealth );
img.setImageResourceReference(
getSystemStatusIcon( currentHealth ) );
}
}
});  
return img;
}
case access:
case storage:
final Image img = new Image( componentId,
getPlatformStatusIcon(((PlatformInfoBean)obj).getSystemHealth()) );
img.setOutputMarkupId( true );
hashImageToHealth.put( img.getMarkupId( true ),
((PlatformInfoBean)obj).getSystemHealth() );
hashPlatformImages.put( img.getMarkupId( true ),
(PlatformInfoBean)obj);
img.add( new
AjaxSelfUpdatingTimerBehavior(standardUpdateDuration)
{
@Override
protected void
onPostProcessTarget(AjaxRequestTarget target)
{
final String clientRole =
((SignInSession)Session.get()).getRoleName();   
 
ServiceHealth.Health previousHealth =
hashImageToHealth.get( img.getMarkupId( true ) );
try
{
ServiceHealth.Health currentHealth =
PlatformAdapter.getPlatformAggregateHealth( clientRole,
hashPlatformImages.get( img.getMarkupId( true ) ).getId()
).getSystemHealth();
if ( previousHealth != 
currentHealth )
{   

hashImageToHealth.

Re: Links with CGI parameters?

2008-10-14 Thread Seven Corners

OK, just to remind you, the problem here is making a LinkTree work within a
frameset, where the links may have CGI parameters.  

Having tried Randy's suggestion, which I think brings me most of the way, I
get a runtime exception, so there's still a little bit to hammer out.  I'm
wondering if the problem is that my page isn't in the PageMap, and if I have
to add it, and if I have to instantiate the page using reflection to add it
to the PageMap.

Here's the exception:

java.lang.IllegalStateException: No Page found for component
[MarkupContainer [Component id = nodeComponent, page = , path =
nodeComponent.FrameLabelIconPanel]]
 at org.apache.wicket.Component.getPage(Component.java:1706)
 at org.apache.wicket.Component.urlFor(Component.java:3211)
 ...
 
This occurs in the course of my addComponents() call:

public class FrameLabelIconPanel extends Panel 
{
private static final long serialVersionUID = 1L;

public FrameLabelIconPanel( String id, IModel model, FrameLinkTree tree,
final HorizontalFrameset responsePage )
{
super(id, model);
addComponents(model, tree, responsePage );  
}

/*
 * This fires for the icon
 */
protected void addComponents(IModel model, FrameLinkTree tree)
{
add(newImageComponent("icon", tree, model));
add(newContentComponent("content", tree, model));
}

/*
 * Here's the meat of the problem
 */
protected void addComponents( final IModel model, final FrameLinkTree 
tree,
final HorizontalFrameset responsePage )
{
BaseTree.ILinkCallback callback = new BaseTree.ILinkCallback()
{
private static final long serialVersionUID = 1L;

public void onClick(AjaxRequestTarget target)
{
onNodeLinkClicked(model.getObject(), tree, target);
}
};

MarkupContainer iconContainer = tree.newLink("iconLink", callback);
iconContainer.add(newImageComponent("icon", tree, model));
add( iconContainer );

SystemTreeNodeBean innerModel = ( SystemTreeNodeBean )( (
DefaultMutableTreeNode )model.getObject() ).getUserObject();
SystemTreeNodeBean.SystemNodeType nodeType = 
innerModel.getNodeType();
Class pageClass = 
getPageClass( nodeType
);

MarkupContainer link = null;
PageParameters params = null;
if ( innerModel.hasServiceId() )
{
params = new PageParameters();
params.put( "serviceid", innerModel.getServiceId() );

//> Here's where we crash
String strTargetURL = RequestUtils.toAbsolutePath( urlFor(
pageClass, params ).toString() );
link = tree.newLink( "contentLink", strTargetURL );
}
else
{
// No parameters, works fine
link = tree.newLink("contentLink", responsePage, pageClass );   

}

link.add(newContentComponent("content", tree, model));

add(link);
}

Trace into the Wicket source code and you crash here:

public abstract class Component implements IClusterable, IConverterLocator
{
...
public final  CharSequence urlFor(final Class 
pageClass,
final PageParameters parameters)
{
    return getRequestCycle().urlFor(getPage().getPageMap(), 
pageClass,
parameters);
}
}   
 

Seven Corners wrote:
> 
> Well I was really grateful for that.  I've tried both alternatives and
> neither works but I think maybe I just have to fiddle with them a bit. 
> Just getting back to you before the end of the day.
> 
> Thanks for the response.
> 
> 
> 
> Randy Hammelman wrote:
>> 
>> This will probably work for you:
>> 
>> Isn't there a version of setResponsePage that takes a PageParameters
>> object?
>> 
>> setResponsePage(Page.class, pageParameters);
>> 
>> Otherwise, you can construct a url for a page with parameters using the
>> following code:
>> 
>> PageParameters params = new PageParameters();
>> params .put(PARAM_NAME, PARAM_VALUE);
>> String targetURL =
>> RequestUtils.toAbsolutePath(urlFor(YOUR_CLASS.class,params ).toString());
>> 
>> Use a link, such as ExternalLink, that takes a url.
>> 
>> 
>> Hope this helps.
>> 
>> 
>> On Fri, Oct 10, 2008 at 1:39 PM, Seven Corners <[EMAIL PROTECTED]>
>> wrote:
>> 
>>>
>>> I have figured out the considerable gyrations to subclass a LinkTre

Re: Links with CGI parameters?

2008-10-13 Thread Seven Corners

Well I was really grateful for that.  I've tried both alternatives and
neither works but I think maybe I just have to fiddle with them a bit.  Just
getting back to you before the end of the day.

Thanks for the response.



Randy Hammelman wrote:
> 
> This will probably work for you:
> 
> Isn't there a version of setResponsePage that takes a PageParameters
> object?
> 
> setResponsePage(Page.class, pageParameters);
> 
> Otherwise, you can construct a url for a page with parameters using the
> following code:
> 
> PageParameters params = new PageParameters();
> params .put(PARAM_NAME, PARAM_VALUE);
> String targetURL =
> RequestUtils.toAbsolutePath(urlFor(YOUR_CLASS.class,params ).toString());
> 
> Use a link, such as ExternalLink, that takes a url.
> 
> 
> Hope this helps.
> 
> 
> On Fri, Oct 10, 2008 at 1:39 PM, Seven Corners <[EMAIL PROTECTED]>
> wrote:
> 
>>
>> I have figured out the considerable gyrations to subclass a LinkTree so
>> its
>> leaves contain links that will change the page in another frame within a
>> frameset, and I'm doing this with regular Links (i.e., href and target
>> attributes, and setting the response page and the frame target's page
>> class
>> from Link.onClick(), as Eelco does in his Frames example):
>>
>> public class FrameLinkTree extends LinkTree
>> {
>>...
>>public MarkupContainer newLink( String strId, final HorizontalFrameset
>> frameset, final Class pageClass )
>>{
>>Link link = new Link( strId )
>>{
>>private static final long serialVersionUID = 1L;
>>
>>@Override
>>public void onClick()
>>{
>>frameset.getFrameTarget().setFrameClass( pageClass );
>>
>>// trigger re-rendering of the page
>>setResponsePage( frameset );
>>}
>>};
>>link.add( new SimpleAttributeModifier( "target", "_parent" ) );
>>return link;
>>}
>> }
>>
>> However, my pages need a parameter in their constructors, so I'll need to
>> pass that parameter from the link.  It looks like the only link type that
>> takes parameters is the BookmarkablePageLink.  I would use this class so
>> I
>> could pass the parameters, only the BookmarkablePageLink doesn't use the
>> onClick().  There's a comment in the BookmarkablePageLink code that
>> BookmarkablePageLinks "are dispatched by the request handling servlet",
>> so
>> there's no way I can override that.
>>
>> So is there any way I can get a parameter on a Link, or is there any way
>> I
>> can set the frame target and response page on a BookmarkablePageLink?
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Links-with-CGI-parameters--tp19923784p19923784.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]
>>
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Links-with-CGI-parameters--tp19923784p19960812.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]



Links with CGI parameters?

2008-10-10 Thread Seven Corners

I have figured out the considerable gyrations to subclass a LinkTree so its
leaves contain links that will change the page in another frame within a
frameset, and I'm doing this with regular Links (i.e., href and target
attributes, and setting the response page and the frame target's page class
from Link.onClick(), as Eelco does in his Frames example):

public class FrameLinkTree extends LinkTree 
{
...
public MarkupContainer newLink( String strId, final HorizontalFrameset
frameset, final Class pageClass )
{
Link link = new Link( strId )
{
private static final long serialVersionUID = 1L;

@Override
public void onClick()
{
frameset.getFrameTarget().setFrameClass( pageClass );

// trigger re-rendering of the page
setResponsePage( frameset );
}
};
link.add( new SimpleAttributeModifier( "target", "_parent" ) );
return link;
}
}

However, my pages need a parameter in their constructors, so I'll need to
pass that parameter from the link.  It looks like the only link type that
takes parameters is the BookmarkablePageLink.  I would use this class so I
could pass the parameters, only the BookmarkablePageLink doesn't use the
onClick().  There's a comment in the BookmarkablePageLink code that
BookmarkablePageLinks "are dispatched by the request handling servlet", so
there's no way I can override that.

So is there any way I can get a parameter on a Link, or is there any way I
can set the frame target and response page on a BookmarkablePageLink?

-- 
View this message in context: 
http://www.nabble.com/Links-with-CGI-parameters--tp19923784p19923784.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: html code in component class

2008-10-10 Thread Seven Corners

Thank you, Serkan, for posting this solution.  It's very slick.  I have been
wrestling with trying to figure out how to slip a link into a panel when I
don't know until runtime what the link will be and you've just told me how
to slip in HTML at runtime.  I love it!

Shelah


Serkan Camurcuoglu-3 wrote:
> 
> Peter means that you can put html as the string content of a label like
> this:
> 
> Label l = new Label("myLabel", "Some html here");
> l.setEscapeModelStrings(false);
> l.setRenderBodyOnly(true);
> 
> this way the label will display only the html that you've given..
> 
> 
> 
> -Original Message-
> From: miro [mailto:[EMAIL PROTECTED]
> Sent: Fri 10/10/2008 12:20 AM
> To: users@wicket.apache.org
> Subject: Re: html code in component class
>  
> 
> here the html again
> 
> 
>   
>  
>   
>   
>  
>   
> hml for repeater
> 
>   
>wicket:id="link"> 
>   
> please ignore t with every tag its just to show actual html
> 
> miro wrote:
>> 
>> Its not just label   here is the html
>> 
>>  
>> 
>>  
>>  
>> 
>>  
>> hml for repeater
>> 
>>  
>>   # > wicket:id="lbl"> 
>>  
>> 
>> 
>> instead of writing the same html  at 10 paqlces  i want to write it once
>> and reuse it in the please twell me how ?
>> 
>> 
>> 
>> Peter Ertl-3 wrote:
>>> 
>>> If it's just a line use Label
>>> 
>>> Am 09.10.2008 um 21:01 schrieb miro:
>>> 

 Using panel I have to write a .html   file which I dont want to do  
 becasue my
 html code is very little just a line   ,
 next option is Fragment but this is not clear, neither the api doc  
 nor the
 wicket examples  please can you give me small example  using  
 fragment   ?

 jwcarman wrote:
>
> What's wrong with using a panel?  If this is to be done in only one
> class, have you thought about using a Fragment?
>
> On Thu, Oct 9, 2008 at 2:28 PM, miro <[EMAIL PROTECTED]> wrote:
>>
>> the label appears complex i looking for a simple solution
>>
>> My custom componentuses wicket components internally  here is an
>> example
>>
>>   protected class CustomLinkComponent extends   
>> WebMarkupContainer  {
>>   String displayName;
>>   Class  clazz;
>>   public CustomLinkComponent(String displayName, Class
>> clazz) {
>>   super("customlink");
>>   this.displayName=displayName;
>>   this.clazz=clazz;
>>   add(getBookmarkablePageLink());
>>   add(getDisplayNameLabel());
>>   }
>>   protected BookmarkablePageLink   
>> getBookmarkablePageLink(){
>>   return new BookmarkablePageLink("link",  
>> clazz);
>>   }
>>   protected  Label  getDisplayNameLabel(){
>>   return new Label("lbl",displayName);
>>   }
>>
>>   }
>>
>> the html  for this is
>> # 
>>
>> so instead of writing a html page  i want my component to render  
>> this
>> html
>> and further wicket should replace the child components  link and  
>> lbl with
>> actual values  ,  can I do this ?
>>
>>
>>
>>
>> jwcarman wrote:
>>>
>>> Sure.  Look at what the Label class does.  It doesn't have an HTML
>>> template.
>>>
>>> On Thu, Oct 9, 2008 at 1:49 PM, miro <[EMAIL PROTECTED]> wrote:

 like I have  very little html and I dont want a write a  new .html
 file
 and
 just in my component i want to override some method  which  
 returns html
 as
 string  for the component .Is  this possible ?
 --
 View this message in context:
 http://www.nabble.com/html-code-in-component-class-tp19903944p19903944.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


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


>>>
>>> -
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.c

Set link target within LinkTree nodes

2008-10-08 Thread Seven Corners

I'm generating a LinkTree that will sit in the left frame of a frameset.  I
want the leaf nodes to contain links to pages that will open in the right
frame of the frameset.  The LinkTree has a few link types but there is no
built-in support for setting the link's target.

Eelco has a nice example for frames linkage, where he uses a special class,
ChangeFramePageLink, to set the frame target of the link.  I'm not sure how
to plug in that kind of behavior to the LinkTree.  I think I have to tweak
the link by hand.

I don't see how to set a link at all on the LinkTree, never mind setting the
target.  Do I need to override the LinkTree.newLink()?  Or
LinkTree.populateTreeItem()?  What is the right way to approach this?

Thanks for your help.
-- 
View this message in context: 
http://www.nabble.com/Set-link-target-within-LinkTree-nodes-tp19882571p19882571.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 on Tomcat?

2008-10-07 Thread Seven Corners

You can deploy with Tomcat but you can't use the standard Tomcat deployment
tree; that is, something like this won't work:

.../webapps
  -  mywebapp
 - WEB-INF
- classes
- html
- images
- styles
- scripts

You have to put the html for a given class in the same directory as the
class file.  The CSS, images and scripts can go in directories below that,
but they can't be above.  So when your warfile expands, the directory
structure should be something like this:
...
- classes
   - com/mycompany/myproject/
 - myapp.class
   myclass.class
   myclass.html
   - styles
 style.css
   - images
 myimage.jpg

Again, your classes could be in directories below your application class,
but any resources they need must be parallel or below.

It is possible to create an Eclipse project to work with this but I didn't
have good luck with WicketPanda.  I found it got in my way, put things in
places where I couldn't use them anyway, and burned up a lot of time, so I
just create the files I need by hand.  Our deployment creates its own tomcat
tree so the Eclipse Tomcat plugin is of no help to me (it would be a
different instance of Tomcat) so I debug by attaching to the running Tomcat
process.

To debug, you have to set JPDA_SUSPEND to "y" in catalina.sh and use the
command "catalina.sh jpda start" to start up Tomcat.  Then you fire up the
Eclipse debugger, then you open up a browser and point to your website.  

Good luck!



Vernon-13 wrote:
> 
> I just dip into Wicket. I notice that Wicket setup exclusively with Jetty,
> for example, the quick start page
> http://wicket.apache.org/quickstart.html. Can I create an Eclipse project
> for TC instead of Jetty?  
> 
> 
> 
>   
> 

-- 
View this message in context: 
http://www.nabble.com/Wicket-on-Tomcat--tp19848408p19857232.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]



Intermittently not updating TextField

2008-10-06 Thread Seven Corners

I have a form where one of my text fields intermittently doesn't update when
I change the model, even though I add the component to the AJAX target. 
Most of the time it works.  When you add a few fields to the ListChoice,
this is where things get dicey.

Here's the scenario: you have a ListChoice of user names and a series of
text fields with data about each user.  When you click on a name in the
ListChoice, we use the username as a key and ask the server for the rest of
the data on that user, which I fluff into a UserBean object, whose data is
the model for my TextFields.  Then I use AJAX to update the fields:

// Instantiate the TextFields
txtUserName = new TextField( "txtUserName", new
PropertyModel( selectedUser, "userName" ) );
txtUserName.setOutputMarkupId( true );
acctForm.add( txtUserName );  
...
txtEmail = new TextField( "txtEmail", new
PropertyModel( selectedUser, "email" ) );
txtEmail.setOutputMarkupId( true );
...
acctForm.add( txtEmail );

// Set up the ListChoice and its onChange behavior
listCtrlUsers = new ListChoice( "userNames", new
PropertyModel( selectedUser, "userName" ), userNames );
listCtrlUsers.add( new AjaxFormComponentUpdatingBehavior( "onchange" )
{
protected void onUpdate( AjaxRequestTarget target )
{
selectedUser = new UserBean( UserAdapter.getUser(
listCtrlUsers.getModelObject() ) );
txtUserName.setModelObject( selectedUser.getUserName() ); 
txtEmail.setModelObject( selectedUser.getEmail() ); 
txtPhoneNo.setModelObject( selectedUser.getPhoneNo() ); 
...
target.addComponent( txtUserName );
target.addComponent( txtEmail );
target.addComponent( txtPhoneNo );
...
}
}
listCtrlUsers.setOutputMarkupId( true );
acctForm.add( listCtrlUsers );

The UserBean is straightforward accessors:

private class UserBean
{
public UserBean( final User user )
{
userName = user.getUserName();
phoneNo = user.getPhoneNo();
email = user.getEmail();
...
}

public String getUserName()
{
return userName;
}

public void setUserName( String strName )
{
userName = strName;
}
...
}

Now, you are able to add to or delete from the ListChoice via calls to the
server that add or delete users, and the ListChoice USUALLY (but not always)
updates.  Of course, when it doesn't update it's obvious why everything
falls apart but the fact that it doesn't always update is problemmatic and
similar to the issue where the TextField doesn't update.

Does anyone have any ideas about this?

Thank you for your trouble and time.
-- 
View this message in context: 
http://www.nabble.com/Intermittently-not-updating-TextField-tp19845008p19845008.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]



How to expose regular exception message in FeedbackPanel?

2008-10-06 Thread Seven Corners

I have a form whose submission can possibly generate exceptions.  I would
like to expose the exception text in the FeedbackPanel.  How can I do this?

I've tried getting the FeedbackMessagesModel and doing a setObject() on that
but it's not accepting a String, a FeedbackMessages List, or a new
FeedbackMessage.  Obviously I'm going about this the wrong way.

Ideas?

Thanking you in advance for your time and trouble.
-- 
View this message in context: 
http://www.nabble.com/How-to-expose-regular-exception-message-in-FeedbackPanel--tp19843597p19843597.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: How to update ListChoice after form submission?

2008-10-04 Thread Seven Corners

Thank you, Igor.  That did work; adding the ListChoice as a target component
does get the AJAX to update properly.  I am grateful for your help.

I had been trying to do it without AJAX, for the sake of browsers that don't
allow JavaScript.  Now, let me understand why it didn't work without AJAX. 
I thought that since the page after the submit was a copy of the original
page, that we would do a round trip on submission.  I thought we'd hit the
constructor again and a trace shows we don't.  I had thought the new page
would load up whatever was in the models, and if I changed the model content
before the submit was over, the new data should show up.  Since it didn't,
does this mean that the new page uses what's in the HTML rather than what's
in the model?  Or does it mean that even in a non-AJAX page, only the
controls you add as onSubmit targets get updated with the model contents?


igor.vaynberg wrote:
> 
> it doesnt have an onclick() but it does have an onsubmit().
> 
> i suggest you take a look at how ajax examples work in our examples
> project. if you want to repaint some part of the screen when you press
> an ajax button you have to add that part to the ajax request target
> using target.addcomponent() - that is how you tell wicket what to
> repaint...
> 
> -igor
> 
> On Fri, Oct 3, 2008 at 5:52 AM, Shelah Horvitz
> <[EMAIL PROTECTED]> wrote:
>> Thank you, Igor, for getting back to me so quickly.  Actually, thank you
>> for answering at all.
>>
>> I thought of the onclick handler, but the AjaxFallbackButton doesn't have
>> an onClick() function.  It does have a getOnClickScript() which I can
>> override, but I believe the timing will be off.  I think it will fire
>> before the form is submitted.  Hold on, I think I get what you're saying:
>> write some JavaScript AJAX for the onclick script that will call whatever
>> routines I need to create the user and then update the ListChoice's
>> model.  I don't need to do anything with the onSubmit() overload.  Is
>> that what you're saying?  I will try it.  I think it's a good idea.
>>
>> An interesting aspect of this solution is that I don't think I even need
>> a form.  I think the validation of control inputs would happen after the
>> onclick handler returns.  I think this is a strictly roll-your-own
>> solution.
>>
>> Have I got it right?
>>
>> 
>> From: Igor Vaynberg [EMAIL PROTECTED]
>> Sent: Thursday, October 02, 2008 4:42 PM
>> To: users@wicket.apache.org
>> Subject: Re: How to update ListChoice after form submission?
>>
>> inside the onclick of your ajaxfallbackbutton you have to add the
>> listchoice to the target so wicket rerenders it
>>
>> -igor
>>
>> On Thu, Oct 2, 2008 at 12:49 PM, Seven Corners <[EMAIL PROTECTED]>
>> wrote:
>>>
>>> I have a page with a ListChoice of user names that is populated with a
>>> call
>>> to our server (loadUserNames()).  The page also contains a number of
>>> TextFields corresponding to the user's other attributes.  When you
>>> modify
>>> those text fields so the user name doesn't correspond to anything in the
>>> list, the Add AjaxFallbackButton enables.  Click this, and you make a
>>> call
>>> to the server which creates the new user.
>>>
>>> The new user does not show up in the ListChoice.  If you refresh the
>>> page,
>>> it does, so we know it's created, and we know that loadUserNames() will
>>> return the correct list if it were called and its values were used..  I
>>> want
>>> the new user name to show up in the ListChoice after submission, and I'd
>>> like to be able to set the selection in the ListChoice to the new user.
>>> I've tried giving the ListChoice a LoadableDetachableModel, I've tried
>>> giving it an ArrayList model with a call to loadUserNames() and
>>> setChoices()
>>> on the ListChoice after submission, I've tried a
>>> AjaxFormComponentUpdatingBehavior( "onsubmit" ), hoping this might fire
>>> after submission, I've tried using a call to
>>> getRequestCycleSettings().setRenderStrategy(IRequestCycleSettings.ONE_PASS_RENDER)
>>> in my application class's init() method, I've tried a ton of things and
>>> I
>>> can't figure this out.
>>>
>>> Any ideas?
>>> --
>>> View this message in context:
>>> http://www.nabble.com/How-to-u

How to update ListChoice after form submission?

2008-10-02 Thread Seven Corners

I have a page with a ListChoice of user names that is populated with a call
to our server (loadUserNames()).  The page also contains a number of
TextFields corresponding to the user's other attributes.  When you modify
those text fields so the user name doesn't correspond to anything in the
list, the Add AjaxFallbackButton enables.  Click this, and you make a call
to the server which creates the new user.

The new user does not show up in the ListChoice.  If you refresh the page,
it does, so we know it's created, and we know that loadUserNames() will
return the correct list if it were called and its values were used..  I want
the new user name to show up in the ListChoice after submission, and I'd
like to be able to set the selection in the ListChoice to the new user. 
I've tried giving the ListChoice a LoadableDetachableModel, I've tried
giving it an ArrayList model with a call to loadUserNames() and setChoices()
on the ListChoice after submission, I've tried a
AjaxFormComponentUpdatingBehavior( "onsubmit" ), hoping this might fire
after submission, I've tried using a call to
getRequestCycleSettings().setRenderStrategy(IRequestCycleSettings.ONE_PASS_RENDER)
in my application class's init() method, I've tried a ton of things and I
can't figure this out.

Any ideas?
-- 
View this message in context: 
http://www.nabble.com/How-to-update-ListChoice-after-form-submission--tp19786374p19786374.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]