Changeset 1091 for trunk/jabberit_messenger/java_source/src/nu/fw
- Timestamp:
- 07/06/09 18:49:28 (15 years ago)
- 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 142 142 { 143 143 exitURL = new URL(getDocumentBase(),getParameter("EXITPAGE")); 144 javax.swing.JOptionPane.showMessageDialog(null, "exitUrl : " + exitURL); 144 145 } 145 146 catch (MalformedURLException e){} … … 158 159 Start.applet = true; 159 160 final JPanel panel = new JPanel(new BorderLayout()); 160 start = new Start( getCodeBase().toString(),panel);161 start = new Start( getCodeBase().toString(),panel ); 161 162 162 163 backend = start.getBackend(); … … 298 299 applet.getAppletContext().showDocument(new URL(url),"_blank"); 299 300 } 300 catch (MalformedURLException e){ /*wrong url*/}301 catch (MalformedURLException e){} 301 302 } 302 303 … … 331 332 if( !started ) 332 333 return false; 334 333 335 return backend.isLoggedIn(); 334 336 } … … 383 385 { 384 386 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) ) 387 389 return; 388 }389 390 } 390 391 secureMethodInvoker.addData(new Object[]{"login",username,server,password}); -
trunk/jabberit_messenger/java_source/src/nu/fw/jeti/backend/Start.java
r1064 r1091 70 70 private Backend backend; 71 71 72 public Start(String urlString, Container container)72 public Start(String urlString, Container container) 73 73 { 74 74 try … … 92 92 urlString = getPath(); 93 93 94 if (System.getProperty("file.separator").equals("/")) 95 { 94 if ( System.getProperty("file.separator").equals("/") ) 96 95 pluginPath = urlString.substring(5); 97 }98 96 else 99 97 pluginPath = urlString.substring(6); … … 115 113 BUILD_NUM = p.getProperty("buildNum"); 116 114 } 117 catch (Exception e) 118 { 119 System.out.println("Can't find the version.properties file"); 120 } 121 115 catch (Exception e){} 122 116 123 117 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(); 129 120 Jeti jeti = new Jeti(backend,container); 130 new Log(backend); 131 new Popups(backend.getMainWindow()); 121 new Popups( backend.getMainWindow() ); 132 122 pluginsInfo = new PluginsInfo(backend,parser,this); 133 123 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); 136 128 } 137 129 … … 143 135 private String getPath() 144 136 { 145 // Now, search for and get the URL for this class.146 137 URL url = this.getClass().getResource("Start.class"); 147 138 //System.out.println(url); … … 149 140 150 141 try 151 { //remove %20 from program files etc 142 { 143 //remove %20 from program files etc 152 144 urlString = URLDecoder.decode(url.toString(), "UTF8"); //encode if to url? probaly not 153 145 } … … 155 147 { 156 148 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 161 151 if (url.getProtocol().equals("jar")) 162 152 { … … 206 196 { 207 197 pluginsInfo.exit(); 208 if(applet)nu.fw.jeti.applet.Jeti.exit();209 backend =null;198 nu.fw.jeti.applet.Jeti.exit(); 199 backend = null; 210 200 } 211 201 … … 235 225 } 236 226 } 227 237 228 /* 238 229 * Overrides for emacs … … 241 232 * End: 242 233 */ 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 Boer3 *4 * This program is free software; you can redistribute it and/or modify5 * it under the terms of the GNU General Public License as published by6 * the Free Software Foundation; either version 2 of the License, or7 * (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 of11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12 * GNU General Public License for more details.13 *14 * You should have received a copy of the GNU General Public License15 * along with this program; if not, write to the Free Software16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA17 *18 * For questions, comments etc,19 * use the website at http://jeti.jabberstudio.org20 * or mail/IM me at jeti@jabber.org21 */22 23 1 package nu.fw.jeti.images; 24 2 … … 30 8 import javax.swing.Icon; 31 9 import javax.swing.ImageIcon; 32 import javax.xml.parsers.FactoryConfigurationError;33 import javax.xml.parsers.ParserConfigurationException;34 10 import javax.xml.parsers.SAXParser; 35 import javax.xml.parsers.SAXParserFactory;36 11 37 import nu.fw.jeti.backend.Start;38 12 import nu.fw.jeti.jabber.JIDStatus; 39 13 import nu.fw.jeti.jabber.elements.Presence; 40 import nu.fw.jeti.util.Preferences;41 42 import org.xml.sax.SAXException;43 14 44 15 /** 45 * @author E.S. de Boer 16 * @author Alexandre Correia 17 * 46 18 */ 47 19 … … 51 23 private SAXParser parser; 52 24 53 public StatusIcons( SAXParser parser)25 public StatusIcons() 54 26 { 55 27 if( statusIcons == null ) 56 28 { 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) 60 39 { 61 40 e.printStackTrace(); 62 41 } 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) 68 43 { 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"); 74 45 } 75 46 } 76 47 } 77 48 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() 136 50 { 137 51 return getStatusIcon(Presence.UNAVAILABLE ,"default"); 138 52 } 139 53 140 static public ImageIcon getStatusIcon(int show){return getStatusIcon(show,"");} 54 public static ImageIcon getStatusIcon(int show) 55 { 56 return getStatusIcon(show,""); 57 } 141 58 142 59 /** verander … … 145 62 * @return ImageIcon 146 63 */ 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 } 148 68 149 150 /**151 * calls getStatusIcon(show,type) whith the default imageset152 * @param show153 * @return ImageIcon154 */155 //static public ImageIcon getImageIcon(int image){return getStatusIcon(image,"images");}156 157 //TODO change all calls with jidstatus158 69 /** 159 70 * returns a status icon … … 162 73 * @return ImageIcon 163 74 */ 164 static public ImageIcon getStatusIcon(int show,String type)75 public static ImageIcon getStatusIcon(int show,String type) 165 76 { 166 77 switch (show) … … 177 88 } 178 89 179 static public ImageIcon getStatusIcon(JIDStatus jidStatus)90 public static ImageIcon getStatusIcon(JIDStatus jidStatus) 180 91 { 181 92 return getStatusIcon(jidStatus.getShow(),jidStatus.getType()); 182 93 } 183 94 184 static privateImageIcon getStatusIcon(String show,String type)95 private static ImageIcon getStatusIcon(String show,String type) 185 96 { 186 if(!statusIcons.containsKey(type)) type = "default"; 97 98 if ( !statusIcons.containsKey(type) ) 99 type = "default"; 100 187 101 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 189 106 return icon; 190 107 } 191 108 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) 232 110 { 233 111 try … … 242 120 catch(EOFException e) 243 121 { 244 //System.out.println(smilies);122 e.printStackTrace(); 245 123 } 246 124 catch (IOException e2) … … 252 130 private void readSmilie(BufferedReader data,URL file,Map current) throws IOException 253 131 { 254 StringBuffer buffer=new StringBuffer(); 255 while(true) 132 StringBuffer buffer = new StringBuffer(); 133 134 while( true ) 256 135 { 257 136 int in2 = data.read(); 258 if( in2 ==-1) throw new EOFException();137 if( in2 == -1) throw new EOFException(); 259 138 char ca =(char)in2; 260 if (ca ==' ')139 if ( ca == ' ') 261 140 { 262 141 current.put(new String(buffer),readImage(data,file)); … … 269 148 private Icon readImage(BufferedReader data,URL file) throws IOException 270 149 { 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()) ); 278 151 } 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 } 293 153 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 block311 e.printStackTrace();312 }313 314 }315 */316 }317 154 /* 318 155 * Overrides for emacs -
trunk/jabberit_messenger/java_source/src/nu/fw/jeti/plugins/PluginsInfo.java
r1014 r1091 58 58 PluginsInfo.backend = backend; 59 59 60 if( !Start.applet)60 if( !Start.applet ) 61 61 { 62 62 classLoader = new URLClassloader(new URL[]{Start.programURL}, getClass().getClassLoader()); … … 66 66 67 67 68 69 // nu.fw.jeti.plugins.xmppuri.Plugin.init(backend); 70 68 // nu.fw.jeti.plugins.xmppuri.Plugin.init(backend); 71 69 // loadedPlugins.put("xmpp",nu.fw.jeti.plugins.xmpp.Plugin.class); 72 70 // nu.fw.jeti.plugins.xmpp.Plugin.init(backend); 71 73 72 // loadedPlugins.put("compression",nu.fw.jeti.plugins.compression.Plugin.class); 74 73 // nu.fw.jeti.plugins.compression.Plugin.init(backend); 75 76 74 // loadedPreferencePanels.put("groupchatalerter",nu.fw.jeti.plugins.groupchatalerter.PrefPanel.class); 75 77 76 // loadedPlugins.put("groupchatalerter",nu.fw.jeti.plugins.groupchatalerter.Plugin.class); 78 77 // nu.fw.jeti.plugins.groupchatalerter.Plugin.init(backend); … … 84 83 // nu.fw.jeti.plugins.useractivity.Plugin.init(backend); 85 84 // 86 //nu.fw.jeti.plugins.jingle.Plugin.init(backend);85 // nu.fw.jeti.plugins.jingle.Plugin.init(backend); 87 86 88 87 … … 175 174 } 176 175 177 178 176 public static boolean isPluginLoaded(String name) 179 177 {
Note: See TracChangeset
for help on using the changeset viewer.