Just extended my first jsf component. but in the right way?
Hi all,
After days of trial and error, i finally managed to code my own JSF component, extending existing infrastructure. Since things just suddenly fell in place during a brute force approach to make it work, i'd like to ask for opinions of seasoned JSF veterans whether this makes sense or there is a better way to do things.
The objective was to be able to render a collection of items as a comma separated list. To this end, I took an existing data iterator UIComponent from richfaces, added a custom renderer -- again extending on richfaces, and hooked things up in 2 config files, as follows:
CsvRenderer.java:
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import org.ajax4jsf.component.UIDataAdaptor;
import org.richfaces.renderkit.AbstractRowsRenderer;
import org.richfaces.renderkit.TableHolder;
/** Renders a richfaces UIDataList component as a comma separated list */
public class CsvRenderer extends AbstractRowsRenderer {
@Override
public void encodeOneRow(FacesContext context, TableHolder holder) throws IOException {
UIDataAdaptor table = holder.getTable();
ResponseWriter writer = context.getResponseWriter();
renderChildren(context, table);
if(holder.getRowCounter() < table.getRowCount() - 1) {
writer.write(", ");
@Override
protected Class<? extends UIComponent> getComponentClass() {
return org.richfaces.component.UIDataList.class;
added to faces-config.xml:
<render-kit>
<render-kit-id>HTML_BASIC</render-kit-id>
<renderer>
<component-family>org.richfaces.DataList</component-family>
<renderer-type>ahui.CsvRenderer</renderer-type>
<renderer-class>com.b2international.auctionhouse.jsf.ahui.CsvRenderer</renderer-class>
</renderer>
</render-kit>
added to ahui.taglib.xml:
<tag>
<tag-name>csv</tag-name>
<component>
<component-type>org.richfaces.DataList</component-type>
<renderer-type>ahui.CsvRenderer</renderer-type>
</component>
</tag>
cheers,
Greg
Hi all,
After days of trial and error, i finally managed to code my own JSF component, extending existing infrastructure. Since things just suddenly fell in place during a brute force approach to make it work, i'd like to ask for opinions of seasoned JSF veterans whether this makes sense or there is a better way to do things.
The objective was to be able to render a collection of items as a comma separated list. To this end, I took an existing data iterator UIComponent from richfaces, added a custom renderer -- again extending on richfaces, and hooked things up in 2 config files, as follows:
CsvRenderer.java:
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import org.ajax4jsf.component.UIDataAdaptor;
import org.richfaces.renderkit.AbstractRowsRenderer;
import org.richfaces.renderkit.TableHolder;
/** Renders a richfaces UIDataList component as a comma separated list */
public class CsvRenderer extends AbstractRowsRenderer {
@Override
public void encodeOneRow(FacesContext context, TableHolder holder) throws IOException {
UIDataAdaptor table = holder.getTable();
ResponseWriter writer = context.getResponseWriter();
renderChildren(context, table);
if(holder.getRowCounter() < table.getRowCount() - 1) {
writer.write(", ");
@Override
protected Class<? extends UIComponent> getComponentClass() {
return org.richfaces.component.UIDataList.class;
added to faces-config.xml:
<render-kit>
<render-kit-id>HTML_BASIC</render-kit-id>
<renderer>
<component-family>org.richfaces.DataList</component-family>
<renderer-type>ahui.CsvRenderer</renderer-type>
<renderer-class>com.b2international.auctionhouse.jsf.ahui.CsvRenderer</renderer-class>
</renderer>
</render-kit>
added to ahui.taglib.xml:
<tag>
<tag-name>csv</tag-name>
<component>
<component-type>org.richfaces.DataList</component-type>
<renderer-type>ahui.CsvRenderer</renderer-type>
</component>
</tag>
cheers,
Greg
Similar Messages
-
Hi, I am trying to install Windows on my MacBook Pro with bootcamp. Every time I open bootcamp I am only able to check the first two boxes but not the third one saying "install or remove Windows 7". I did this before using the same computer and the same hard drive so I am not sure why this is happening now but did´t happen then. Any solutions ?
Was your Bootcamp info.plist manipulated to change any options?
-
I wish to upgrade my Macbook Pro to ML from SL but told the only way to do this is by downloading thru App store. Is it possible to copy ML on to a USB and upgrade that way. I would like to have a back up of the OS installation files just in case i have a problem later. Please help me!
You can create an install disc but you would have to download Mountain Lion to do so..
How to create an OS X 10.8 Mountain Lion install drive | MacFixIt - CNET Reviews
And make sure your Mac can upgrade to Mountain Lion.
See Step 1, 2, and 3, here > Apple - Upgrade your Mac to OS X Mountain Lion. -
I've just brought some video from itune, but realised the I should have brought the SD version instead of HD version as my iPad didn't have enough storage. Can I change that from HD to SD?
Does it mean that I can't watch it if I cannot download it?this helps. check it out! http://support.apple.com/kb/ht3209
-
I just install Photoshop CC. I try to open the file picture. All open as solid black picture. But on the right side under layer I can see little pic preview. Please help!
These questions below may be for a different product... but the KIND of information you need to supply is the same, for the products you use
More information needed for someone to help... please click below and provide the requested information
-Premiere Pro Video Editing Information FAQ http://forums.adobe.com/message/4200840
•What is your exact brand/model graphics adapter (ATI or nVidia or ???)
•What is your exact graphics adapter driver version?
•Have you gone to the vendor web site to check for a newer driver?
•For Windows, do NOT rely on Windows Update to have current driver information
•-you need to go direct to the vendor web site and check updates for yourself
•ATI Driver Autodetect http://support.amd.com/en-us/download/auto-detect-tool
•nVidia Driver Downloads http://www.nvidia.com/Download/index.aspx?lang=en-us -
I downloaded Wild to my Ipad and I'm having issues. I've only read the first few chapters but at the end of each chapter the last page is duplicated for 10 pages and then it goes to the next chapter.
Quit the iBooks app completely and restart the iPad. Go to the home screen first by tapping the home button. Double tap the home button and the task bar will appear with all of your recent/open apps displayed at the bottom. Tap and hold down on any app icon until it begins to wiggle. Tap the minus sign in the upper left corner of the app that you want to close. Tap the home button or anywhere above the task bar. Restart the iPad.
Restart the iPad by holding down on the sleep button until the red slider appears and then slide to shut off. To power up hold the sleep button until the Apple logo appears and let go of the button.
Or ....Reset the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.
Or ... Delete the book and download it again in the purchased tab of the iBook Store, as long as you use the same Apple ID, there is no charge to download it again. -
I've just redeemed a $25 gift card but when the process was completed, the previous credit I had on my account (about $3) had disappeared and the total credit I now have is only $25. How can I retreive the $3? Thanks for your help.
Contact Support and explain your issue.
Mac App Store Support -
http://www.apple.com/support/mac/app-store/ -
I m able to copy and paste selected files from external hard drive to my mac but not the other way around. Im not able to copy files from Mac to external hard drive.
The same is working fine with USB flash memory.
Please help.Vijay Raymond Daniel wrote:
The only thing is we need to buy this software. if there is a free solution to inter change files between NTFS and HFS it would be better,
Don't use NTFS, remove your data off it first and change the format to something the Mac and PC can read, but doens't cost money or require software.
Drives, partitions, formatting w/Mac's + PC's -
Why does the clone stamp work when I go from a darker color to a lighter color but not the other way around? How can I lighted a dark area? The Lasso tool takes from the wrong area.
c.pfaffenbichler wrote:
Why do you use the Blend Modes Lighter and Darker at all in this case and not simply Normal?
And what kept you from posting a screenshot?
I borrowed the image below for an HDR workshop I ran at the 2010 PSNZ National Convention, to demonstrate a method of removing halos. You'll remember that halos were a serious problem with early HDR, and while the halos in this image were caused by over sharpening, they are perfect for demonstrating this technique.
It relies on the fact that halos so often tend to put a lighter tone between the two areas where sharpening is being applied. Whether that is the sky abutting a dark line of hills, or the rock and little tower as in this image. I've uploaded it at the size it was supplied to me at (about 2700 pixels wide). So
Click to open the full image, right click and copy, and paste into Photoshop.
Select the clone tool, and set its blend mode to Darken.
Try to sample on a line horizontal to where you want to clone, to give the best tonal match, and start cloning.
Because the sky is darker than the halo, it overwrites it. But the rock is darker than the sky, so it has no affect.
It works even better if you clone on a new layer also set to Darken. No masking, just Photoshop blend mode magic.
You can also fix the little tower. Use a great big brush — just remember to sample horizontal to match the horizon.
Back then I was using the same trick with CAs after forgetting to fix them in ACR, and having done too much work to start again after spotting the problem. -
I tried reinstalling Firefox but I get the same thing with Intellicast. I get a page with typed writing instead of a grafic page with the maps and 10 day forecast. I go to Internet Explorer and get the same intellicast.com page and it opens up the right way. what is the problem and can it be fixed. I never had this problem before with intellicast and have been using it for some time on firefox
If it happens again the first try these basic steps:
Reload web page(s) and bypass the cache to refresh possibly outdated or corrupted files.
*Press and hold Shift and left-click the Reload button.
*Press "Ctrl + F5" or press "Ctrl + Shift + R" (Windows,Linux)
*Press "Command + Shift + R" (MAC)
Clear the cache and the cookies from sites that cause problems.
"Clear the Cache":
*Tools > Options > Advanced > Network > Cached Web Content: "Clear Now"
"Remove Cookies" from sites causing problems:
*Tools > Options > Privacy > Cookies: "Show Cookies" -
I have recently begun to use Pages and want to transfer a document between the iPad and my PC. I can transfer to the iPad, but not the other way, and am told I do not have sufficient 'privileges'. What does this mean? Also I can't use iCloud with Pages between the iPad and PC, although I purchased extra storage in order to do this.
If you have a PC, you don't have Pages on it. You can transfer Pages presentations to/from iCloud via http://www.icloud.com , however -- you just won't have an app on your PC to deal with Pages documents. Make sure that you have your iCloud account properly configured on your iPad.
-
my ipod wont let me buy any appps because it says i have an invalid security code for my moms credit card but its the right one. and it also says i owe money for upgrading an app does anyone know how to remove my moms credit card cause i cant figure itout
To change asccount information see:
Changing Account Information
For the code issue this may help.
iTunes Store: My credit card's security code or zip code does not match my bank's records
For a standard iTunes account you need a valid payment method even for free apps and app updates.
What is making it think that you own money for an app upgrade? -
FaceTime: I have a iPad, iPhone, iMac all on the same apple Id/account. Without changing id/email address can I use FaceTime between any 2 of my devices? It works from iPad to iPhone but not the other way??? I would like talk/see my kids if am away.
Hope you can help.
I have added a new email address but kept my Id, but I get busy when trying from iPhone to iPad as they are clashing. Like find my iPhone app hence trying to keep them all on one accountIOS: using facetime http://support.apple.com/kb/ht4319
using an ipad will use the email address since you can't make a phone call. see the link.
Your basically calling/emailing yourself that's why your getting a busy signal. -
In the slide show view how can you pin the "next" Arrow to the ultimate edge so it is in the same place as the full screen image, it will pin to the left edge but not the right.
Hello,
Please make sure that the next button is pinned to the right side as there in the attached image.
If it is already pinned, you can try removing any embedded HTML code and checking it.
Regards,
Neha -
Trying to connect my iMac to on 10.8.2 with PowerBook Intel on 10.5.8; sharing works from PowerBook to iMac but not the other way around. Why?
Thanks for the interest. Preferences are similar on both machines: screen sharing, file sharing, printer sharing & scanner sharing all ticked and radio button for Screen Sharing is ON.
My confusion is that I can get a network connection to the iMac by selecting "go to server" on the PowerMac running 10.5.8 but am unable to make the iMac connect to the PowerMac using similar selections. When ethernet cable is plugged in the PowerMac shows up on the finder bar on the iMac, but it does not allow either screen sharing or connection to occur - a dialog box tells me to check System Prefs and Network connection.
I'm hoping to export a large file of photos from iPhoto on my iMac to my wife's PowerMac and hoped to achieve this with an ethernet network connection.
Maybe you are looking for
-
I use Preview to edit photos, and would like to know if there are any updates to this program in the works. It seems Apple is constantly updating its software, except for Preview. I find it crashes all too often, and also takes forever to "catch up"
-
Viewing purchase order sapscript
Hai all, I have make some changes in the MEDRUCK sapcript for purchase order as per client requirement and now I want to see the print preview of my customised sapscript and i have created a purchase order with this output type for print out. C
-
One of my apps is stuck in limbo
So my Clash of clans game has been crashing a lot lately. I decided to finally uninstall and reinstall it in the hopes that would fix it. That's not the real problem though. When I tried to delete it, i got an option whether to keep or remove it and
-
Problem with Synchronized block
Hi, For me synchronized key word is not working (?) :-( Here is the example : I have three classes package sample.test; public class TestThreadMain { public static void main(String[] args) { Thread t1 = new ThreadOne(); Threa
-
How can I replace a 5 in 1 memory card reader in a HP Pavilion 500-027c Desktop PC
I bought a refurbished HP Pavilion 500-027c Desktop PC computer from walmart 2 weeks ago... The 5-in-1 memory card reader does not work... the device manager says that it is working properly but when I put in a memory card nothing happens... The whit