Markup for Disabled Panels and Pages

2009-07-24 Thread Zhubin Salehi
Hi all,

I was wondering if there is a way to change a panel's or page's markup or even 
class when it is disabled. I have two versions of some of my panels and pages: 
a XXXViewPanel/Page and a XXXEditPanel/Page. The view-only version has labels 
instead of dropdown menus and text fields. Based on user's roles some 
pages/panels might be view-only for some users and editable for some others. Is 
there a way that I can substitute a panel or page when it is disabled?

Thanks,
Zhubin


Re: Markup for Disabled Panels and Pages

2009-07-24 Thread Igor Vaynberg
a couple of ways jump to mind.

if all you really want is to swap out markup you can do

class mypanel extends panel {
   String getVariant() { if (!isenabled()) { return disabled; } else
{return null;}}
}

and have mypanel_disabled.html which will be used when the panel is disabled.


if you want to swap out the panel itself you can do something like this:

class vieweditpanel extends panel {
 panel current;

 protected void onbeforerender() {
boolean edit=isenabled();
boolean installedit=false;
boolean installview=false;
if (current==null) {
   installedit=edit; installview=!installedit;
} else {
if (edit!(current instanceof editpanel)) {
   installedit=true;
   } else if (!edit(!current instanceof viewpanel)) {
   installview=true;
   }
}

if (installedit) {current=new editpanel(...); addorreplace(current);}
else if(installview) {current=new viewpanel(...);
addorreplace(current);}


   }
}

-igor


On Thu, Jul 23, 2009 at 9:44 AM, Zhubin Salehizhooz...@yahoo.com wrote:
 Hi all,

 I was wondering if there is a way to change a panel's or page's markup or 
 even class when it is disabled. I have two versions of some of my panels and 
 pages: a XXXViewPanel/Page and a XXXEditPanel/Page. The view-only version has 
 labels instead of dropdown menus and text fields. Based on user's roles some 
 pages/panels might be view-only for some users and editable for some others. 
 Is there a way that I can substitute a panel or page when it is disabled?

 Thanks,
 Zhubin


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



Markup for Disabled Panels and Pages

2009-07-23 Thread Zhubin Salehi
Hi all,

I was wondering if there is a way to change a panel's or page's markup or even 
class when it is disabled. I have two versions of some of my panels and pages: 
a XXXViewPanel/Page and a XXXEditPanel/Page. The view-only version has labels 
instead of dropdown menus and text fields. Based on user's roles some 
pages/panels might be view-only for some users and editable for some others. Is 
there a way that I can substitute a panel or page when it is disabled?

Thanks,
Zhubin



Zhubin Salehi
Senior Software Engineer
Route1 - Securing the Digital World(tm)
Phone: 416-848-8391 ext. 2262
Mobile: (optional)

This electronic mail transmission contains information from Route1 Inc. that is 
for the sole use of the intended recipient and may contain confidential, 
privileged or proprietary information. If you are not the intended recipient, 
please be aware that any disclosure, copying, distribution or use of this 
message, its contents, or any attachment is prohibited. Any wrongful 
interception of this message is punishable as a federal crime. If you have 
received this message in error, please return a copy to the sender by 
electronic mail indicating the error. Then, please destroy the original message 
and any copies from your computer.


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



Re: Markup for Disabled Panels and Pages

2009-07-23 Thread Fernando Wermus
When it is disabled you might want to set invisible it and set visible the
another panel?

On Thu, Jul 23, 2009 at 10:24 AM, Zhubin Salehi zhubin.sal...@route1.comwrote:

 Hi all,

 I was wondering if there is a way to change a panel's or page's markup or
 even class when it is disabled. I have two versions of some of my panels and
 pages: a XXXViewPanel/Page and a XXXEditPanel/Page. The view-only version
 has labels instead of dropdown menus and text fields. Based on user's roles
 some pages/panels might be view-only for some users and editable for some
 others. Is there a way that I can substitute a panel or page when it is
 disabled?

 Thanks,
 Zhubin


 
 Zhubin Salehi
 Senior Software Engineer
 Route1 - Securing the Digital World(tm)
 Phone: 416-848-8391 ext. 2262
 Mobile: (optional)

 This electronic mail transmission contains information from Route1 Inc.
 that is for the sole use of the intended recipient and may contain
 confidential, privileged or proprietary information. If you are not the
 intended recipient, please be aware that any disclosure, copying,
 distribution or use of this message, its contents, or any attachment is
 prohibited. Any wrongful interception of this message is punishable as a
 federal crime. If you have received this message in error, please return a
 copy to the sender by electronic mail indicating the error. Then, please
 destroy the original message and any copies from your computer.


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




-- 
Fernando Wermus.

www.linkedin.com/in/fernandowermus


RE: Markup for Disabled Panels and Pages

2009-07-23 Thread Zhubin Salehi
I think this is a better idea that using two different pages. I can use both 
editable and non-editable panels in the same page and make one of them 
invisible. Thanks!

Zhubin

-Original Message-
From: Fernando Wermus [mailto:fernando.wer...@gmail.com]
Sent: Thursday, July 23, 2009 2:06 PM
To: users@wicket.apache.org
Subject: Re: Markup for Disabled Panels and Pages

When it is disabled you might want to set invisible it and set visible the
another panel?

On Thu, Jul 23, 2009 at 10:24 AM, Zhubin Salehi zhubin.sal...@route1.comwrote:

 Hi all,

 I was wondering if there is a way to change a panel's or page's markup or
 even class when it is disabled. I have two versions of some of my panels and
 pages: a XXXViewPanel/Page and a XXXEditPanel/Page. The view-only version
 has labels instead of dropdown menus and text fields. Based on user's roles
 some pages/panels might be view-only for some users and editable for some
 others. Is there a way that I can substitute a panel or page when it is
 disabled?

 Thanks,
 Zhubin


 
 Zhubin Salehi
 Senior Software Engineer
 Route1 - Securing the Digital World(tm)
 Phone: 416-848-8391 ext. 2262
 Mobile: (optional)

 This electronic mail transmission contains information from Route1 Inc.
 that is for the sole use of the intended recipient and may contain
 confidential, privileged or proprietary information. If you are not the
 intended recipient, please be aware that any disclosure, copying,
 distribution or use of this message, its contents, or any attachment is
 prohibited. Any wrongful interception of this message is punishable as a
 federal crime. If you have received this message in error, please return a
 copy to the sender by electronic mail indicating the error. Then, please
 destroy the original message and any copies from your computer.


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




--
Fernando Wermus.

www.linkedin.com/in/fernandowermus

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