JSF component (file-chooser, string feature is only needed).

For a rapid prototype...
I'm looking for a file-chooser that uses a JSF component, so I can get the string to the backing bean.
I do not need to upload a file.
Whats the easiest way to do this?
More specifically, I want to be able to push on a button and have the file chooser dialog open, and then have the selection go to the input text component. I also need to bind it to the backing bean. I'm using JSF 2.0 and also have primefaces setup. I tried to mix in tomahawk, but things went crazy.
Thanks,
Robert

EJP wrote:
And the documentation ;-(((((((Yay, A nice rant thread! Don't get me started on documentation, show me one API or framework that has documentation that covers not only the beginner things but also the production scale features (properly, not just mentioning that the features exist).
Of course it all makes sense, complete and helpful documentation halts the sales of books. for example, did you know that a book about Richfaces 4 has just hit the market?

Similar Messages

  • [JSF 2] File upload. Is this feature handled already?

    Hello,
    I need to allow a user to upload many files through the same form.
    This is what I would have done with Struts with this HTML code:
    <input type="file" name="file1" size="62" value="" />
    <input type="file" name="file2" size="62" value="" />
    <input type="file" name="file3" size="62" value="" />and the use of the org.apache.struts.upload.+FormFile+.
    However, I see no direct access to this feature through the JSF 2.0.
    no special <h:> tag.
    Reading old JSF code on the web, Tomahawk or Icefaces were used for this task.
    But today, Tomahawk doesn't support JSF 2, and Icefaces has an 2.0 Alpha 2 version that offers many features except File Upload that is still not working (for their update of the month of January: no updates since?).
    More than that, I was trapped few days ago by a strange behavior of JSF 2.0.
    Setting a "+multipart/form-data+" enctype to my form made JSF 2.0 loop on form validation, without ever submitting it.
    I am sure I didn't dreamed when it happened to me. And removing that enctype made the <h:form> returning to its default "+application/x-www-form-urlencoded+" enctype generation, and everything went fine then.
    But I know that attempting to upload files form a web page involve setting a "+multipart/form-data+" enctype on it... I feel doomed.
    All these questions make me return to you all, again. I wonder if you have succeed in using file upload with JSF 2.0 already.
    What mean do you use for that? Any component already exist that is compliant with JSF 2.0?
    Thanks for your help,
    Grunt.

    Are you aware that multi-part forms are not supported by Servlet implementations out of the box? You need to add a filter or manually invoked multi-part processing to support file uploads in any Servlet based solution.You're right. Until JSF 2 takes benefits from Servlet 3.0 who offers a getPart() function, a filter looks mandatory.
    Therefore, I tried the most advanced "faces" available for file upload: Primefaces 2.0.2, who provides a filter. However, it's not enough. The whole Primefaces solution for file uploading works chaotically. For me, it handles the multipart request well, but isn't able to join the listener the uploadFile tag defines, at submission time. I won't enter into details because this is not the good forum to discuss of that specific trouble of Primefaces. I did post my problem on Primefaces forum, and learned that this feature isn't working well yet.
    Icefaces doesn't offer the file uploading currently. Even its compatilibilty mode to version 1.8 is told (by the release note) not being able to handle file uploading yet.
    Richfaces just began its version 4.0.0 and is far from offering file uploading.
    If creating a working file upload was something possible yet, I can say for sure that any of these "faces" would had offered a working feature the sooner they could. But rather than that, I am reading ideas about some Mojarra 2 low level bugs that would disallow this feature to be implemented at the moment.
    It can't be only a story of a filter to write. That filter would have been written already hundred of times, else. A complete working solution would be shown everywhere.
    Currently, to summarize all, whatever a theorical reason is given, or a practical one (RFE missing, no time to write it, not a critical feature, or even unwished feature, depending of everyone thoughts in the previous replies to this post), file uploading is not available for JSF 2.0 by any existing way. No tier API or Faces is able to provide it, as it could be easily proven by the fact... that no samples are currently existing, working.
    Myself, but I might be alone believing it, I consider this missing feature like a JSF 2 flaw.
    I guess its a mojarra internal bug that disallows developers to provide a solution yet. This is not abnormal: JSF 2.0 has six months only, and can't work perfectly yet.
    But the more the correction of that feature will be delayed, and the more the developers will be in trouble, as nothing else is able to work in compatibility with JSF 2.0 (no existing working sample, I need to repeat it). And worst than that, this kind of flaw is one of those that in enterprise, at decision time, can makes JSF 2 discarded for another framework, less smart, but doing everything expected. It would be a shame, then.
    So, I think this problem should not be taken disdainfully. It's not a matter of "+You should only put a filter here+", "+It's not our work+", "+Please write our specs+", "+Wait, only wait, it will come for sure one day...+". Its more significant than that. It requires your study. The one of competent people like you are, and having goodwill. Because I understand that this is a problem that has been thrown away since a long time! But it is returning back to us like a boomerang at great speed.
    Among the features that JSF 2 offers and the ones that are currently under development, they are many, many of them, that will look secondary if at the end of all, file uploading isn't available.
    Regards,
    Grunt.

  • How can I include a javaScript files from within jsf component

    Is there any way using which I can include javascript files from my jsf component. Because otherwise I have to write all the javascript commands using writer.write which is very tedious rather than this I just want to include the javascript file which contains all the functions required. Also I want that this file should be included only once irrespective of the number of components included.
    Thanx in advance

    This doesn't depend on JSF. You need to include a script tag, like:
    <script src="/path/script.js"
    language="JavaScript" type="text/javascript"></script>
    If you want to include this only once, make a file included into every page, into which you can put other resources to be included along with this script.
    HTH,
    rs.

  • File Chooser Component for JavaFX not available?

    Is there a way to have a “File Chooser Component” for JavaFX Applications?
    Netbeans IDE offers a “Palette Swing Windows” Components, displays such item, but I am unable to put it into my FX Script.
    Any workaround? or miss I a anything?
    I want to pickup any sourcefile: "{__DIR__}sound/{soundName}" from local disc and run it on a Mediaplayer

    import javax.swing.filechooser.FileFilter;
    * @author Pawel
    public class OpenFileFilter extends FileFilter {
        override public function getDescription() : String {
            return "all movies";
        override public function accept(f: java.io.File) : Boolean {
            return f.isDirectory()
                or f.getName().endsWith(".avi")
                or f.getName().endsWith(".mov")
                or f.getName().endsWith(".flv");
    import java.awt.SystemTray;
    import java.awt.TrayIcon;
    import java.awt.Toolkit;
    import java.awt.PopupMenu;
    import java.awt.MenuItem;
    import java.awt.AWTException;
    import java.lang.System;
    var stage : Stage = Stage {
        title: "JavaWars"
        width: 800
        height: 600
        scene: scene,
        style: StageStyle.TRANSPARENT,
        extensions: [
            AppletStageExtension {
                shouldDragStart: function(e): Boolean {
                    return inBrowser and e.primaryButtonDown and header.hover;
                onDragStarted: function() {
                    inBrowser = false;
                    addTray();
                onAppletRestored: function() {
                    inBrowser = true;
                    removeTray();
                useDefaultClose: true
    var trayIcon : TrayIcon;
    function addTray() : Void{
        if(SystemTray.isSupported()) {
            var tray : SystemTray  = SystemTray.getSystemTray();
            var image : java.awt.Image = Toolkit.getDefaultToolkit().getImage("{__DIR__}resources/images/trayicon.png");
            var popup : PopupMenu = new PopupMenu();
            var item : MenuItem = new MenuItem("Zako&#324;cz");
            item.addActionListener(ActionListener{
                override public function actionPerformed(e : ActionEvent): Void {
                    var tray : SystemTray  = SystemTray.getSystemTray();
                    tray.remove(trayIcon);
                    stage.close();
            popup.add(item);
            trayIcon = new TrayIcon(image, "kliknij prawym, aby zamkna&#263; aplikacj&#281;", popup);
            try {
                tray.add(trayIcon);
            } catch (e : AWTException) {
                System.err.println("Can't add to tray");
        } else {
            System.err.println("Tray unavailable");
    function removeTray() : Void{
        if(SystemTray.isSupported()) {
            var tray : SystemTray  = SystemTray.getSystemTray();
            try {
                tray.remove(trayIcon);
            } catch (e : AWTException) {
                System.err.println("Can't remove tryicon");
    }

  • Is there any component in JSF for   file browsing

    Hi Friends,
    i have to place a file browser in my page,i am using JSF Framework. so i need file browser component in JSF , but i am not able to find the JSF Component for file browser.( in normal html there is this tag {<input type="file" /> } for file browsing ), is there tag for file browsing in JSF.

    Edukondalu_Avula wrote:
    can you tell me what is the jar file i have to add for this taglib
    <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %>
    Read reply #3. I have posted a link.

  • Create a custom JSF component

    Hi,
    I want to create a custom JSF component. I've setup a new application containing 2 projects:
    - a 'components' project, containing all the custom components
    - a 'view' project, to test the created custom components.
    There is dependency between the components project and the view project. In the view project, I added the
    the Tld, in order to use my components in the project.
    From the component palette, I can drop a component onto a .jspx page but after running the page, no output
    is printed onto the screen. The HTML source code only contains my 'tag-name' (eg: <ctb:mytag/>)
    Am I doing something wrong?
    UIComponent:
    import java.io.IOException;
    import javax.faces.component.UIComponentBase;
    import javax.faces.context.FacesContext;
    import javax.faces.context.ResponseWriter;
    public class BasicComponent extends UIComponentBase {
        public String getFamily() {
            return "BasicComponent";
        public void encodeBegin(FacesContext context) throws IOException {
            ResponseWriter out = context.getResponseWriter();
            out.write("Hello World");
    }Tag
    import javax.faces.component.UIComponent;
    import javax.faces.webapp.UIComponentTag;
    public class BasicComponentTag extends UIComponentTag {
        public String getComponentType() {
            return "BasicComponent";
        public String getRendererType() {
            return null;
    }Tld entry:
      <tag>
        <name>BasicComponent</name>
        <tag-class>BasicComponentTag</tag-class>
        <body-content>JSP</body-content>
      </tag>Thanks in advance,
    Koen Verhulst

    The body tag should be as follows
    <bodycontent>JSP</bodycontent>
    but the JSP will not work. Here is the file:
    <?xml version='1.0' encoding='windows-1252'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:af="http://xmlns.oracle.com/adf/faces"
    xmlns:afh="http://xmlns.oracle.com/adf/faces/html"
    xmlns:cust="http://xmlns.oracle.com/adf/faces/customizable"
    xmlns:cf="/WEB_INF/helloWorldLib.tld">
    <jsp:output omit-xml-declaration="true" doctype-root-element="HTML"
    doctype-system="http://www.w3.org/TR/html4/loose.dtd"
    doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/>
    <jsp:directive.page contentType="text/html;charset=windows-1252"/>
    <f:view>
    <html>
    <head>
    <meta http-equiv="Content-Type"
    content="text/html; charset=windows-1252"/>
    <title>List of Values</title>
    </head>
    <body><h:form>
    <cf:jsfhello hellomsg="This is it" />
    </h:form></body>
    </html>
    </f:view>
    </jsp:root>
    Edited by: bongo2 on Oct 28, 2008 2:58 PM

  • Custom file chooser

    Hello,
    I need to design a custom file chooser. Infact, I cannot call it a file
    chooser, because this is not accessing local system files. I am uploading
    some files into a directory using ASP and I keep that file name in the database.
    I can even upload directores and directores with files too into the database.
    I need to display those files and folders in the "what is called as file chooser".
    The List should work as it works in file chooser. i.e when I click on a folder,
    it should show the files inside it. When I click on the file, the file should
    be selected. Infact there is nothing in the file. Its all virtual only. Its only
    the name that is selected.
    I should be given an option to select "directories only" also.
    The "file chooser" should not have show files of type, just the file name
    text field only. The combobox should display "user added" string message. And
    this is only one item in the combobox. I should be able to create folders, show
    lists,etc... as it appears in the file chooser. (buttons beside the combobox)
    Any ideas would be greatly appreciated.
    Thanks

    ok, this is just an example....you'll probably need a different constructor and additional methods....
    public class VirtualFile{
      private String file ;
      private VirtualFile[] children;
      private VirtualFile parent;
      public VirtualFile(String file,VirtualFile parent,VirtualFiles[]children){
         this.file = file;
         this.parent = parent;
         this.children = children;
      public boolean isRoot(){
        return parent == null;
      public boolean isDirectory(){
        return children = null || children.length==0;
      public VirtualFile[] getChildren){
        return children;
    }

  • J file chooser

    Hello everybody,
    i was wondering if anybody can help me with this problem i am having. i am trying to create a jfilechooser that enco-operates the operating systems icons. basically if my program is running on window then it would know the icon to use for different files. i think you are suppose to use FileSystemView but i cant seem to get it to compile. basically i want the same file chooser that you get in softwares such as Microsoft word and so.
    thanks

    Swing uses a concept called a "Look and Feel".
    If you don't specify one, you get the Java default "Metal" look and feel. I'm pretty sure that it's the look and feel that determines what icons are used for files.
    If you want to use the windows look and feel, you would do perform a statement like this at the start of your code, before you display any frames or windows:
    UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
    This will make all of your windows look like a Windows app (and it only works ON a Windows operating system).
    To automatically have your code set the Look and Feel relevant to the current platform, call:
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName() );
    I think there's a way to have one component (like just the FileChooser) use a specific look and feel, but it isn't really appropriate in general GUI terms, I think, to be inconsistent like that. Alternatively, you could create your own subclass of JFileChooser or FileChooserUI that duplicates the Windows one. For that, I'd recommend you start here:
    http://java.sun.com/docs/books/tutorial/uiswing/components/filechooser.html

  • AHHHHHH! Multiple open file chooser windows

    Ok, I am going nuts here. I have figured out the problem of getting the data to appear on the same frame that I originally open. The menu at the top has File -> Open. When the user first comes into the form, that is the only thing enabled. I am using a different file opener for this initial opening. Here is why (although, it doesn't fix the problem):
    When the user opens the file, the data appears in the frame. If the user opens another file, the data appears in the frame and another file open chooser window appears even though the users did not select it again. If the user then opens another file, then that is it. If the user then goes to the menu and selects File->Open the file open chooser appears. The user selects a file and the data appears in the frame, but another file open chooser appears. I have had it happen up to 8 times. Now, I have no idea why this is getting called over and over again. It is this that is being called multiple times:
           jMenuFileOpen.addActionListener(new ActionListener()  {
            public void actionPerformed(ActionEvent e) {
              System.out.println("IS THIS THE OPEN THAT IS CALLED OVER AND OVER AND OVER AGAIN");
              jMenuFileOpen_actionPerformed(e);
          });That println is printing each time another file open chooser window appears. I am pulling out my hair trying to figure this one out. The way I am starting this up is this:
      public FDASFrame(File file) {
        enableEvents(AWTEvent.WINDOW_EVENT_MASK);
        inputfile = file;
        try {
          jbInit();
        catch(Exception e) {
          e.printStackTrace();
      public void setFile (File file) {
        enableEvents(AWTEvent.WINDOW_EVENT_MASK);
        inputfile = file;
        try {
          jbInit();
        catch(Exception e) {
          e.printStackTrace();
      }These methods are in the main frame - FDASFrame. I am wondering if that is the problem. Here is the part of the filechooser that calls the main frame when the file is gotten:
                parent.setFile(file);
                JFrame frame = (JFrame)parent;Has anyone got any ideas to this problem? It might solve the problem of the tables getting duplicate data in them, too, each time a new file is opened.
    Thanks to anyone who has any ideas on how to solve this. I am stumped.
    Allyson

    I have other tests, but this is the one that is messing me up. Here is the whole file chooser (it is really long):
    package sdh;
    import java.io.*;
    //import java.io.File;
    //import java.io.FileInputStream;
    //import java.io.BufferedReader;
    //import java.io.InputStreamReader;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    //import javax.swing.filechooser.*;
    import java.util.*;
    import org.w3c.dom.Document;
    import org.w3c.dom.*;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.DocumentBuilder;
    import org.xml.sax.SAXException;
    import org.xml.sax.SAXParseException;
    public class FileChooserFrame extends JFrame {
      static File file;
      String tempfile, wholeline;
      PrintWriter textfile;
      Hashtable QualityCodes = new Hashtable();
      Hashtable DistanceCodes = new Hashtable();
      Hashtable ScreeningCodes = new Hashtable();
      Hashtable ObjectCodes = new Hashtable();
      Hashtable WeatherCodes = new Hashtable();
      Hashtable StabilityCodes = new Hashtable();
        public FileChooserFrame(FDASFrame parent, String filetype) {
          //Create a file chooser
          if (filetype.equals("Open")) {
            final JFileChooser fc = new JFileChooser();
            fc.addChoosableFileFilter(new xmlExtensionFileFilterClass());
            fc.addChoosableFileFilter(new fsExtensionFileFilterClass());
            fc.addChoosableFileFilter(new sdmExtensionFileFilterClass());
            fc.addChoosableFileFilter(new rcvExtensionFileFilterClass());
            fc.addChoosableFileFilter(new txtExtensionFileFilterClass());
            fc.setAcceptAllFileFilterUsed(false);
            int returnVal = fc.showOpenDialog(FileChooserFrame.this);
            if (returnVal == JFileChooser.APPROVE_OPTION) {
              file = fc.getSelectedFile();
              String ext = fc.getSelectedFile().toString().substring(fc.getSelectedFile().toString().indexOf(".")+1);
              /** @todo FDASFrame comes up each time you open a file - does not put data in the one already up */
    //        FDASFrame fdas = FDASFrame.getInstance();
    //          JFrame frame = new FDASFrame(file);
              if (ext.equals("txt")) {
                parent.setFile(file);
                JFrame frame = parent;
    //            JFrame frame = new FDASFrame(file);
                try {
                  String v;
                  FileInputStream f = new FileInputStream(file);
                  BufferedReader b = new BufferedReader(new InputStreamReader(f));
                  if ((v = b.readLine()) != null) {
                    StringTokenizer t = new StringTokenizer(v,"|");
                    if (t.nextElement().equals("FH")) {
                      frame.setTitle(t.nextElement().toString() + " Version " + t.nextElement().toString());
                catch(Exception ee) {
                  ee.printStackTrace();
                frame.addWindowListener(new WindowAdapter() {
                  public void windowClosing(WindowEvent e) {
                    System.exit(0);
                frame.setVisible(true);
              else if (ext.equals("xml") || ext.equals("sdm") || ext.equals("sdm.xml")) {
                // Hashtable for WeatherCodes for setups
                WeatherCodes.put("Clear","4");
                WeatherCodes.put("Pt. Cloudy","3");
                WeatherCodes.put("Cloudy","2");
                WeatherCodes.put("Hazy/Foggy","1");
                WeatherCodes.put("","0");
                // Hashtable for StabilityCodes for setups
                StabilityCodes.put("Good","3");
                StabilityCodes.put("Fair","2");
                StabilityCodes.put("Poor","1");
                StabilityCodes.put("","0");
                // Hashtable for ObjectCodes for objects
                ObjectCodes.put("Land","9");
                ObjectCodes.put("Mountain","8");
                ObjectCodes.put("Water","7");
                ObjectCodes.put("Dense Trees","6");
                ObjectCodes.put("Thin Trees","5");
                ObjectCodes.put("Building","4");
                ObjectCodes.put("Tower","3");
                ObjectCodes.put("Pole","2");
                ObjectCodes.put("Antenna","1");
                ObjectCodes.put("","0");
                // Hashtable for ScreeningCodes for objects
                ScreeningCodes.put("High","4");
                ScreeningCodes.put("Doubtful","3");
                ScreeningCodes.put("Intermediate","2");
                ScreeningCodes.put("Photo","1");
                ScreeningCodes.put("","0");
                // Hashtable for DistanceCodes for objects
                DistanceCodes.put("Feet","3");
                DistanceCodes.put("Meters","2");
                DistanceCodes.put("NMI","1");
                DistanceCodes.put("","0");
                // Hashtable for QualityCodes for points
                QualityCodes.put("High","3");
                QualityCodes.put("Medium","2");
                QualityCodes.put("Low","1");
                QualityCodes.put("","0");
                try{
                  tempfile = fc.getCurrentDirectory().toString() + "\\Tempxml.txt";
                  textfile = new PrintWriter(new BufferedWriter(new FileWriter(tempfile)));
                catch(Exception ee) {
                  ee.printStackTrace();
                try {
                  DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
                  DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
                  Document doc = docBuilder.parse(file);
                  // normalize text representation
                  doc.getDocumentElement ().normalize ();
                  NodeList rootlist = doc.getElementsByTagName("root");
                  NodeList FHList = null;
                  Node rootnode = rootlist.item(0);
                  if(rootnode.getNodeType() == Node.ELEMENT_NODE){
                    Element FHElement = (Element)rootnode;
                    FHList = FHElement.getElementsByTagName("FileHeader");
                    Element FHeElement = (Element)FHList.item(0);
                    NodeList textFHList = FHeElement.getChildNodes();
                    wholeline = ((Node)textFHList.item(0)).getNodeValue().trim();
                  Node FHnode = FHList.item(0);
                  if(FHnode.getNodeType() == Node.ELEMENT_NODE){
                    Element FHelemElement = (Element)FHnode;
                    NodeList IDList = FHelemElement.getElementsByTagName("Identifier");
                    Element IDElement = (Element)IDList.item(0);
                    NodeList textIDList = IDElement.getChildNodes();
                    wholeline = wholeline + "|" + ((Node)textIDList.item(0)).getNodeValue().trim();
                    NodeList VerList = FHelemElement.getElementsByTagName("Version");
                    Element VerElement = (Element)VerList.item(0);
                    NodeList textVerList = VerElement.getChildNodes();
                    wholeline = wholeline + "|" + ((Node)textVerList.item(0)).getNodeValue().trim();
                    textfile.println(wholeline);
                  wholeline = "";
                  NodeList siteList = doc.getElementsByTagName("Site");
                  Element siteElement = (Element)siteList.item(0);
                  NodeList textsiteList = siteElement.getChildNodes();
                  wholeline = ((Node)textsiteList.item(0)).getNodeValue().trim();
                  Node sitenode = siteList.item(0);
                  if (sitenode.getNodeType() == Node.ELEMENT_NODE) {
                    Element siteelemElement = (Element) sitenode;
                    NodeList SiteNameList = siteelemElement.getElementsByTagName("Site_Name");
                    Element SiteNameElement = (Element)SiteNameList.item(0);
                    NodeList textSiteNameList = SiteNameElement.getChildNodes();
                    wholeline = wholeline + "|" + ((Node)textSiteNameList.item(0)).getNodeValue().trim();
                    NodeList EquipTypeList = siteelemElement.getElementsByTagName("Equipment_Type");
                    Element EquipTypeElement = (Element)EquipTypeList.item(0);
                    NodeList textEquipTypeList = EquipTypeElement.getChildNodes();
                    wholeline = wholeline + "|" + ((Node)textEquipTypeList.item(0)).getNodeValue().trim();
                    NodeList LatList = siteelemElement.getElementsByTagName("Site_Latitude");
                    Element LatElement = (Element)LatList.item(0);
                    NodeList textLatList = LatElement.getChildNodes();
                    wholeline = wholeline + "|" + ((Node)textLatList.item(0)).getNodeValue().trim();
                    NodeList LonList = siteelemElement.getElementsByTagName("Site_Longitude");
                    Element LonElement = (Element)LonList.item(0);
                    NodeList textLonList = LonElement.getChildNodes();
                    wholeline = wholeline + "|" + ((Node)textLonList.item(0)).getNodeValue().trim();
                    NodeList GtFPList = siteelemElement.getElementsByTagName("Ground_to_Focal_Point");
                    Element GtFPElement = (Element)GtFPList.item(0);
                    NodeList textGtFPList = GtFPElement.getChildNodes();
                    wholeline = wholeline + "|" + ((Node)textGtFPList.item(0)).getNodeValue().trim();
                    NodeList SiteElvList = siteelemElement.getElementsByTagName("Site_Elevation");
                    Element SiteElvElement = (Element)SiteElvList.item(0);
                    NodeList textSiteElvList = SiteElvElement.getChildNodes();
                    wholeline = wholeline + "|" + ((Node)textSiteElvList.item(0)).getNodeValue().trim();
                    NodeList UCAList = siteelemElement.getElementsByTagName("Upper_Coverage_Angle");
                    Element UCAElement = (Element)UCAList.item(0);
                    NodeList textUCAList = UCAElement.getChildNodes();
                    wholeline = wholeline + "|" + ((Node)textUCAList.item(0)).getNodeValue().trim();
                  textfile.println(wholeline);
                  NodeList listOfSetups = doc.getElementsByTagName("Setup");
                  int totalSetups = listOfSetups.getLength();
                  for (int s = 0; s < totalSetups; s++) {
                    wholeline = "";
                    Node Setupnode = listOfSetups.item(s);
                    Element setupElement = (Element)listOfSetups.item(s);
                    NodeList textsetupList = setupElement.getChildNodes();
                    wholeline = ((Node)textsetupList.item(0)).getNodeValue().trim();
                    if (Setupnode.getNodeType() == Node.ELEMENT_NODE) {
                      Element setuplistElement = (Element)Setupnode;
                      NodeList SurveyorList = setuplistElement.getElementsByTagName("Surveyor");
                      Element SurveyorElement = (Element)SurveyorList.item(0);
                      NodeList textSurveyorList = SurveyorElement.getChildNodes();
                      wholeline = wholeline + "|" + ((Node)textSurveyorList.item(0)).getNodeValue().trim();
                      NodeList Azi2FPList = setuplistElement.getElementsByTagName("Azimuth_to_Focal_Point");
                      Element Azi2FPElement = (Element)Azi2FPList.item(0);
                      NodeList textAzi2FPList = Azi2FPElement.getChildNodes();
                      wholeline = wholeline + "|" + ((Node)textAzi2FPList.item(0)).getNodeValue().trim();
                      NodeList Dist2FPList = setuplistElement.getElementsByTagName("Dist_to_Focal_Point");
                      Element Dist2FPElement = (Element)Dist2FPList.item(0);
                      NodeList textDist2FPList = Dist2FPElement.getChildNodes();
                      wholeline = wholeline + "|" + ((Node)textDist2FPList.item(0)).getNodeValue().trim();
                      NodeList Hi2FPList = setuplistElement.getElementsByTagName("Hi_to_Focal_Point");
                      Element Hi2FPElement = (Element)Hi2FPList.item(0);
                      NodeList textHi2FPList = Hi2FPElement.getChildNodes();
                      wholeline = wholeline + "|" + ((Node)textHi2FPList.item(0)).getNodeValue().trim();
                      NodeList WeatherList = setuplistElement.getElementsByTagName("Weather");
                      Element WeatherElement = (Element)WeatherList.item(0);
                      NodeList textWeatherList = WeatherElement.getChildNodes();
                      wholeline = wholeline + "|" + (String)WeatherCodes.get(((Node)textWeatherList.item(0)).getNodeValue().trim());
                      NodeList StabilityList = setuplistElement.getElementsByTagName("Stability");
                      Element StabilityElement = (Element)StabilityList.item(0);
                      NodeList textStabilityList = StabilityElement.getChildNodes();
                      wholeline = wholeline + "|" + (String)StabilityCodes.get(((Node)textStabilityList.item(0)).getNodeValue().trim());
                      Element objectElement = (Element)Setupnode;
                      NodeList textobjectList = objectElement.getElementsByTagName("Object");
                      int TotalObjs = textobjectList.getLength();
                      if (TotalObjs == 0) {
                        textfile.print(wholeline);
                      else {
                        textfile.println(wholeline);
                      for (int j = 0; j < TotalObjs; j++) {
                        wholeline = "";
                        Node Objectnode = textobjectList.item(j);
                        Element objectelement = (Element)textobjectList.item(j);
                        NodeList textObjList = objectelement.getChildNodes();
                        wholeline = ((Node)textObjList.item(0)).getNodeValue().trim();
                        if (Objectnode.getNodeType() == Node.ELEMENT_NODE) {
                          Element objElement1 = (Element)Objectnode;
                          NodeList textobjList1 = objElement1.getElementsByTagName("Object_Type");
                          Element objelement1 = (Element)textobjList1.item(0);
                          NodeList textOList1 = objelement1.getChildNodes();
                          wholeline = wholeline + "|" + (String)ObjectCodes.get(((Node)textOList1.item(0)).getNodeValue().trim());
                          Element objElement2 = (Element)Objectnode;
                          NodeList textobjList2 = objElement2.getElementsByTagName("Screening_Type");
                          Element objelement2 = (Element)textobjList2.item(0);
                          NodeList textOList2 = objelement2.getChildNodes();
                          wholeline = wholeline + "|" + (String)ScreeningCodes.get(((Node)textOList2.item(0)).getNodeValue().trim());
                          Element objElement3 = (Element)Objectnode;
                          NodeList textobjList3 = objElement3.getElementsByTagName("Distance_Units");
                          Element objelement3 = (Element)textobjList3.item(0);
                          NodeList textOList3 = objelement3.getChildNodes();
                          wholeline = wholeline + "|" + (String)DistanceCodes.get(((Node)textOList3.item(0)).getNodeValue().trim());
                          Element PointElement = (Element)Objectnode;
                          NodeList textPointList = PointElement.getElementsByTagName("Point");
                          int TotalPts = textPointList.getLength();
                          textfile.println(wholeline);
                          for (int k = 0; k < TotalPts; k++) {
                            wholeline = "";
                            Node Pointnode = textPointList.item(k);
                            Element pointelement = (Element)textPointList.item(k);
                            NodeList textPList = pointelement.getChildNodes();
                            wholeline = ((Node)textPList.item(0)).getNodeValue().trim();
                            if (Pointnode.getNodeType() == Node.ELEMENT_NODE) {
                              Element pointElement1 = (Element)Pointnode;
                              NodeList textpointList1 = pointElement1.getElementsByTagName("Azimuth");
                              Element pointelement1 = (Element)textpointList1.item(0);
                              NodeList textPList1 = pointelement1.getChildNodes();
                              wholeline = wholeline + "|" + ((Node)textPList1.item(0)).getNodeValue().trim();
                              Element pointElement2 = (Element)Pointnode;
                              NodeList textpointList2 = pointElement2.getElementsByTagName("Vertical_Angle");
                              Element pointelement2 = (Element)textpointList2.item(0);
                              NodeList textPList2 = pointelement2.getChildNodes();
                              wholeline = wholeline + "|" + ((Node)textPList2.item(0)).getNodeValue().trim();
                              Element pointElement3 = (Element)Pointnode;
                              NodeList textpointList3 = pointElement3.getElementsByTagName("Distance");
                              Element pointelement3 = (Element)textpointList3.item(0);
                              NodeList textPList3 = pointelement3.getChildNodes();
                              wholeline = wholeline + "|" + ((Node)textPList3.item(0)).getNodeValue().trim();
                              Element pointElement4 = (Element)Pointnode;
                              NodeList textpointList4 = pointElement4.getElementsByTagName("Quality");
                              Element pointelement4 = (Element)textpointList4.item(0);
                              NodeList textPList4 = pointelement4.getChildNodes();
                              wholeline = wholeline + "|" + (String)QualityCodes.get(((Node)textPList4.item(0)).getNodeValue().trim());
                            textfile.println(wholeline);
                  textfile.close();
                  File f = new File(tempfile);
    //              JFrame frame = new FDASFrame(f);
                  parent.setFile(f);
                  JFrame frame = parent;
                  if(FHnode.getNodeType() == Node.ELEMENT_NODE){
                    Element FHelemElement = (Element)FHnode;
                    NodeList IDList = FHelemElement.getElementsByTagName("Identifier");
                    Element IDElement = (Element)IDList.item(0);
                    NodeList textIDList = IDElement.getChildNodes();
                    NodeList VerList = FHelemElement.getElementsByTagName("Version");
                    Element VerElement = (Element)VerList.item(0);
                    NodeList textVerList = VerElement.getChildNodes();
                    frame.setTitle(((Node)textIDList.item(0)).getNodeValue().trim() + " Version " + ((Node)textVerList.item(0)).getNodeValue().trim());
                  frame.addWindowListener(new WindowAdapter() {
                   public void windowClosing(WindowEvent e) {
                     System.exit(0);
                  frame.setVisible(true);
                catch(Exception ee) {
                  ee.printStackTrace();
          else if (filetype.equals("Save")) {
            final JFileChooser fc = new JFileChooser();
            fc.setFileFilter(new saveExtensionFileFilterClass());
            fc.setAcceptAllFileFilterUsed(false);
            int returnVal = fc.showSaveDialog(FileChooserFrame.this);
            if (returnVal == JFileChooser.APPROVE_OPTION) {
              file = fc.getSelectedFile();
          else if (filetype.equals("Log")) {
            final JFileChooser fc = new JFileChooser();
            fc.setFileFilter(new logExtensionFileFilterClass());
            fc.setAcceptAllFileFilterUsed(false);
            int returnVal = fc.showSaveDialog(FileChooserFrame.this);
            if (returnVal == JFileChooser.APPROVE_OPTION) {
              file = fc.getSelectedFile();
        public static File getFile() {
          return file;
    }I know I should split this out and I will sometime, but for now, this is the way the code is.
    I think the reason that nothing is coming up is that all my work is done in jbInit(). I don't want to post that code, but I will if needed. So, if I can only call it once, then how do I get the rest of it to run? Maybe I am going about this all wrong. But if it is not in jbInit(), then how does it get called? I guess now, I am confused.
    Thanks for the help.
    Allyson

  • CS3 fails to output an SWC Flash Component File

    My workflow uses CS3 to create SWCs which I include in my FlashDevelop Project. But CS3 no longer outputs the SWC Flash Component File. It outputs the SWF, but not the SWC. So I set up this test FLA to see what's up...
    I used a weird name for the MovieClip (MKLop2) to avoid any possible naming collisions and added AS3 to the MovieClip's timeline (a simple this.stop(); )  to ensure Flash was "seeing" enough content to warrant an export to SWC. I also tried right clicking the MC in the library and choosing Export SWC file... from the drop down menu. Flash processes the request but does not produce an SWC. There is an instance of MKLop2 which has been dragged and dropped on the Stage. So, I have done all I can think of to encourage Flash to output an SWC that I know to do. Have I just overlooked something simple? Thanks. Mond.

    It all looks good to me and no you shouldn't have to do anything to get it to export items in the SWC other than add a linkage ID to each item you plan on accessing via code.
    Perhaps try running Flash as Administrator to rule out any filesystem permission issues.
    Lastly are you setting the SWF location every time? Make sure you hit the browse button and select the location every time you open the document. You should only need to do that once.

  • Custom JSF component with custom value datatype

    I've created a simple custom JSF component with a decode, encodeBegin as follows:
    public void decode(FacesContext context) {
        Map<String, String> requestParameters = context.getExternalContext().getRequestParameterMap();
        String clientId = getClientId(context);
        String value = requestParameters.get(clientId);
        setSubmittedValue(value);
        super.decode(context);
    public void encodeBegin(FacesContext context) throws IOException {
        ResponseWriter response = context.getResponseWriter();
        String clientId = getClientId(context);
        response.startElement("input", this);
        response.writeAttribute("name", clientId, "id");
        response.writeAttribute("type", "text", null);
        String value = (String) getValue();
        if (null != value) {
             response.writeAttribute("value", value, "value");
        response.endElement("input");
    }With also:
    setRendererType(null);as part of the constructor.
    This component works just fine both inside and outside of a dataTable component, as expected.
    What I would like to do now is to replace the String value datatype with a custom class, for example MyDataType. For this I do:
    public void decode(FacesContext context) {
        Map<String, String> requestParameters = context.getExternalContext().getRequestParameterMap();
        String clientId = getClientId(context);
        String value = requestParameters.get(clientId);
        MyDataType myData = (MyDataType) getValue();
        MyDataType newData = (MyDataType) myData.clone();
        newData.setValue(value);
        // copy old object and only update the changed field of this object
        setSubmittedValue(newData);
        super.decode(context);
    public void encodeBegin(FacesContext context) throws IOException {
        ResponseWriter response = context.getResponseWriter();
        String clientId = getClientId(context);
        response.startElement("input", this);
        response.writeAttribute("name", clientId, "id");
        response.writeAttribute("type", "text", null);
        MyDataType value = (MyDataType) getValue();
        if (null != value) {
             response.writeAttribute("value", value.getValue(), "value");
        response.endElement("input");
    }Now this works perfect outside of a dataTable component, but inside it fails to update the property on the BB.
    Are there somewhere examples on how to properly use custom datatypes as values for UIInput components? Also how to only partially update the value (like I do, I only want to update the value field of the MyDataType object)

    Even if I encode the entire MyDataType via hidden input elements and decode it again (i.e. not using a cloned getValue) it's still not working side a dataTable.
    Could it have to do something with me using Facelets?

  • Trying to remove itunes and its component get this"the feature you are trying to use is on a network resource that is unavailable

    trying to remove itunes and its component get this"the feature you are trying to use is on a network resource that is unavailable" click ok to try again or enter an alternate path to a folder containing the installation package "itunes.msi'

    tiburon77 wrote:
    trying to remove itunes and its component get this"the feature you are trying to use is on a network resource that is unavailable" click ok to try again or enter an alternate path to a folder containing the installation package "itunes.msi'
    Unfortunately, this sort of trouble has gotten more complicated to deal with ever since Microsoft pulled the Windows Installer CleanUp utility from their Download Center on June 25. First we have to find a copy of the utility.
    Let's try Googling. (Best not to use Bing, I think.) Look for a working download site for at least version 3.0 of the Windows Installer CleanUp utility. After downloading the utility installer file (msicuu2.exe), scan the file for malware, just in case. (I use the free version of Malwarebytes AntiMalware to do single-file scans for that.)
    If the file is clean, to install the utility, doubleclick the msicuu2.exe file you've downloaded.
    Now run the utility ("Start > All Programs > Windows Install Clean Up"). In the list of programs that appears in CleanUp, select any iTunes entries and click "Remove".
    Quit out of CleanUp, restart the PC and try installing iTunes again. Does the install go through properly now?
    (If you do find a clean download site for the correct version of CleanUp, please don't tell me where it is. Without wishing to sound paranoid (although I grant it does sound paranoid), there is a non-zero chance that posting links to download locations for the utility here at Discussions leads to that download location being shut down.)

  • How to retrieve IndividualStrings from a txt file using String Tokenizer.

    hello can any one help me to retrieve the individual strings from a txt file using string tokenizer or some thing like that.
    the data in my txt file looks like this way.
    Data1;
    abc; cder; efu; frg;
    abc1; cder2; efu3; frg4;
    Data2
    sdfabc; sdfcder; hvhefu; fgfrg;
    uhfhabc; gffjcder; yugefu; hhfufrg;
    Data3
    val1; val2; val3; val4; val5; val6;
    val1; val2; val3; val4; val5; val6;
    val1; val2; val3; val4; val5; val6;
    val1; val2; val3; val4; val5; val6;
    i need to read the data as an individual strings and i need to pass those values to diffarent labels,the dat in Data3 i have to read those values and add to an table datamodel as 6 columns and rows depends on the data.
    i try to retrieve data using buffered reader and inputstream reader,but only the way i am retrieving data as an big string of entire line ,i tried with stringtokenizer but some how i was failed to retrive the data in a way i want,any help would be appreciated.
    Regards,

    Hmmm... looks like the file format isn't even very consistent... why the semicolon after Data1 but not after Data2 or Data3??
    Your algorithm is reading character-by-character, and most of the time it's easier to let a StringTokenizer or StreamTokenizer do the work of lexical analysis and let you focus on the parsing.
    I am also going to assume your format is very rigid. E.g. section Data1 will ALWAYS come before section Data2, which will come before section Data3, etc... and you might even make the assumption there can never be a Data4, 5, 6, etc... (this is why its nice to have some exact specification, like a grammar, so you know exactly what is and is not allowed.) I will also assume that the section names will always be the same, namely "DataX" where X is a decimal digit.
    I tend to like to use StreamTokenizer for this sort of thing, but the additional power and flexibility it gives comes at the price of a steeper learning curve (and it's a little buggy too). So I will ignore this class and focus on StringTokenizer.
    I would suggest something like this general framework:
    //make a BufferedReader up here...
    do
      String line = myBufferedReader.readLine();
      if (line!=null && line.trim().length()>0)
        line = line.trim();
        //do some processing on the line
    while (line!=null);So what processing to do inside the if statement?
    Well, you can recognize the DataX lines easily enough - just do something like a line.startsWith("Data") and check that the last char is a digit... you can even ignore the digit if you know the sections come in a certain order (simplifying assumptions can simplify the code).
    Once you figure out which section you're in, you can parse the succeeding lines appropriately. You might instantiate a StringTokenizer, i.e. StringTokenizer strtok = new StringTokenizer(line, ";, "); and then read out the tokens into some Collection, based on the section #. E.g.
    strtok = new StringTokenizer(line, ";, ");
    if (sectionNo==0)
      //read the tokens into the Labels1 collection
    else if (sectionNo==1)
      //read the tokens into the Labels2 collection
    else //sectionNo must be 2
      //create a new line in your table model and populate it with the token values...
    }I don't think the delimiters are necessary if you are using end-of-line's as delimiters (which is implicit in the fact that you are reading the text out line-by-line). So the original file format you listed looks fine (except you might want to get rid of that rogue semicolon).
    Good luck.

  • I have a MacBook pro version 10.6.7 with snow leopard. After an scheduled software upgrade I could not open Quicken (It said it could not open the files). Now I can only open it if I have my external drive on. Can you help?

    I have a MacBook pro version 10.6.7 with snow leopard. After an scheduled software upgrade I could not open Quicken (It said it could not open the files). Now I can only open it if I have my external drive on. Can you help?
    All the information that I had input on Quicken is gone. I have to have the external hard drive that I use to back up to be able to use quicken now. It is as if it was erased from the laptop hardrive

    Try repairing permissions. My favorite way is with a utility called AppleJack. Info and download here. It's free. It only works when you boot in Single User Mode. When restarting or booting, hold down the Command key and S keys.
    You will get a very different startup screen that looks like the Terminal app has hijacked the screen. Just let the lines of text scroll by. When that happens you will get a text entry prompt. Type in "AppleJack" without the quotation marks.
    A DOS looking menu will appear. Choose 1 or d to run Disk Repair. If you get a message that Disk Repair found and corrected errors, run it again. Repeat until you get the "your disk appears to be ok" message. This rarely happens with my experience, though. This does the same thing as as booting from an external drive and running Disk Utility's repair. Only, no external drive is required!
    Next, choose 2 or p to repair disk permissions. This will take a little while. AppleJack warns that it will take up to an half hour to run repair permissions. It'n never taken more than about ten minutes for my MacBook Pro.
    As permissions are repaired, you will see each repair scroll on the screen. When done, the menu returns, choose q to quit. Then at the prompt, enter "exit" without the quotes. Your MacBook Pro should restart into Mac OS normally after this.
    Hope this helps.

  • Need help adding a default file name in a file chooser of save dialog type

    I need to create a file chooser with save dialog type, how can I add a highlighted default file name into the File Name textfield? As in Microsoft Word, when you want to save a document, a default file name Doc1.doc will appear in the File name text field of the file chooser even when you change to other directories.

    For JRE 1.4.0 you can use this fix:
    public class FileChooserFix implements PropertyChangeListener {
      private String fileName;
       * @see PropertyChangeListener
      public void propertyChange(PropertyChangeEvent ev) {
        JFileChooser chooser = (JFileChooser)ev.getSource();
        if (JFileChooser.FILES_ONLY == chooser.getFileSelectionMode()) {
          if (JFileChooser.SELECTED_FILE_CHANGED_PROPERTY.equals(ev.getPropertyName())) {
            File selectedFile = (File)ev.getNewValue();
            if (selectedFile != null) {
              // remember fileName of selected file
              fileName = selectedFile.getName();
          if (fileName != null &&
              JFileChooser.DIRECTORY_CHANGED_PROPERTY.equals(ev.getPropertyName())) {
            // reset selected file
            File directory = (File)ev.getNewValue();
            chooser.setSelectedFile(new File(directory, fileName));
       * Convenience method to create a fixed file chooser.
       * @return      fixed file chooser
      public static JFileChooser create() {
        JFileChooser chooser = new JFileChooser();
        chooser.addPropertyChangeListener(new FileChooserFix());
        return chooser;

Maybe you are looking for