svn commit: r15012 - branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels: panel xml

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: penyaskito
Date: 2008-06-20 00:18:25-0700
New Revision: 15012

Modified:
   branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/panel/UIFactory.java
   branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/xml/UmlClass.xml

Log:
Fixed the problem loading the embedded XMLs.

Modified: branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/panel/UIFactory.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/panel/UIFactory.java?view=diff&rev=15012&p1=branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/panel/UIFactory.java&p2=branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/panel/UIFactory.java&r1=15011&r2=15012
==============================================================================
--- branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/panel/UIFactory.java	(original)
+++ branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/panel/UIFactory.java	2008-06-20 00:18:25-0700
@@ -24,7 +24,7 @@
 
 package org.argouml.core.propertypanels.panel;
 
-import java.io.DataInputStream;
+import java.io.InputStream;
 
 import javax.swing.JPanel;
 
@@ -34,10 +34,6 @@
 import org.xml.sax.XMLReader;
 import org.xml.sax.helpers.XMLReaderFactory;
 
-// this import is weird, but it will be removed (just a workaround
-// until the problem with loading XMLs from jars is solved.
-import com.sun.org.apache.bcel.internal.util.ByteSequence;
-
 // TODO: This class will be an interface or abstract class
 // and will be implemented by SwingUIFactory and SwtUIFactory.
 public class UIFactory {
@@ -85,31 +81,17 @@
               );
         parser.setContentHandler(new XMLPropertyPanelsHandler(panel));
 
-        String file = "/org/argouml/core/propertypanels/xml/"
+        String file = "org/argouml/core/propertypanels/xml/"
             + filename + ".xml";
         LOG.info("File = "+ file);
-        // URL url = ClassLoader.getSystemResource(file);
-        // ClassLoader loader = UIFactory.class.getClassLoader();
-        // URL url = loader.getResource(file);
-        // LOG.info("URL = "+ url.toString());
-//        Enumeration<URL> urls = loader.getResources(file);        
-//        while (urls.hasMoreElements()) {
-//            URL u = (URL) urls.nextElement();
-//            LOG.info("URL = "+ u.toString());
-//        }
-//        URL url = loader.getResource(file);
-//        LOG.info("URL = "+ url.toString());
-        DataInputStream stream = getStream();
-//        FileInputStream stream = new FileInputStream(file);
-        
+        LOG.info("URL="+this.getClass().getClassLoader().
+                getResource(file));
+        InputStream stream = this.getClass().getClassLoader().
+            getResourceAsStream(file);
+        LOG.info("INPUT = " + stream);
         InputSource source = new InputSource(stream);
         parser.parse(source);        
         
         return panel; 
     }
-
-    private DataInputStream getStream() {
-        String x = "<?xml version='1.0' encoding='UTF-8'?><panel title='Prueba de titutlo'>     <label text='This is a test from XML' />        <property name='name' value='hey'       /></panel>";
-        return new ByteSequence(x.getBytes());
-    }
 }

Modified: branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/xml/UmlClass.xml
Url: http://argouml.tigris.org/source/browse/argouml/branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/xml/UmlClass.xml?view=diff&rev=15012&p1=branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/xml/UmlClass.xml&p2=branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/xml/UmlClass.xml&r1=15011&r2=15012
==============================================================================
--- branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/xml/UmlClass.xml	(original)
+++ branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/xml/UmlClass.xml	2008-06-20 00:18:25-0700
@@ -1,5 +1,5 @@
 <?xml version='1.0' encoding='UTF-8'?>
-<panel title='Prueba de titutlo'>
+<panel title='Test title in the XML'>
 	<label text='This is a test from XML' />
 	<property name='name' value='hey'	/>
 </panel>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.