Changeset 1091


Ignore:
Timestamp:
07/06/09 18:49:28 (15 years ago)
Author:
alexandrecorreia
Message:

Ticket #571 - Removido o arquivo rostericons.xml, usado pelo applet(Java).

Location:
trunk/jabberit_messenger/java_source/src/nu/fw/jeti
Files:
3 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/jabberit_messenger/java_source/src/nu/fw/jeti/applet/Jeti.java

    r1064 r1091  
    142142                                { 
    143143                     exitURL = new URL(getDocumentBase(),getParameter("EXITPAGE")); 
     144                     javax.swing.JOptionPane.showMessageDialog(null, "exitUrl : " + exitURL); 
    144145                                }  
    145146                                catch (MalformedURLException e){} 
     
    158159                                Start.applet = true; 
    159160                                final JPanel panel = new JPanel(new BorderLayout()); 
    160                                 start = new Start(getCodeBase().toString(),panel); 
     161                                start = new Start( getCodeBase().toString(),panel ); 
    161162                                 
    162163                                backend = start.getBackend(); 
     
    298299                        applet.getAppletContext().showDocument(new URL(url),"_blank"); 
    299300                } 
    300                 catch (MalformedURLException e){/*wrong url*/} 
     301                catch (MalformedURLException e){} 
    301302        } 
    302303                 
     
    331332                if( !started ) 
    332333                        return false; 
     334                 
    333335                return backend.isLoggedIn(); 
    334336        } 
     
    383385                { 
    384386                        JID j = backend.getMyJID(); 
    385                         if(j.getDomain().equals(server)&& j.getUser().equals(username)) 
    386                         { 
     387                         
     388                        if( j.getDomain().equals(server) && j.getUser().equals(username) ) 
    387389                                return; 
    388                         } 
    389390                } 
    390391                secureMethodInvoker.addData(new Object[]{"login",username,server,password}); 
  • trunk/jabberit_messenger/java_source/src/nu/fw/jeti/backend/Start.java

    r1064 r1091  
    7070        private Backend backend; 
    7171         
    72         public Start(String urlString,Container container) 
     72        public Start(String urlString, Container container) 
    7373        { 
    7474                try 
     
    9292                        urlString = getPath(); 
    9393                 
    94                 if (System.getProperty("file.separator").equals("/")) 
    95                 { 
     94                if ( System.getProperty("file.separator").equals("/") ) 
    9695                        pluginPath = urlString.substring(5); 
    97                 } 
    9896                else  
    9997                        pluginPath = urlString.substring(6); 
     
    115113                        BUILD_NUM = p.getProperty("buildNum"); 
    116114                }  
    117                 catch (Exception e) 
    118                 { 
    119                         System.out.println("Can't find the version.properties file"); 
    120                 } 
    121                  
     115                catch (Exception e){} 
    122116                 
    123117                backend = new Backend(this); 
    124                 new Preferences(backend, parser); 
    125                 JFrame.setDefaultLookAndFeelDecorated(Preferences.getBoolean("jeti","javadecorations",false)); 
    126                  
    127                 //parse plugins? make better or make comments 
    128                 new StatusIcons(parser); 
     118                new Preferences( backend, parser ); 
     119                new StatusIcons(); 
    129120                Jeti jeti = new Jeti(backend,container); 
    130                 new Log(backend); 
    131                 new Popups(backend.getMainWindow()); 
     121                new Popups( backend.getMainWindow() ); 
    132122                pluginsInfo = new PluginsInfo(backend,parser,this); 
    133123                jeti.init(); 
    134                 if(container!=null) container.add(jeti); 
    135                 else backend.getMainWindow().setVisible(true); 
     124                if( container != null) 
     125                        container.add(jeti); 
     126                else  
     127                        backend.getMainWindow().setVisible(true); 
    136128        } 
    137129         
     
    143135        private String getPath() 
    144136        { 
    145                 // Now, search for and get the URL for this class. 
    146137                URL url = this.getClass().getResource("Start.class"); 
    147138                //System.out.println(url); 
     
    149140 
    150141                try 
    151                 { //remove %20 from program files etc 
     142                {  
     143                        //remove %20 from program files etc 
    152144                        urlString = URLDecoder.decode(url.toString(), "UTF8"); //encode if to url? probaly not 
    153145                } 
     
    155147                { 
    156148                        e.printStackTrace(); 
    157                 } //1.2 error 
    158  
    159                 //System.out.println(url.getPath()  ); //werkt niet in 1.2 
    160                 //System.out.println(url); 
     149                } 
     150 
    161151                if (url.getProtocol().equals("jar")) 
    162152                { 
     
    206196        { 
    207197                pluginsInfo.exit(); 
    208                 if(applet)nu.fw.jeti.applet.Jeti.exit(); 
    209                 backend=null; 
     198                nu.fw.jeti.applet.Jeti.exit(); 
     199                backend = null; 
    210200        } 
    211201 
     
    235225    } 
    236226} 
     227 
    237228/* 
    238229 * Overrides for emacs 
     
    241232 * End: 
    242233 */ 
    243  
  • trunk/jabberit_messenger/java_source/src/nu/fw/jeti/images/StatusIcons.java

    r1014 r1091  
    1 /*  
    2  *      Jeti, a Java Jabber client, Copyright (C) 2001 E.S. de Boer   
    3  * 
    4  *  This program is free software; you can redistribute it and/or modify 
    5  *  it under the terms of the GNU General Public License as published by 
    6  *  the Free Software Foundation; either version 2 of the License, or 
    7  *  (at your option) any later version. 
    8  * 
    9  *  This program is distributed in the hope that it will be useful, 
    10  *      but WITHOUT ANY WARRANTY; without even the implied warranty of 
    11  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    12  *      GNU General Public License for more details. 
    13  * 
    14  *  You should have received a copy of the GNU General Public License 
    15  *  along with this program; if not, write to the Free Software 
    16  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
    17  * 
    18  *      For questions, comments etc,  
    19  *      use the website at http://jeti.jabberstudio.org 
    20  *  or mail/IM me at jeti@jabber.org 
    21  */ 
    22  
    231package nu.fw.jeti.images; 
    242 
     
    308import javax.swing.Icon; 
    319import javax.swing.ImageIcon; 
    32 import javax.xml.parsers.FactoryConfigurationError; 
    33 import javax.xml.parsers.ParserConfigurationException; 
    3410import javax.xml.parsers.SAXParser; 
    35 import javax.xml.parsers.SAXParserFactory; 
    3611 
    37 import nu.fw.jeti.backend.Start; 
    3812import nu.fw.jeti.jabber.JIDStatus; 
    3913import nu.fw.jeti.jabber.elements.Presence; 
    40 import nu.fw.jeti.util.Preferences; 
    41  
    42 import org.xml.sax.SAXException; 
    4314 
    4415/** 
    45  * @author E.S. de Boer 
     16 * @author Alexandre Correia 
     17 *  
    4618 */ 
    4719 
     
    5123        private SAXParser parser; 
    5224 
    53         public StatusIcons(SAXParser parser) 
     25        public StatusIcons() 
    5426    { 
    5527                if( statusIcons == null ) 
    5628                { 
    57                         try{ 
    58                                 new Icons(parser,"rostericons"); 
    59                         }catch(IOException e) 
     29                        statusIcons = new HashMap(); 
     30 
     31                        String urlString = getClass().getResource("StatusIcons.class").toString(); 
     32                        try 
     33                        { 
     34                                urlString = urlString.substring(0,urlString.lastIndexOf("StatusIcons.class")); 
     35                                readImages(new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("status.cfg"))),new URL(urlString)); 
     36                                readImages(new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("images.cfg"))),new URL(urlString)); 
     37                        } 
     38                        catch(MalformedURLException e) 
    6039                        { 
    6140                                e.printStackTrace(); 
    6241                        } 
    63                         statusIcons = new HashMap(); 
    64                         loadDefaultPics(); 
    65                         //loadWebstartPics(); 
    66                         List iconList = Preferences.getPlugable("rostericons"); 
    67                         for (Iterator i = iconList.iterator();i.hasNext();) 
     42                        catch(NullPointerException e) 
    6843                        { 
    69                                 Object[] temp = (Object[])i.next(); 
    70                                 if(((Boolean)temp[1]).booleanValue()) 
    71                                 { 
    72                                         loadRosterIcon((String)temp[4],(String)temp[3]); 
    73                                 } 
     44                                System.err.println("nu/fw/jeti/images/Status.cfg or images.cfg missing"); 
    7445                        } 
    7546                } 
    7647        } 
    7748         
    78         public StatusIcons(){} 
    79          
    80         private void loadParser() 
    81         { 
    82                 try{parser = SAXParserFactory.newInstance().newSAXParser();} 
    83                 catch (FactoryConfigurationError ex){ex.printStackTrace();} 
    84                 catch (SAXException ex){ex.printStackTrace();} 
    85                 catch (ParserConfigurationException ex){ex.printStackTrace();} 
    86         } 
    87          
    88         protected void reloadRosterIcon(String name,String type) 
    89         { 
    90                 if(!statusIcons.containsKey(type))loadRosterIcon(name, type); 
    91         } 
    92          
    93         protected void loadRosterIcon(String filename,String type) 
    94         { 
    95                 String name2 = filename.substring(0, filename.lastIndexOf(".")); 
    96                 InputStream stream = null; 
    97                 URL url = null; 
    98                 try 
    99                 { 
    100                         url = getClass().getResource("/" + name2 + "/"); 
    101                         if(url==null) url =  new URL ("jar:" + Start.dataURL +  
    102                                         "plugins/rostericons/" + filename +"!/" + name2 + "/"); 
    103                         stream =  new URL(url,"icondef.xml").openStream(); 
    104                 } 
    105                 catch (IOException ex) 
    106                 { 
    107                         //ex.printStackTrace(); 
    108                 } 
    109                 if(stream==null) 
    110                 { 
    111                         System.out.println(filename + " not found"); 
    112                         return; 
    113                 } 
    114                 try 
    115                 { 
    116                         if(parser == null) loadParser(); 
    117                         parser.parse(stream ,new RosterIconsHandler(url,statusIcons,type)); 
    118                 } 
    119                 catch (SAXException ex) 
    120                 { 
    121                         ex.getException().printStackTrace(); 
    122                 } 
    123                 catch (IOException ex) 
    124                 { 
    125                         ex.printStackTrace(); 
    126                 } 
    127         } 
    128  
    129         protected void unloadRosterIcon(String name) 
    130         { 
    131                 statusIcons.remove(name); 
    132         } 
    133          
    134  
    135         static public ImageIcon getOfflineIcon() 
     49        public static ImageIcon getOfflineIcon() 
    13650        { 
    13751                return getStatusIcon(Presence.UNAVAILABLE ,"default"); 
    13852        } 
    13953         
    140         static public ImageIcon getStatusIcon(int show){return getStatusIcon(show,"");} 
     54        public static ImageIcon getStatusIcon(int show) 
     55        { 
     56                return getStatusIcon(show,""); 
     57        } 
    14158 
    14259        /** verander 
     
    14562         * @return ImageIcon 
    14663         */ 
    147         static public ImageIcon getImageIcon(String show){return getStatusIcon(show,"images");} 
     64        public static ImageIcon getImageIcon(String show) 
     65        { 
     66                return getStatusIcon(show,"images"); 
     67        } 
    14868 
    149  
    150         /** 
    151          * calls getStatusIcon(show,type) whith the default imageset 
    152          * @param show 
    153          * @return ImageIcon 
    154          */ 
    155         //static public ImageIcon getImageIcon(int image){return getStatusIcon(image,"images");} 
    156  
    157         //TODO change all calls with jidstatus 
    15869        /** 
    15970         * returns a status icon 
     
    16273         * @return ImageIcon 
    16374         */ 
    164         static public ImageIcon getStatusIcon(int show,String type) 
     75        public static ImageIcon getStatusIcon(int show,String type) 
    16576        { 
    16677                switch (show) 
     
    17788        } 
    17889         
    179         static public ImageIcon getStatusIcon(JIDStatus jidStatus) 
     90        public static ImageIcon getStatusIcon(JIDStatus jidStatus) 
    18091        { 
    18192                return getStatusIcon(jidStatus.getShow(),jidStatus.getType()); 
    18293        } 
    18394         
    184         static private ImageIcon getStatusIcon(String show,String type) 
     95        private static ImageIcon getStatusIcon(String show,String type) 
    18596        { 
    186                 if(!statusIcons.containsKey(type)) type = "default"; 
     97 
     98                if ( !statusIcons.containsKey(type) )  
     99                        type = "default"; 
     100                 
    187101                ImageIcon icon = (ImageIcon)((Map)statusIcons.get(type)).get(show); 
    188                 if (icon == null) icon = (ImageIcon)((Map)statusIcons.get("default")).get(show); 
     102                 
     103                if (icon == null) 
     104                        icon = (ImageIcon)((Map)statusIcons.get("default")).get(show); 
     105                 
    189106                return icon; 
    190107        } 
    191108 
    192         public void loadDefaultPics() 
    193         { 
    194                 // load default smilies 
    195                 // readSmilies(new BufferedReader(new InputStreamReader(PlgEmoticons.class.getResourceAsStream("emoticons/msn/info.cfg"))),null); 
    196                 // Now, search for and get the URL for this class. 
    197                 String urlString = getClass().getResource("StatusIcons.class").toString(); 
    198                 // String urlString = url.toString(); 
    199                 // System.out.println(url); 
    200                 try 
    201                 { 
    202                         urlString = urlString.substring(0,urlString.lastIndexOf("StatusIcons.class")); 
    203                         readImages(new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("status.cfg"))),new URL(urlString)); 
    204                         readImages(new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("images.cfg"))),new URL(urlString)); 
    205                 }catch(MalformedURLException e){e.printStackTrace(); } 
    206                 catch(NullPointerException e){System.err.println("nu/fw/jeti/images/Status.cfg or images.cfg missing");} 
    207         } 
    208          
    209          
    210 //      public static ImageIcon getImage(String location) 
    211 //      { 
    212 //              //get url for images 
    213 //              URL url = null; 
    214 //              try 
    215 //              { 
    216 //                      if (Start.remoteURL != null) 
    217 //                      { 
    218 // 
    219 //                              url = new URL("jar:" + Start.remoteURL + location); 
    220 //                      } 
    221 //                      else url = new URL("jar:" + Start.localURL + location); 
    222 //              } 
    223 //              catch (MalformedURLException e) 
    224 //              { 
    225 //                      e.printStackTrace(); 
    226 //              } 
    227 //              return new ImageIcon(url); 
    228 //      } 
    229          
    230  
    231         public void readImages(BufferedReader data,URL file) 
     109        private void readImages(BufferedReader data,URL file) 
    232110        { 
    233111            try 
     
    242120                catch(EOFException e) 
    243121                { 
    244                     //System.out.println(smilies); 
     122                        e.printStackTrace(); 
    245123                } 
    246124                catch (IOException e2) 
     
    252130        private void readSmilie(BufferedReader data,URL file,Map current) throws IOException 
    253131        { 
    254                 StringBuffer buffer=new StringBuffer(); 
    255                 while(true) 
     132                StringBuffer buffer = new StringBuffer(); 
     133                 
     134                while( true ) 
    256135                { 
    257136                        int in2 = data.read(); 
    258                         if(in2 ==-1) throw new EOFException(); 
     137                        if( in2 == -1) throw new EOFException(); 
    259138                        char ca =(char)in2; 
    260                         if(ca ==' ') 
     139                        if ( ca == ' ') 
    261140                        { 
    262141                                current.put(new String(buffer),readImage(data,file)); 
     
    269148        private Icon readImage(BufferedReader data,URL file) throws IOException 
    270149        { 
    271                 //Icon icon=null; 
    272                 java.net.URL picURL=null; 
    273                 String resource = data.readLine(); 
    274                 picURL =new URL(file + resource); 
    275                 //System.out.println(picURL); 
    276                 //if(picURL ==null) System.err.println(resource +" not found"); 
    277                 return new ImageIcon(picURL); 
     150                return new ImageIcon( new URL(file + data.readLine()) ); 
    278151        } 
    279 /*       
    280         private void loadWebstartPics() 
    281         { 
    282                 try 
    283                 { 
    284                         Enumeration m=getClass().getClassLoader().getResources("info.cfg"); 
    285                         for(Enumeration s =m;s.hasMoreElements();) 
    286                         { 
    287                                 try 
    288                                 { 
    289                                         //URL urlJar = new URL("jar:"+url+"!/"); 
    290                                         URL urlJar = (URL )s.nextElement(); 
    291                                         //JarFile jarFile = new JarFile(  ""  ); 
    292                                         //BufferedReader data =new BufferedReader(new InputStreamReader(jarFile.getInputStream(jarFile.getEntry("info.cfg")))); 
     152} 
    293153 
    294                                         BufferedReader data = null; 
    295                                         data =new BufferedReader(new InputStreamReader(urlJar.openStream())); 
    296                                         String url = urlJar.toString();  
    297                                         url = url.substring(0,url.length()-8); 
    298                                         //System.out.println(url); 
    299                                         readImages(data,new URL(url)); 
    300                                 } 
    301                                 catch(IOException e) 
    302                                 { 
    303                                         //System.out.println(currentFile.getName() + " is not a valid jar file"); 
    304                                         System.err.println(e.toString()); 
    305                                 } 
    306                         } 
    307                          
    308                 } catch (IOException e) 
    309                 { 
    310                         // TODO Auto-generated catch block 
    311                         e.printStackTrace(); 
    312                 } 
    313                  
    314         } 
    315 */ 
    316 } 
    317154/* 
    318155 * Overrides for emacs 
  • trunk/jabberit_messenger/java_source/src/nu/fw/jeti/plugins/PluginsInfo.java

    r1014 r1091  
    5858                PluginsInfo.backend = backend; 
    5959                 
    60                 if(!Start.applet) 
     60                if( !Start.applet ) 
    6161                { 
    6262                        classLoader = new URLClassloader(new URL[]{Start.programURL}, getClass().getClassLoader()); 
     
    6666                 
    6767                 
    68                  
    69         //      nu.fw.jeti.plugins.xmppuri.Plugin.init(backend); 
    70                  
     68//              nu.fw.jeti.plugins.xmppuri.Plugin.init(backend); 
    7169//              loadedPlugins.put("xmpp",nu.fw.jeti.plugins.xmpp.Plugin.class); 
    7270//              nu.fw.jeti.plugins.xmpp.Plugin.init(backend); 
     71 
    7372//              loadedPlugins.put("compression",nu.fw.jeti.plugins.compression.Plugin.class); 
    7473//              nu.fw.jeti.plugins.compression.Plugin.init(backend); 
    75                  
    7674//              loadedPreferencePanels.put("groupchatalerter",nu.fw.jeti.plugins.groupchatalerter.PrefPanel.class); 
     75                 
    7776//              loadedPlugins.put("groupchatalerter",nu.fw.jeti.plugins.groupchatalerter.Plugin.class); 
    7877//              nu.fw.jeti.plugins.groupchatalerter.Plugin.init(backend); 
     
    8483//              nu.fw.jeti.plugins.useractivity.Plugin.init(backend); 
    8584// 
    86         //      nu.fw.jeti.plugins.jingle.Plugin.init(backend); 
     85//              nu.fw.jeti.plugins.jingle.Plugin.init(backend); 
    8786                 
    8887                 
     
    175174        } 
    176175         
    177  
    178176        public static boolean isPluginLoaded(String name) 
    179177        { 
Note: See TracChangeset for help on using the changeset viewer.