sink-commits Mailing List for Sink is not a kitchen sink (Page 3)
Status: Inactive
Brought to you by:
jmalonzo
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
(28) |
Apr
(23) |
May
(188) |
Jun
(96) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
---|
From: Michael S. <mic...@us...> - 2005-06-07 01:13:47
|
Update of /cvsroot/sink/sink/src/org/sink/swing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18225/src/org/sink/swing Modified Files: AccountDetails.java Log Message: when changing account details only displaying 'disconnect box' when we are connected Index: AccountDetails.java =================================================================== RCS file: /cvsroot/sink/sink/src/org/sink/swing/AccountDetails.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AccountDetails.java 6 Jun 2005 06:25:09 -0000 1.4 --- AccountDetails.java 7 Jun 2005 01:13:38 -0000 1.5 *************** *** 86,95 **** txtVerifyPassword.setText(""); ! int restart=JOptionPane.showConfirmDialog(null,"Your changes have been saved.\n\nIn order for the new account preferences to take effect,\nyou need to disconnect from your jabber server and connect again.\n\nDo you want to disconnect now?", "Account preferences", JOptionPane.YES_NO_OPTION); ! ! if(restart==JOptionPane.YES_OPTION ){ ! getBuddyListController().disconnectFromServer(); ! System.out.println("OK"); ! } } --- 86,99 ---- txtVerifyPassword.setText(""); ! if(getBuddyListController().isConnected() == true) ! { ! int reply = JOptionPane.showConfirmDialog(null,"Your changes have been saved.\n\nIn order for the new account preferences to take effect,\nyou need to disconnect from your jabber server and connect again.\n\nDo you want to disconnect now?", "Account preferences", JOptionPane.YES_NO_OPTION); ! ! if(reply == JOptionPane.YES_OPTION ) ! { ! getBuddyListController().disconnectFromServer(); ! System.out.println("OK"); ! } ! } } |
From: Michael S. <mic...@us...> - 2005-06-07 01:13:02
|
Update of /cvsroot/sink/sink/src/org/sink/swing/wizard In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17818/src/org/sink/swing/wizard Modified Files: AccountRegDescriptor.java Log Message: storing account details when registering with the wizard Index: AccountRegDescriptor.java =================================================================== RCS file: /cvsroot/sink/sink/src/org/sink/swing/wizard/AccountRegDescriptor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AccountRegDescriptor.java 6 Jun 2005 21:53:31 -0000 1.1 --- AccountRegDescriptor.java 7 Jun 2005 01:12:51 -0000 1.2 *************** *** 125,128 **** --- 125,129 ---- try { wiz.createAccount(); + wiz.saveToPrefs(); displayAccountSummary("Created account "+userid); } catch (Exception ex) { |
From: Michael S. <mic...@us...> - 2005-06-07 00:33:44
|
Update of /cvsroot/sink/sink/data/pixmaps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29333/data/pixmaps Modified Files: splashVideo.jpg Log Message: 1) smoother video init splash screen 2) java doc for BuddyListController 3) added two full stops in the java doc of MainViewAdapter 4) Added an error dialog to SinkApp Index: splashVideo.jpg =================================================================== RCS file: /cvsroot/sink/sink/data/pixmaps/splashVideo.jpg,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvsunK9nB and /tmp/cvsyXaxws differ |
From: Michael S. <mic...@us...> - 2005-06-07 00:33:44
|
Update of /cvsroot/sink/sink/src/org/sink/chat In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29333/src/org/sink/chat Modified Files: MainViewAdapter.java Log Message: 1) smoother video init splash screen 2) java doc for BuddyListController 3) added two full stops in the java doc of MainViewAdapter 4) Added an error dialog to SinkApp Index: MainViewAdapter.java =================================================================== RCS file: /cvsroot/sink/sink/src/org/sink/chat/MainViewAdapter.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** MainViewAdapter.java 6 Jun 2005 21:53:31 -0000 1.18 --- MainViewAdapter.java 7 Jun 2005 00:33:26 -0000 1.19 *************** *** 404,410 **** /** ! * Graphically indicates that sink is connected to a server or not * ! * @param idicates of sink is connected or not */ public void setConnected(boolean connected) {} --- 404,410 ---- /** ! * Graphically indicates that sink is connected to a server or not. * ! * @param idicates of sink is connected or not. */ public void setConnected(boolean connected) {} |
From: Michael S. <mic...@us...> - 2005-06-07 00:33:44
|
Update of /cvsroot/sink/sink/src/org/sink/swing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29333/src/org/sink/swing Modified Files: SinkApp.java BuddyListController.java Log Message: 1) smoother video init splash screen 2) java doc for BuddyListController 3) added two full stops in the java doc of MainViewAdapter 4) Added an error dialog to SinkApp Index: SinkApp.java =================================================================== RCS file: /cvsroot/sink/sink/src/org/sink/swing/SinkApp.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** SinkApp.java 6 Jun 2005 21:53:31 -0000 1.8 --- SinkApp.java 7 Jun 2005 00:33:25 -0000 1.9 *************** *** 82,85 **** --- 82,86 ---- catch(ConnectionException cex) { SinkLog.logStackTrace(cex); + new ErrorController(cex); initDevices(); Index: BuddyListController.java =================================================================== RCS file: /cvsroot/sink/sink/src/org/sink/swing/BuddyListController.java,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** BuddyListController.java 6 Jun 2005 21:53:31 -0000 1.38 --- BuddyListController.java 7 Jun 2005 00:33:25 -0000 1.39 *************** *** 43,46 **** --- 43,67 ---- import org.sink.media.*; + /** + * BuddyListController is the controller class which passes most (but not all) of the gui actions on to the responsible logic classes. + */ + /** + * @author Michael Salcher + */ + /** + * @author Michael Salcher + */ + /** + * @author Michael Salcher + */ + /** + * @author Michael Salcher + */ + /** + * @author Michael Salcher + */ + /** + * @author Michael Salcher + */ public class BuddyListController extends MainViewAdapter implements ActionListener { *************** *** 58,61 **** --- 79,88 ---- private boolean localVideoInProgress = false; + /** + * The BuddyListController needs to know about its BuddyListWindow and the name of the user whose jabber account this is. + * + * @param blw the BuddyListWindow + * @param myName the name of the user + */ public BuddyListController(BuddyListWindow blw, String myName) { *************** *** 67,70 **** --- 94,104 ---- } + /** + * In case we know that there is a BuddyListContoller, + * didn't get it passed as an argument and don't have the init date, + * but still want to use it. (I know ... having the need for this, is bad design :-( + * + * @return returns the BuddyListController. + */ public static BuddyListController getInstance() { *************** *** 72,79 **** --- 106,121 ---- } + /** + * Marks a buddy with a specified buddy id as 'selected'. + * + * @param buddyId + */ public void setSelectedBuddy(String buddyId) { selectedBuddy = buddyId; } + /** + * Connect to jabber server and change the gui accordingly. + */ public void connectToServer() { try { *************** *** 94,97 **** --- 136,142 ---- } + /** + * Disconnect from the jabber server and change the gui accordingly. + */ public void disconnectFromServer() { try { *************** *** 106,109 **** --- 151,157 ---- } + /* (non-Javadoc) + * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) + */ public void actionPerformed (ActionEvent e) { String cmd = e.getActionCommand(); *************** *** 145,148 **** --- 193,199 ---- } + /** + * Displays the 'Add Buddy' dialog. + */ public void showAddBuddyWindow() { AddBuddyWindow abw = new AddBuddyWindow(this); *************** *** 150,153 **** --- 201,212 ---- } + /** + * Add a buddy with a specified user id and alias the your buddy list. + * If this is the first buddy on the list, it gets selected. + * Change gui accordingly. + * + * @param userId + * @param alias + */ public void addBuddy(String userId, String alias) { *************** *** 171,174 **** --- 230,237 ---- } + /** + * Remove the currently selected buddy. + * Change gui accordingly. + */ public void removeBuddy() { try { *************** *** 182,185 **** --- 245,254 ---- } + /** + * Change the gui according to whether a video chat is in progress or not. + * E.g.: Change 'video init' icons to 'stop video'. + * + * @param inProgress + */ public void setVideoInProgress(boolean inProgress) { *************** *** 198,201 **** --- 267,273 ---- } + /** + * Change gui accordingly to whether we are displaying our own webcam image. + */ public void setLocalVideoInProgress(boolean inProgress) { *************** *** 206,209 **** --- 278,284 ---- } + /** + * @return is a video chat in progress? + */ public boolean isVideoInProgress() { *************** *** 211,214 **** --- 286,292 ---- } + /** + * @return are we displaying our own webcam image? + */ public boolean isLocalVideoInProgress() { *************** *** 216,219 **** --- 294,300 ---- } + /* (non-Javadoc) + * @see org.sink.chat.MainViewAdapter#setConnected(boolean) + */ public void setConnected(boolean connected) { *************** *** 221,228 **** --- 302,317 ---- } + /** + * If no TextChatWindow for the selected buddy exits, create one. + */ public void initTextChat() { checkIfChatExist(); } + /** + * If no TextChatWindow for the specified buddy exits, create one. + * + * @param buddyId + */ public void initTextChat(String buddyId){ System.out.println("Init text chat with " + buddyId); *************** *** 231,234 **** --- 320,328 ---- } + /** + * Request a video chat with the specified buddy. + * + * @param buddyId + */ public void initVideoChat(String buddyId){ System.out.println("BuddyListController: Init video chat with "+buddyId); *************** *** 250,253 **** --- 344,350 ---- } + /** + * @return returns all buddies on the buddy list. + */ public Vector getBuddies() { if (isConnected()) { *************** *** 259,262 **** --- 356,363 ---- } + /** + * @param buddy + * @return returns whether the specified buddy is online or offline + */ public boolean isAvailable(Buddy buddy) { buddyList = BuddyList.getInstance(); *************** *** 264,267 **** --- 365,372 ---- } + /** + * Stops the video chat (if in progress) and terminates sink. + * Note that the user would be logged off the jabber server as well. + */ public void terminateSink() { *************** *** 293,296 **** --- 398,404 ---- } + /** + * @return returns the name of the user whose jabber account this is. + */ public String getMyName() { *************** *** 298,301 **** --- 406,415 ---- } + /** + * If a media request comes in we display a dialog + * asking the user if they want to accept the request and then + * we either start the chat and send back that we accepted or we don't + * start the chat and send back that we refused. + */ public void processMediaRequest(Buddy buddy) { *************** *** 405,408 **** --- 519,525 ---- } + /* (non-Javadoc) + * @see org.sink.chat.MainViewAdapter#processRequestResponse(boolean, org.sink.chat.Buddy) + */ public void processRequestResponse(boolean response, Buddy buddy) { *************** *** 557,560 **** --- 674,678 ---- /** * Starts sending and receiving the audio and video stream. + * * @throws SinkNoProcessorException * @throws SinkUnknownException *************** *** 616,619 **** --- 734,740 ---- } + /** + * Displays our own webcam image. + */ public void displayLocalVideo() { *************** *** 627,630 **** --- 748,754 ---- } + /** + * @return are we connected to the jabber server? + */ public boolean isConnected() { *************** *** 632,635 **** --- 756,762 ---- } + /** + * @return do we have any buddies on our buddy list? + */ public boolean hasBuddies() { *************** *** 647,650 **** --- 774,781 ---- } + /** + * Tells the BuddyListWindow to change to gui to reflect a buddy list with buddies, + * or one without buddies. + */ public void setWithOrWithoutBuddies() { |
From: Michael S. <mic...@us...> - 2005-06-07 00:33:44
|
Update of /cvsroot/sink/sink/src/org/sink In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29333/src/org/sink Modified Files: Settings.java Log Message: 1) smoother video init splash screen 2) java doc for BuddyListController 3) added two full stops in the java doc of MainViewAdapter 4) Added an error dialog to SinkApp Index: Settings.java =================================================================== RCS file: /cvsroot/sink/sink/src/org/sink/Settings.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Settings.java 6 Jun 2005 21:53:31 -0000 1.14 --- Settings.java 7 Jun 2005 00:33:26 -0000 1.15 *************** *** 27,35 **** import java.util.HashMap; ! import java.util.prefs.Preferences; import java.io.IOException; ! //import java.io.FileNotFoundException; ! //import java.io.FileInputStream; ! //import java.io.FileOutputStream; import org.sink.exceptions.ConfigException; --- 27,35 ---- import java.util.HashMap; ! import java.util.Properties; import java.io.IOException; ! import java.io.FileNotFoundException; ! import java.io.FileInputStream; ! import java.io.FileOutputStream; import org.sink.exceptions.ConfigException; *************** *** 43,48 **** public class Settings { ! private final HashMap DEFAULTS = new HashMap(getDefaults()); ! // Use tokens if you want key,value pairs. // This is temp variable. make sure you call clear() before --- 43,52 ---- public class Settings { ! private String filename, title; ! private Properties props; ! ! public static String portVideo; ! public static String portAudio; ! // Use tokens if you want key,value pairs. // This is temp variable. make sure you call clear() before *************** *** 50,56 **** private HashMap tokens; - // The main man... - private Preferences orgSinkPrefs; - // Avoid multiple instances private static Settings instance = new Settings(); --- 54,57 ---- *************** *** 61,81 **** } - private HashMap getDefaults() { - HashMap temp = new HashMap(); - temp.put("selectedAudioDevice", "none, none"); - temp.put("selectedVideoDevice", "none, none"); - temp.put("audioDevices", "javasound://44100, JavaSound audio capture"); - temp.put("videoDevices", "none, none"); - temp.put("portAudio", "44008"); - temp.put("portVideo", "44000"); - temp.put("server", "localhost"); - temp.put("username", ""); - temp.put("password", ""); - temp.put("name", ""); - temp.put("email", ""); - temp.put("resource", "Sink"); - return temp; - } - /** Initialize Settings. * --- 62,65 ---- *************** *** 85,116 **** */ private Settings(){ ! // retrieve /org/sink/ node settings. ! orgSinkPrefs = Preferences.userNodeForPackage(Settings.class); ! ! // etc... ! tokens = new HashMap(); ! } ! ! public boolean isFirstTime() { ! boolean firsttime = false; ! try { ! firsttime = orgSinkPrefs.getBoolean("virgin", true); ! } catch (IllegalStateException ex) { ! SinkLog.logStackTrace(ex); ! } catch (NullPointerException ex) { ! // first time.. ! firsttime = true; ! } ! return firsttime; ! } ! ! public void setupDone() { try { ! orgSinkPrefs.putBoolean("virgin", false); ! } catch (Exception ex) { ! ex.printStackTrace(); } } ! /** Get the value of the key in the settings. * --- 69,85 ---- */ private Settings(){ ! filename = "sink.conf"; ! title = "Sink Configuration File"; ! props = new Properties(); try { ! load(); ! portVideo = getProperty("portVideo"); ! portAudio = getProperty("portAudio"); ! } catch (ConfigException ce) { ! SinkLog.logStackTrace(ce); } + tokens = new HashMap(); } ! /** Get the value of the key in the settings. * *************** *** 119,134 **** */ public String getProperty(String key) { ! String value = ""; ! String def = (String) DEFAULTS.get(key); ! try { ! value = orgSinkPrefs.get(key, def); ! } catch (NullPointerException ex) { ! ex.printStackTrace(); ! } catch (IllegalStateException ex) { ! ex.printStackTrace(); ! } ! return value; } ! /** Set the settings based on the key in the settings. * --- 88,94 ---- */ public String getProperty(String key) { ! return props.getProperty(key); } ! /** Set the settings based on the key in the settings. * *************** *** 137,147 **** */ public void setProperty(String key, String value) { try { ! orgSinkPrefs.put(key, value); ! } catch (Exception ex) { ! ex.printStackTrace(); } } /** Get the server tokens for authentication * --- 97,173 ---- */ public void setProperty(String key, String value) { + props.setProperty(key, value); + } + + /** Loads the settings from the backend. + * + * @throws ConfigException + */ + public void load() throws ConfigException { + FileInputStream fis = null; try { ! fis = new FileInputStream(filename); ! props.load(fis); ! } ! catch(FileNotFoundException e) { ! throw new ConfigException(e); ! } ! catch(IOException e) { ! throw new ConfigException(e); ! } ! finally { ! try { ! fis.close(); ! } catch (IOException ioe) { ! throw new ConfigException(ioe); ! } catch (NullPointerException ex) { ! SinkLog.log("InputStream was never initialized"); ! } ! } ! } ! ! /** Stores the settings in the file backend. ! * ! * @throws ConfigException ! */ ! public void store() throws ConfigException { ! FileOutputStream fos = null; ! try { ! fos = new FileOutputStream(filename); ! props.store(fos, title); ! } ! catch(FileNotFoundException e) { ! throw new ConfigException(e); ! } ! catch(IOException e) { ! throw new ConfigException(e); ! } ! finally { ! try { ! fos.close(); ! } catch (IOException ioe) { ! throw new ConfigException(ioe); ! } catch (NullPointerException ex) { ! SinkLog.log("OutputStream was never initialized"); ! } } } + /** Get the filename of the settings file. + * + * @return the file name. + */ + public String getFilename() { + return filename; + } + + /** Get the configuration file's heading. + * + * @return the title of the properties file. + */ + public String getTitle() { + return title; + } + /** Get the server tokens for authentication * *************** *** 150,182 **** public HashMap getChatTokens() { tokens.clear(); ! tokens.put("server", getProperty("server")); ! tokens.put("password", getProperty("password")); ! tokens.put("username", getProperty("username")); ! tokens.put("name", getProperty("name")); ! tokens.put("email", getProperty("email")); ! tokens.put("resource", getProperty("resource")); return tokens; } public void updateAccount(HashMap details) throws ConfigException { ! setProperty("name", (String) details.get("name")); ! setProperty("email", (String) details.get("email")); ! setProperty("username", (String) details.get("username")); ! setProperty("resource", (String) details.get("resource")); ! setProperty("server", (String) details.get("server")); } public void setPassword(String password) throws ConfigException { ! setProperty("password", password); SinkLog.log("storing password"); } ! ! public void store() throws ConfigException { ! try { ! orgSinkPrefs.flush(); ! } catch (java.util.prefs.BackingStoreException ex) { ! throw new ConfigException(ex, ! "Error while flushing content"); ! } } } --- 176,210 ---- public HashMap getChatTokens() { tokens.clear(); ! tokens.put("server", props.getProperty("server","localhost")); ! tokens.put("password", props.getProperty("password",null)); ! tokens.put("username", props.getProperty("username",null)); ! tokens.put("name", props.getProperty("name",null)); ! tokens.put("email", props.getProperty("email",null)); ! tokens.put("resource", props.getProperty("resource","Sink")); return tokens; } public void updateAccount(HashMap details) throws ConfigException { ! props.setProperty("name", (String) details.get("name")); ! props.setProperty("email", (String) details.get("email")); ! props.setProperty("username", (String) details.get("username")); ! props.setProperty("resource", (String) details.get("resource")); ! props.setProperty("server", (String) details.get("server")); ! store(); } public void setPassword(String password) throws ConfigException { ! props.setProperty("password", password); SinkLog.log("storing password"); + store(); } ! ! /** ! * @return ! */ ! public boolean isFirstTime() ! { ! // TODO Auto-generated method stub ! return false; } } |
From: Jan A. <jma...@us...> - 2005-06-06 21:54:12
|
Update of /cvsroot/sink/sink/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5858/lib Added Files: wizard.jar Log Message: Setup wizard, new settings using the Java Preferences API, partial fix on wrong username on login --- NEW FILE: wizard.jar --- (This appears to be a binary file; contents omitted.) |
From: Jan A. <jma...@us...> - 2005-06-06 21:54:12
|
Update of /cvsroot/sink/sink/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5858/data Modified Files: sink.glade Log Message: Setup wizard, new settings using the Java Preferences API, partial fix on wrong username on login Index: sink.glade =================================================================== RCS file: /cvsroot/sink/sink/data/sink.glade,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** sink.glade 22 May 2005 11:06:50 -0000 1.2 --- sink.glade 6 Jun 2005 21:53:30 -0000 1.3 *************** *** 63,67 **** <child> ! <widget class="GtkToolButton" id="tool_audio_request"> <property name="visible">True</property> <property name="label" translatable="yes">_Audio</property> --- 63,67 ---- <child> ! <widget class="GtkToolButton" id="tool_media_request"> <property name="visible">True</property> <property name="label" translatable="yes">_Audio</property> *************** *** 71,92 **** <property name="visible_vertical">True</property> <property name="is_important">False</property> ! <signal name="clicked" handler="on_tool_audio_request_clicked" last_modification_time="Fri, 13 May 2005 02:42:01 GMT"/> ! </widget> ! <packing> ! <property name="expand">False</property> ! <property name="homogeneous">True</property> ! </packing> ! </child> ! ! <child> ! <widget class="GtkToolButton" id="tool_video_request"> ! <property name="visible">True</property> ! <property name="label" translatable="yes">_Video</property> ! <property name="use_underline">True</property> ! <property name="icon">video-preview.png</property> ! <property name="visible_horizontal">True</property> ! <property name="visible_vertical">True</property> ! <property name="is_important">False</property> ! <signal name="clicked" handler="on_tool_video_request_clicked" last_modification_time="Fri, 13 May 2005 02:41:48 GMT"/> </widget> <packing> --- 71,75 ---- <property name="visible_vertical">True</property> <property name="is_important">False</property> ! <signal name="clicked" handler="on_tool_media_request_clicked" last_modification_time="Tue, 24 May 2005 22:11:10 GMT"/> </widget> <packing> *************** *** 152,156 **** <property name="use_underline">True</property> <signal name="activate" handler="on_new_instant_message_activate" last_modification_time="Wed, 11 May 2005 14:18:27 GMT"/> - <accelerator key="N" modifiers="GDK_CONTROL_MASK" signal="activate"/> <child internal-child="image"> --- 135,138 ---- *************** *** 179,183 **** <property name="use_underline">True</property> <signal name="activate" handler="on_add_buddy_activate" last_modification_time="Wed, 09 Mar 2005 07:58:06 GMT"/> - <accelerator key="A" modifiers="GDK_MOD1_MASK" signal="activate"/> <child internal-child="image"> --- 161,164 ---- *************** *** 201,205 **** <property name="use_underline">True</property> <signal name="activate" handler="on_remove_buddy_activate" last_modification_time="Wed, 09 Mar 2005 07:58:57 GMT"/> - <accelerator key="R" modifiers="GDK_MOD1_MASK" signal="activate"/> <child internal-child="image"> --- 182,185 ---- *************** *** 271,275 **** <property name="use_underline">True</property> <signal name="activate" handler="on_edit_account_activate" last_modification_time="Wed, 09 Mar 2005 08:02:28 GMT"/> - <accelerator key="C" modifiers="GDK_MOD1_MASK" signal="activate"/> </widget> </child> --- 251,254 ---- *************** *** 934,938 **** <widget class="GtkLabel" id="label27"> <property name="visible">True</property> ! <property name="label" translatable="yes">_User ID:</property> <property name="use_underline">True</property> <property name="use_markup">False</property> --- 913,917 ---- <widget class="GtkLabel" id="label27"> <property name="visible">True</property> ! <property name="label" translatable="yes">_Username:</property> <property name="use_underline">True</property> <property name="use_markup">False</property> *************** *** 944,948 **** <property name="xpad">0</property> <property name="ypad">0</property> - <property name="mnemonic_widget">user_id_entry</property> <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> <property name="width_chars">-1</property> --- 923,926 ---- *************** *** 990,994 **** <child> ! <widget class="GtkEntry" id="user_id_entry"> <property name="visible">True</property> <property name="can_focus">True</property> --- 968,972 ---- <child> ! <widget class="GtkEntry" id="username_entry"> <property name="visible">True</property> <property name="can_focus">True</property> |
From: Jan A. <jma...@us...> - 2005-06-06 21:54:11
|
Update of /cvsroot/sink/sink/data/pixmaps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5858/data/pixmaps Added Files: clouds.jpg Log Message: Setup wizard, new settings using the Java Preferences API, partial fix on wrong username on login --- NEW FILE: clouds.jpg --- (This appears to be a binary file; contents omitted.) |
From: Jan A. <jma...@us...> - 2005-06-06 21:54:11
|
Update of /cvsroot/sink/sink/src/org/sink In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5858/src/org/sink Modified Files: Settings.java Log Message: Setup wizard, new settings using the Java Preferences API, partial fix on wrong username on login Index: Settings.java =================================================================== RCS file: /cvsroot/sink/sink/src/org/sink/Settings.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Settings.java 24 May 2005 21:05:14 -0000 1.13 --- Settings.java 6 Jun 2005 21:53:31 -0000 1.14 *************** *** 27,35 **** import java.util.HashMap; ! import java.util.Properties; import java.io.IOException; ! import java.io.FileNotFoundException; ! import java.io.FileInputStream; ! import java.io.FileOutputStream; import org.sink.exceptions.ConfigException; --- 27,35 ---- import java.util.HashMap; ! import java.util.prefs.Preferences; import java.io.IOException; ! //import java.io.FileNotFoundException; ! //import java.io.FileInputStream; ! //import java.io.FileOutputStream; import org.sink.exceptions.ConfigException; *************** *** 43,52 **** public class Settings { ! private String filename, title; ! private Properties props; ! ! public static String portVideo; ! public static String portAudio; ! // Use tokens if you want key,value pairs. // This is temp variable. make sure you call clear() before --- 43,48 ---- public class Settings { ! private final HashMap DEFAULTS = new HashMap(getDefaults()); ! // Use tokens if you want key,value pairs. // This is temp variable. make sure you call clear() before *************** *** 54,57 **** --- 50,56 ---- private HashMap tokens; + // The main man... + private Preferences orgSinkPrefs; + // Avoid multiple instances private static Settings instance = new Settings(); *************** *** 62,65 **** --- 61,81 ---- } + private HashMap getDefaults() { + HashMap temp = new HashMap(); + temp.put("selectedAudioDevice", "none, none"); + temp.put("selectedVideoDevice", "none, none"); + temp.put("audioDevices", "javasound://44100, JavaSound audio capture"); + temp.put("videoDevices", "none, none"); + temp.put("portAudio", "44008"); + temp.put("portVideo", "44000"); + temp.put("server", "localhost"); + temp.put("username", ""); + temp.put("password", ""); + temp.put("name", ""); + temp.put("email", ""); + temp.put("resource", "Sink"); + return temp; + } + /** Initialize Settings. * *************** *** 69,85 **** */ private Settings(){ ! filename = "sink.conf"; ! title = "Sink Configuration File"; ! props = new Properties(); try { ! load(); ! portVideo = getProperty("portVideo"); ! portAudio = getProperty("portAudio"); ! } catch (ConfigException ce) { ! SinkLog.logStackTrace(ce); } ! tokens = new HashMap(); } ! /** Get the value of the key in the settings. * --- 85,116 ---- */ private Settings(){ ! // retrieve /org/sink/ node settings. ! orgSinkPrefs = Preferences.userNodeForPackage(Settings.class); ! ! // etc... ! tokens = new HashMap(); ! } ! ! public boolean isFirstTime() { ! boolean firsttime = false; try { ! firsttime = orgSinkPrefs.getBoolean("virgin", true); ! } catch (IllegalStateException ex) { ! SinkLog.logStackTrace(ex); ! } catch (NullPointerException ex) { ! // first time.. ! firsttime = true; } ! return firsttime; } ! ! public void setupDone() { ! try { ! orgSinkPrefs.putBoolean("virgin", false); ! } catch (Exception ex) { ! ex.printStackTrace(); ! } ! } ! /** Get the value of the key in the settings. * *************** *** 88,94 **** */ public String getProperty(String key) { ! return props.getProperty(key); } ! /** Set the settings based on the key in the settings. * --- 119,134 ---- */ public String getProperty(String key) { ! String value = ""; ! String def = (String) DEFAULTS.get(key); ! try { ! value = orgSinkPrefs.get(key, def); ! } catch (NullPointerException ex) { ! ex.printStackTrace(); ! } catch (IllegalStateException ex) { ! ex.printStackTrace(); ! } ! return value; } ! /** Set the settings based on the key in the settings. * *************** *** 97,173 **** */ public void setProperty(String key, String value) { - props.setProperty(key, value); - } - - /** Loads the settings from the backend. - * - * @throws ConfigException - */ - public void load() throws ConfigException { - FileInputStream fis = null; try { ! fis = new FileInputStream(filename); ! props.load(fis); ! } ! catch(FileNotFoundException e) { ! throw new ConfigException(e); ! } ! catch(IOException e) { ! throw new ConfigException(e); ! } ! finally { ! try { ! fis.close(); ! } catch (IOException ioe) { ! throw new ConfigException(ioe); ! } catch (NullPointerException ex) { ! SinkLog.log("InputStream was never initialized"); ! } ! } ! } ! ! /** Stores the settings in the file backend. ! * ! * @throws ConfigException ! */ ! public void store() throws ConfigException { ! FileOutputStream fos = null; ! try { ! fos = new FileOutputStream(filename); ! props.store(fos, title); ! } ! catch(FileNotFoundException e) { ! throw new ConfigException(e); ! } ! catch(IOException e) { ! throw new ConfigException(e); ! } ! finally { ! try { ! fos.close(); ! } catch (IOException ioe) { ! throw new ConfigException(ioe); ! } catch (NullPointerException ex) { ! SinkLog.log("OutputStream was never initialized"); ! } } } - /** Get the filename of the settings file. - * - * @return the file name. - */ - public String getFilename() { - return filename; - } - - /** Get the configuration file's heading. - * - * @return the title of the properties file. - */ - public String getTitle() { - return title; - } - /** Get the server tokens for authentication * --- 137,147 ---- */ public void setProperty(String key, String value) { try { ! orgSinkPrefs.put(key, value); ! } catch (Exception ex) { ! ex.printStackTrace(); } } /** Get the server tokens for authentication * *************** *** 176,201 **** public HashMap getChatTokens() { tokens.clear(); ! tokens.put("server", props.getProperty("server","localhost")); ! tokens.put("password", props.getProperty("password",null)); ! tokens.put("username", props.getProperty("username",null)); ! tokens.put("name", props.getProperty("name",null)); ! tokens.put("email", props.getProperty("email",null)); ! tokens.put("resource", props.getProperty("resource","Sink")); return tokens; } public void updateAccount(HashMap details) throws ConfigException { ! props.setProperty("name", (String) details.get("name")); ! props.setProperty("email", (String) details.get("email")); ! props.setProperty("username", (String) details.get("username")); ! props.setProperty("resource", (String) details.get("resource")); ! props.setProperty("server", (String) details.get("server")); ! store(); } public void setPassword(String password) throws ConfigException { ! props.setProperty("password", password); SinkLog.log("storing password"); ! store(); } } --- 150,182 ---- public HashMap getChatTokens() { tokens.clear(); ! tokens.put("server", getProperty("server")); ! tokens.put("password", getProperty("password")); ! tokens.put("username", getProperty("username")); ! tokens.put("name", getProperty("name")); ! tokens.put("email", getProperty("email")); ! tokens.put("resource", getProperty("resource")); return tokens; } public void updateAccount(HashMap details) throws ConfigException { ! setProperty("name", (String) details.get("name")); ! setProperty("email", (String) details.get("email")); ! setProperty("username", (String) details.get("username")); ! setProperty("resource", (String) details.get("resource")); ! setProperty("server", (String) details.get("server")); } public void setPassword(String password) throws ConfigException { ! setProperty("password", password); SinkLog.log("storing password"); ! } ! ! public void store() throws ConfigException { ! try { ! orgSinkPrefs.flush(); ! } catch (java.util.prefs.BackingStoreException ex) { ! throw new ConfigException(ex, ! "Error while flushing content"); ! } } } |
From: Jan A. <jma...@us...> - 2005-06-06 21:54:11
|
Update of /cvsroot/sink/sink In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5858 Modified Files: README build.xml sink.sh Log Message: Setup wizard, new settings using the Java Preferences API, partial fix on wrong username on login Index: README =================================================================== RCS file: /cvsroot/sink/sink/README,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** README 25 Mar 2005 05:53:23 -0000 1.2 --- README 6 Jun 2005 21:53:29 -0000 1.3 *************** *** 3,6 **** --- 3,14 ---- + Authors: + + Jan Alonzo <jma...@gm...> + Michael Salcher <mic...@gm...> + William Barry <wil...@bi...> + + + Concurrent Version System (CVS) Guidelines: ------------------------------------------- Index: sink.sh =================================================================== RCS file: /cvsroot/sink/sink/sink.sh,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sink.sh 13 May 2005 00:28:07 -0000 1.1 --- sink.sh 6 Jun 2005 21:53:30 -0000 1.2 *************** *** 5,9 **** # e.g. # CLASSPATH=/my/other/project/build/dir:${CLASSPATH} ! CLASSPATH=lib/smackx-debug.jar:lib/smack.jar:lib/smackx.jar:lib/log4j.jar:lib/sinkdata.jar:${CLASSPATH} # Both of the commands below work. The first one uses the free gnu java --- 5,9 ---- # e.g. # CLASSPATH=/my/other/project/build/dir:${CLASSPATH} ! CLASSPATH=lib/smackx-debug.jar:lib/smack.jar:lib/smackx.jar:lib/log4j.jar:lib/jmf.jar:${CLASSPATH} # Both of the commands below work. The first one uses the free gnu java *************** *** 33,35 **** # Finally, we have all the info we need to execute. ! ${JAVA} -classpath ${JG_JARS}gtk2.6.jar:${JG_JARS}gnome2.10.jar:${JG_JARS}glade2.10.jar:${CLASSPATH} org/sink/gtk/SinkApp --- 33,35 ---- # Finally, we have all the info we need to execute. ! ${JAVA} -classpath ${JG_JARS}gtk2.6.jar:${JG_JARS}gnome2.10.jar:${JG_JARS}glade2.10.jar:${CLASSPATH} org/sink/swing/SinkApp Index: build.xml =================================================================== RCS file: /cvsroot/sink/sink/build.xml,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** build.xml 22 May 2005 11:05:15 -0000 1.6 --- build.xml 6 Jun 2005 21:53:30 -0000 1.7 *************** *** 7,17 **** <!-- Sink Related --> ! <property name="build.dir" location="build"/> ! <property name="build.prod.dir" location="${build.dir}/prod"/> ! <property name="data.dir" location="data"/> ! <property name="data.pixmaps.dir" location="${data.dir}/pixmaps"/> ! <property name="src.dir" location="src"/> ! <property name="src.sink.package.dir" location="${src.dir}/org/sink"/> ! <property name="lib.dir" location="lib"/> <!-- setup classpath --> --- 7,18 ---- <!-- Sink Related --> ! <property name="build.dir" location="build"/> ! <property name="build.prod.dir" location="${build.dir}/prod"/> ! <property name="build.tests.dir" location="${build.dir}/tests"/> ! <property name="data.dir" location="data"/> ! <property name="data.pixmaps.dir" location="${data.dir}/pixmaps"/> ! <property name="src.dir" location="src"/> ! <property name="lib.dir" location="lib"/> ! <property name="tests.dir" location="tests"/> <!-- setup classpath --> *************** *** 19,22 **** --- 20,24 ---- <path id="sink.classpath"> <pathelement location="${build.prod.dir}"/> + <pathelement location="${build.tests.dir}"/> <fileset dir="${lib.dir}"> <include name="*.jar"/> *************** *** 28,31 **** --- 30,34 ---- <target name="prepare"> <!-- jar the files for distribution --> + <mkdir dir="${build.tests.dir}"/> <mkdir dir="${build.prod.dir}/data"/> <mkdir dir="${build.prod.dir}/lib"/> *************** *** 69,73 **** </manifest> </jar--> ! <chmod file="sink.sh" perm="755"/> </target> --- 72,76 ---- </manifest> </jar--> ! <chmod file="${build.prod.dir}/sink.sh" perm="755"/> </target> *************** *** 104,107 **** --- 107,111 ---- > <include name="org/sink/**/**.java"/> + <include name="org/sink/**/**/**.java"/> <exclude name="org/sink/gtk/**.java"/> <classpath refid="sink.classpath"/> *************** *** 109,112 **** --- 113,142 ---- </target> + <!-- compile-tests: compiles the unit tests --> + <!-- ======================================================== --> + <target name="compile-tests" depends="compile-swing"> + <javac srcdir="${tests.dir}" destdir="${build.tests.dir}"> + <classpath refid="sink.classpath"/> + </javac> + </target> + + <!-- test: runs the unit tests --> + <!-- ======================================================== --> + <target name="test" depends="compile-tests"> + <junit haltonfailure="false"> + <classpath refid="sink.classpath"/> + <formatter type="xml" usefile="true"/> + <batchtest> + <fileset dir="${build.tests.dir}" includes="org/sink/**/*Test.class"/> + </batchtest> + </junit> + <junitreport todir="./reports"> + <fileset dir="."> + <include name="TEST-*.xml"/> + </fileset> + <report format="noframes" todir="./reports/html"/> + </junitreport> + </target> + <!-- clean: Cleans the build dir --> <!-- ======================================================== --> |
From: Jan A. <jma...@us...> - 2005-06-06 21:54:10
|
Update of /cvsroot/sink/sink/src/org/sink/media In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5858/src/org/sink/media Modified Files: DeviceController.java Log Message: Setup wizard, new settings using the Java Preferences API, partial fix on wrong username on login Index: DeviceController.java =================================================================== RCS file: /cvsroot/sink/sink/src/org/sink/media/DeviceController.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** DeviceController.java 1 Jun 2005 02:37:00 -0000 1.7 --- DeviceController.java 6 Jun 2005 21:53:31 -0000 1.8 *************** *** 52,55 **** --- 52,59 ---- } } + + public DeviceRegistry getRegistry() { + return this.dr; + } /** |
From: Jan A. <jma...@us...> - 2005-06-06 21:54:10
|
Update of /cvsroot/sink/sink/src/org/sink/chat In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5858/src/org/sink/chat Modified Files: Buddy.java BuddyList.java Connection.java ConnectionException.java MainViewAdapter.java Log Message: Setup wizard, new settings using the Java Preferences API, partial fix on wrong username on login Index: BuddyList.java =================================================================== RCS file: /cvsroot/sink/sink/src/org/sink/chat/BuddyList.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** BuddyList.java 31 May 2005 04:37:37 -0000 1.7 --- BuddyList.java 6 Jun 2005 21:53:31 -0000 1.8 *************** *** 43,63 **** private HashSet buddies; private Roster roster; ! private static BuddyList instance = new BuddyList(); private BuddyList() { - init(); - } - - private void init() { // This is ok since Roster is cached in Connection .. // .. and this class just basically wraps Roster anyway. // That means we avoid having roster objects > 1. roster = Connection.getConnection().getRoster(); - - // initialize Buddies; - buddies = new HashSet(); sync(); } // Make sure the internal buddy list is in sync with the server's RosterEntry. --- 43,100 ---- private HashSet buddies; private Roster roster; ! private boolean debug; ! private static BuddyList instance = null; private BuddyList() { // This is ok since Roster is cached in Connection .. // .. and this class just basically wraps Roster anyway. // That means we avoid having roster objects > 1. roster = Connection.getConnection().getRoster(); + init(); + } + + /** + * For testing use only. + * + * @param buds a set of test buddy ids + * @param debug sets the debug flag + */ + private BuddyList(HashSet buds, boolean debug) { + this.debug = debug; + buddies = buds; + } + + /** + * Initializes this class + */ + private void init() { + buddies = new HashSet(); sync(); } + + /** + * Get the instance of the BuddyList + * + * @return the buddy list instance + */ + public static synchronized BuddyList getInstance() { + if (instance == null) + instance = new BuddyList(); + return instance; + } + + /** + * Get this buddy list instance. For unit testing use only. Not meant for + * production use. + * + * @param boolean set the debug flag to value + * @return the buddy list instance + */ + public static synchronized BuddyList getInstance(HashSet buds, boolean debug) { + if (instance == null) + instance = new BuddyList(buds, debug); + return instance; + } // Make sure the internal buddy list is in sync with the server's RosterEntry. *************** *** 81,85 **** */ public synchronized Buddy getBuddy(String id) { - SinkLog.log("getBuddy: param "+id); Buddy b = null; for(Iterator i=getEntries();i.hasNext();) { --- 118,121 ---- *************** *** 89,106 **** } } - SinkLog.log("getBuddy: return " +b.getUser()); return b; } /** - * Get the instance of the BuddyList - * - * @return the buddy list instance - */ - public static synchronized BuddyList getInstance() { - return instance; - } - - /** * Add a new buddy with the given Jabber ID and name * --- 125,132 ---- *************** *** 110,124 **** */ public void addBuddy(String id, String name) throws ConnectionException { try { - Buddy buddy = new Buddy(id, name); if (!buddies.add(buddy)) { SinkLog.log(id+" is already in the list"); } ! roster.createEntry(id, name, null); ! RosterEntry entry = roster.getEntry(id); ! if (entry != null) { ! buddy.setEntry(entry); } - SinkLog.log(id+" added to buddies"); } catch (XMPPException ex) { throw new ConnectionException("Error Adding Buddy", --- 136,164 ---- */ public void addBuddy(String id, String name) throws ConnectionException { + Buddy buddy = new Buddy(id, name); + addBuddy(buddy); + } + + /** + * Adds a new Buddy object to this list of buddies. + * + * @param buddy A Buddy object + * @throws ConnectionException occurs when an error happens while adding + * the buddy. + */ + public void addBuddy(Buddy buddy) throws ConnectionException { + String id = buddy.getUser(); + String name = buddy.getName(); try { if (!buddies.add(buddy)) { SinkLog.log(id+" is already in the list"); } ! if (!debug) { ! roster.createEntry(id, name, null); ! RosterEntry entry = roster.getEntry(id); ! if (entry != null) { ! buddy.setEntry(entry); ! } } } catch (XMPPException ex) { throw new ConnectionException("Error Adding Buddy", *************** *** 139,145 **** SinkLog.log("Cannot remove non-existing buddy "); } ! roster.removeEntry(buddy.getEntry()); ! roster.reload(); ! SinkLog.log(id+" removed from buddies"); } catch (XMPPException ex) { throw new ConnectionException("Error removing buddy", --- 179,186 ---- SinkLog.log("Cannot remove non-existing buddy "); } ! if (!debug) { ! roster.removeEntry(buddy.getEntry()); ! roster.reload(); ! } } catch (XMPPException ex) { throw new ConnectionException("Error removing buddy", *************** *** 201,204 **** --- 242,255 ---- public boolean isAvailable(Buddy buddy) { Presence presence = getPresence(buddy.getUser()); + return isAvailable (presence); + } + + /** + * For testing use only. + * + * @param presence an org.jivesoftware.smack.packet.Presence object. + * @return boolean true if buddy is available (i.e. online), false otherwise. + */ + public boolean isAvailable(Presence presence) { Presence.Type ptype = (presence != null) ? presence.getType(): null; boolean avail = true; Index: Connection.java =================================================================== RCS file: /cvsroot/sink/sink/src/org/sink/chat/Connection.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Connection.java 22 May 2005 11:01:17 -0000 1.9 --- Connection.java 6 Jun 2005 21:53:31 -0000 1.10 *************** *** 33,40 **** import org.sink.SinkLog; ! /* TODO ! * ! * Add SSL Connection * */ public class Connection --- 33,41 ---- import org.sink.SinkLog; ! /** ! * Handles connection handling and also serves as a proxy to ! * <code>org.jivesoftware.smack.XMPPConnection</code>. * + * @author Jan Alonzo <jma...@gm...> */ public class Connection *************** *** 54,57 **** --- 55,66 ---- private Connection() {} + + /** + * Initialises a connection to the server + * + * @param server the server to connect to + * @throws ConnectionException happens when the XMPPConnection throws and + * exception. + */ public synchronized void initialize (String server) throws ConnectionException { if (! isInitialized()) { *************** *** 66,74 **** } public boolean isInitialized() { return (xmppConnection != null) ? true : false; } ! public void login (String username, String password) throws ConnectionException { try { --- 75,97 ---- } + /** + * Checks if the underyling XMPPConnection object has already been + * initialized. The only way to initialize the underlying XMPPConnection + * is to establish a connection to a Jabber server. + * + * @return boolean true if connected to a server, false otherwise + */ public boolean isInitialized() { return (xmppConnection != null) ? true : false; } ! /** ! * Logs in to the server with the given credentials. ! * ! * @param username the username of the account holder ! * @param password the password of the account holder ! * @throws ConnectionException occurs when something wicked happened to ! * the connection. ! */ public void login (String username, String password) throws ConnectionException { try { *************** *** 76,80 **** xmppConnection.login(username, password, "Sink"); } catch (XMPPException ex) { ! throw new ConnectionException("Error logging in", ex); } catch (IllegalStateException ise) { --- 99,103 ---- xmppConnection.login(username, password, "Sink"); } catch (XMPPException ex) { ! throw new ConnectionException("Please check your username and password if they are correct.", ex); } catch (IllegalStateException ise) { *************** *** 84,92 **** } public synchronized void logout() { ! xmppConnection.close(); ! xmppConnection = null; } public boolean isConnected () { if (xmppConnection != null) { --- 107,126 ---- } + /** + * Logs out the user and disconnects sink to the server. + * + */ public synchronized void logout() { ! if (xmppConnection != null) { ! xmppConnection.close(); ! xmppConnection = null; ! } } + /** + * Checks if we have a connection to a Jabber server. + * + * @return boolean true if sink is connected, false otherwise. + */ public boolean isConnected () { if (xmppConnection != null) { *************** *** 96,99 **** --- 130,155 ---- } + /** + * Checks if Sink is currently logged in. This is different from + * isConnected above. isConnected checks if we are connected to a server + * whereas this method checks if we are currently logged in. + * + * @return boolean true if sink is logged in, false otherwise. + */ + public boolean isLoggedIn() { + if (xmppConnection != null) { + return xmppConnection.isAuthenticated(); + } + return false; + } + + /** + * Returns the <code>org.jivesoftware.smack.Roster</code> associated with + * the XMPPConnection. + * + * <p> A roster object contains the user's buddy list. + * + * @return org.jivesoftware.smack.Roster object. + */ public synchronized Roster getRoster() { if (roster == null) { *************** *** 103,122 **** } public String getUser() { return xmppConnection.getUser(); } public AccountManager getAccountManager() { return xmppConnection.getAccountManager(); } public void sendPacket (Packet packet) { xmppConnection.sendPacket (packet); } ! public Chat createChat(String uid) { return xmppConnection.createChat(uid); } public void addMessageListener(PacketListener listener, PacketFilter filter) { --- 159,228 ---- } + /** + * Returns the user ID of the user. + * + * @return String the user's user ID. + */ public String getUser() { return xmppConnection.getUser(); } + /** + * Gets the <code>org.jivesoftware.smack.AccountManager</code> associated + * with this connection. An AccountManager manages creation and deletion + * of user, as well as updating the user's account info. + * + * @return the AccountManager associated with this account. + */ public AccountManager getAccountManager() { return xmppConnection.getAccountManager(); } + /** + * Sends a packet to the server. + * + * @param packet an instance of <code>org.jivesoftware.smack.packet.Packet</code>. + */ public void sendPacket (Packet packet) { xmppConnection.sendPacket (packet); } ! ! /** ! * Creates a new Chat object with the given buddy ID. ! * ! * @param uid the user ID of the buddy the user wants to talk to. ! * @return a Chat object that handles text messages between user and the buddy. ! */ public Chat createChat(String uid) { return xmppConnection.createChat(uid); } + /** + * Creates a new Jabber account in the server. + * + * @param uid the desired User ID of the user. + * @param password the desired password of the user. + * @throws ConnectionException occurs when something wicked happened while + * creating the account. + */ + public void createAccount(String uid, String password ) + throws ConnectionException { + try { + AccountManager mgr = getAccountManager(); + mgr.createAccount(uid, password); + } catch (XMPPException ex) { + throw new ConnectionException("Error creating account", + ex); + } + } + + /** + * Adds a MessageListener to this connection. Use this if you want to + * listen for specific Message events like incoming text messages, etc... + * + * @param listener an implementation of + * <code>org.jivesoftware.smack.PackerListener</code> interface. + * @param filter a PacketFilter object. + */ public void addMessageListener(PacketListener listener, PacketFilter filter) { *************** *** 124,127 **** --- 230,240 ---- } + /** + * Adds a MessageListener to this connection. See + * <code>addMessageListener(PacketListener, PacketFilter)</code> for more + * info. + * + * @param listener an implementation of PacketListener. + */ public void addMessageListener(PacketListener listener) { SinkLog.log("add message listener"); *************** *** 130,133 **** --- 243,253 ---- } + /** + * Removes a listener object to this connection. Normally this is use when + * a chat session is finish and we don't want to receive anymore events + * coming from the user or buddy. + * + * @param listener an implementation of PacketListener. + */ public void removeListener(PacketListener listener) { xmppConnection.removePacketListener(listener); Index: Buddy.java =================================================================== RCS file: /cvsroot/sink/sink/src/org/sink/chat/Buddy.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Buddy.java 6 Jun 2005 02:07:07 -0000 1.16 --- Buddy.java 6 Jun 2005 21:53:31 -0000 1.17 *************** *** 179,182 **** --- 179,183 ---- * * @return String the buddy's hostname. + */ public String getHostOnly() { StringTokenizer st = new StringTokenizer(ip, "/"); *************** *** 192,196 **** */ public String getVideoPort() { ! return Settings.portVideo; } --- 193,198 ---- */ public String getVideoPort() { ! Settings settings = Settings.getSettings(); ! return settings.getProperty("portVideo"); } *************** *** 203,207 **** */ public String getAudioPort() { ! return Settings.portAudio; } --- 205,210 ---- */ public String getAudioPort() { ! Settings settings = Settings.getSettings(); ! return settings.getProperty("portAudio"); } Index: MainViewAdapter.java =================================================================== RCS file: /cvsroot/sink/sink/src/org/sink/chat/MainViewAdapter.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** MainViewAdapter.java 6 Jun 2005 06:09:55 -0000 1.17 --- MainViewAdapter.java 6 Jun 2005 21:53:31 -0000 1.18 *************** *** 58,62 **** public MainViewAdapter() { connection = Connection.getConnection(); ! if (connection.isInitialized()) { initConnection(); } --- 58,62 ---- public MainViewAdapter() { connection = Connection.getConnection(); ! if (connection.isConnected() && connection.isLoggedIn()) { initConnection(); } *************** *** 191,195 **** */ public void requestMediaChat(String buddyId) { - SinkLog.log("REQUESTING MEDIA CHAT WITH "+buddyId); Message request = new Message(buddyId, Message.Type.NORMAL); request.setProperty("request", "media"); --- 191,194 ---- *************** *** 268,272 **** } }; - SinkLog.log("no existing chat... initializing thread"); Thread thread = new Thread(run); thread.start(); --- 267,270 ---- *************** *** 296,300 **** Message message = (Message) packet; Message.Type mtype = message.getType(); - System.out.println("message.getFrom() above returned " + message.getFrom()); String buddyid = StringUtils.parseBareAddress(message.getFrom()); --- 294,297 ---- *************** *** 305,318 **** Buddy buddy = buddyList.getBuddy(buddyid); - System.out.println("message.getFrom() normal returned " + message.getFrom()); - if (request!=null && "media".equals(request)) { if ("media".equals(request)) { - SinkLog.log("PROCESSING MEDIA REQUEST FROM "+buddy.getUser()); buddy.setIP((String) message.getProperty("ipaddress")); processMediaRequest(buddy); } } else if (null != message.getProperty("response")) { - SinkLog.log("processing response"); Boolean b = (Boolean)message.getProperty("response"); buddy.setIP((String) message.getProperty("ipaddress")); --- 302,311 ---- *************** *** 321,326 **** } } else if (mtype == Message.Type.CHAT) { - SinkLog.log("message chat type, checking chat"); - System.out.println("message.getFrom() chat returned " + message.getFrom()); checkIfChatExist(buddyid, message.getBody()); } else if (mtype == Message.Type.ERROR) { --- 314,317 ---- Index: ConnectionException.java =================================================================== RCS file: /cvsroot/sink/sink/src/org/sink/chat/ConnectionException.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ConnectionException.java 9 May 2005 18:43:54 -0000 1.3 --- ConnectionException.java 6 Jun 2005 21:53:31 -0000 1.4 *************** *** 29,33 **** public String getMessage () { ! return wrappedException.getMessage(); } --- 29,33 ---- public String getMessage () { ! return description; } *************** *** 35,37 **** --- 35,41 ---- return this.description; } + + public String getWrappedMessage() { + return wrappedException.getMessage(); + } } |
From: Jan A. <jma...@us...> - 2005-06-06 21:54:10
|
Update of /cvsroot/sink/sink/tests/org/sink/chat In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5858/tests/org/sink/chat Added Files: BuddyListTest.java Log Message: Setup wizard, new settings using the Java Preferences API, partial fix on wrong username on login --- NEW FILE: BuddyListTest.java --- package org.sink.chat; import java.util.HashSet; import java.util.Vector; import junit.framework.*; import org.jivesoftware.smack.packet.Presence; import org.sink.chat.BuddyList; import org.sink.chat.Buddy; /** * BuddyList test. Buddy List manages add, remove, and other * buddy-related tasks like checking for availability, retrieving * a buddy object, etc... * */ public class BuddyListTest extends TestCase { private HashSet buddies = new HashSet(); private Buddy buddy; private BuddyList buddyList = null; private Vector ids = new Vector(); /** * Setup test data. * */ public BuddyListTest() { ids.add("jan@foo"); ids.add("naj@blah"); ids.add("mike@tafe"); ids.add("rob@tafe"); ids.add("will@tafe"); } /** * Populate buddy list with from test data. This method gets called * everytime a test runs. * */ public void setUp() { buddies.add(new Buddy((String)ids.get(0), "JanFoo")); buddies.add(new Buddy((String)ids.get(1), "NajBlah")); buddies.add(new Buddy((String)ids.get(2), "MikeTafe")); buddies.add(new Buddy((String)ids.get(3), "RobTafe")); buddies.add(new Buddy((String)ids.get(4), "WillTafe")); buddyList = BuddyList.getInstance(buddies, true); } /** * Clear the buddy list after tests are run. This method gets called * everytime a test finishes, successful or otherwise. * */ public void tearDown() { buddies.clear(); } /** * Spec 1-a: Adds a buddy if it's not in the list */ public void testAddBuddyNotInList() { String id = "van@tafe"; String name = "VanTafe"; try { buddyList.addBuddy(id, name); Buddy b = buddyList.getBuddy(id); java.util.Vector bds = buddyList.getBuddies(); assertTrue(bds.contains((Buddy) b)); } catch (org.sink.chat.ConnectionException ex) { fail("Should not throw a ConnectionException"); } } /** * Spec 1-b: Adds a buddy even if it's in the list. We compare the hash of two * buddy objects to check that the created buddy is not the same as the * one in the list. */ public void testAddBuddyInList() { String id = "jan@foo"; String name = "JanFoo"; try { Buddy a = new Buddy(id, name); int ah = a.hashCode(); buddyList.addBuddy(a); Buddy b = buddyList.getBuddy(id); int bh = b.hashCode(); assertNotSame(ah, bh); } catch (org.sink.chat.ConnectionException ex) { fail("ConnectionException should not occur in testing"); } } /** * Spec 1-c: Adds a null buddy */ public void testAddBuddyIsNull() { Buddy buddy = null; try { buddyList.addBuddy(buddy); fail("Should've thrown an exception"); } catch (NullPointerException ex) { fail("Null pointer exception caught"); } catch (org.sink.chat.ConnectionException ex) { fail("ConnectionException should not occur in testing"); } } /** * Spec 2-a: Removes a non-existing buddy */ public void testRemoveBuddyNotInList() { String id = "ben@tafe"; try { buddyList.removeBuddy(id); fail("Should've thrown an exception"); } catch (org.sink.chat.ConnectionException ex) { fail("ConnectionException should not occur in testing"); } } /** * Spec 2-b: Remove an existing buddy */ public void testRemoveBuddyInList() { String id = "mike@tafe"; try { buddyList.removeBuddy(id); java.util.Vector buds = buddyList.getBuddies(); for(java.util.Iterator it=buds.iterator(); it.hasNext();) { Buddy b = (Buddy)it.next(); if (b.getUser().equals(id)) { fail("Should've been deleted"); } } } catch (org.sink.chat.ConnectionException ex) { fail("ConnectionException should not occur in testing"); } } /** * Spec 2-c: removes a null buddy id */ public void testRemoveBuddyIsNull() { try { buddyList.removeBuddy(null); fail("Should've thrown an exception"); } catch (org.sink.chat.ConnectionException ex) { fail("ConnectionException should not occur in testing"); } } /** * Spec 3-a: Get an existing buddy from the buddy list. */ public void testGetBuddyInList() { String id = "will@tafe"; Buddy b = buddyList.getBuddy(id); assertEquals(b.getUser(), id); } /** * Spec 3-b: Get a non-existing buddy. */ public void testGetBuddyNotInList() { String id = "rae@tafe"; // getBuddy(String) returns null on non-existent ID. Buddy b = buddyList.getBuddy(id); assertNull(b); } /** * Spec 3-c: retrieves a null buddy id */ public void testGetBuddyIsNull() { Buddy buddy = null; try { buddyList.removeBuddy(null); fail("Should've thrown an exception"); } catch (NullPointerException ex) { fail("caught NullPointerException"); } catch (org.sink.chat.ConnectionException ex) { fail("ConnectionException should not occur in testing"); } } /** * Spec 4-a: Retrieve test buddy objects. */ public void testGetBuddies() { java.util.Vector buds = buddyList.getBuddies(); for (java.util.Iterator it=buds.iterator(); it.hasNext();) { Buddy b = (Buddy) it.next(); if (!ids.contains((String) b.getUser())) { fail("Buddy ID is not in the list of IDs"); } } } /** * Spec 5-a: Tests an offline buddy * */ public void testIsAvailableAndOffline() { Presence p = new Presence(Presence.Type.UNAVAILABLE); assertFalse(buddyList.isAvailable(p)); } /** * Spec 5-c: Tests a null buddy's availability. */ public void testIsAvailableAndNull() { Presence p = null; assertFalse(buddyList.isAvailable(p)); } /** * Spec 5-d: Test an online buddy */ public void testIsAvailableAndOnline() { Presence p = new Presence(Presence.Type.AVAILABLE); assertTrue(buddyList.isAvailable(p)); } } |
From: Jan A. <jma...@us...> - 2005-06-06 21:54:10
|
Update of /cvsroot/sink/sink/src/org/sink/swing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5858/src/org/sink/swing Modified Files: BuddyListController.java BuddyListWindow.java GBPanel.java ListBuddies.java SinkApp.java Log Message: Setup wizard, new settings using the Java Preferences API, partial fix on wrong username on login Index: SinkApp.java =================================================================== RCS file: /cvsroot/sink/sink/src/org/sink/swing/SinkApp.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** SinkApp.java 1 Jun 2005 10:42:20 -0000 1.7 --- SinkApp.java 6 Jun 2005 21:53:31 -0000 1.8 *************** *** 7,13 **** --- 7,17 ---- import org.sink.chat.Connection; import org.sink.chat.ConnectionException; + + import org.sink.swing.wizard.SetupWizard; + import org.sink.media.DeviceController; import org.sink.media.MediaSemiConstants; + /** * Launches sink. *************** *** 19,63 **** private Connection xmppCon; ! /** ! * Displays a splash screen and launches sink. ! * ! * @param args command line arguments are not used. ! */ ! public static void main(String[] args) ! { ! SplashScreen splash = new SplashScreen("data/pixmaps/splash.jpg", null, 5000); ! SinkApp sink = new SinkApp(); ! sink.start(); ! } ! ! private synchronized void init() throws ConnectionException ! { ! settings = Settings.getSettings(); xmppCon = Connection.getConnection(); HashMap tokens = settings.getChatTokens(); ! if(! xmppCon.isInitialized()) ! { xmppCon.initialize((String)tokens.get("server")); } xmppCon.login((String)tokens.get("username"), (String)tokens.get("password")); } ! private void initDevices() ! { ! DeviceController dc = new DeviceController(); ! MediaSemiConstants.VIDEO_LOCATOR = dc.getSelectedVideoDeviceLocator(); ! MediaSemiConstants.AUDIO_LOCATOR = dc.getSelectedAudioDeviceLocator(); ! ! } ! ! private void start() { //TODO:splash screen until sink has loaded ! try ! { init(); initDevices(); --- 23,77 ---- private Connection xmppCon; ! /** ! * Displays a splash screen and launches sink. ! * ! * @param args command line arguments are not used. ! */ ! public static void main(String[] args) { ! SinkApp sink = new SinkApp(); ! sink.start(); ! } ! ! private synchronized void init() ! throws ConnectionException ! { xmppCon = Connection.getConnection(); HashMap tokens = settings.getChatTokens(); ! if(! xmppCon.isInitialized()) { xmppCon.initialize((String)tokens.get("server")); } xmppCon.login((String)tokens.get("username"), (String)tokens.get("password")); + + } + + private void start() + { + int ret = 0; + settings = Settings.getSettings(); + if (settings.isFirstTime()) { + SetupWizard setup = new SetupWizard(); + ret = setup.start(); + } + + if (ret == 0) + showSink(); } ! private void initDevices() { + DeviceController dc = new DeviceController(); + MediaSemiConstants.VIDEO_LOCATOR = dc.getSelectedVideoDeviceLocator(); + MediaSemiConstants.AUDIO_LOCATOR = dc.getSelectedAudioDeviceLocator(); + + } + + private void showSink() { //TODO:splash screen until sink has loaded + SplashScreen splash = new SplashScreen("data/pixmaps/splash.jpg", null, 5000); ! try { init(); initDevices(); *************** *** 66,71 **** blw = new BuddyListWindow((String) tokens.get("username"), true); } ! catch(ConnectionException cex) ! { SinkLog.logStackTrace(cex); --- 80,84 ---- blw = new BuddyListWindow((String) tokens.get("username"), true); } ! catch(ConnectionException cex) { SinkLog.logStackTrace(cex); Index: BuddyListWindow.java =================================================================== RCS file: /cvsroot/sink/sink/src/org/sink/swing/BuddyListWindow.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** BuddyListWindow.java 6 Jun 2005 06:09:54 -0000 1.37 --- BuddyListWindow.java 6 Jun 2005 21:53:31 -0000 1.38 *************** *** 98,102 **** //lblUserId.setBounds(HIND,VIND + 30,HTOTAL-HIND*3,15); //pnlBuddyListWindow.add(lblUserId); ! setDisplayId(userId); frmBuddyListWindow.add(tpBuddyList); --- 98,102 ---- //lblUserId.setBounds(HIND,VIND + 30,HTOTAL-HIND*3,15); //pnlBuddyListWindow.add(lblUserId); ! updateFrameTitle(); frmBuddyListWindow.add(tpBuddyList); *************** *** 125,131 **** } ! public void setDisplayId(String userId){ ! //lblUserId.setText(userId); ! frmBuddyListWindow.setTitle("Sink: " + userId); } --- 125,134 ---- } ! public void updateFrameTitle() { ! if (blc.isConnected()) { ! frmBuddyListWindow.setTitle("Sink - " + userId); ! } else { ! frmBuddyListWindow.setTitle("Sink - Not Connected"); ! } } Index: BuddyListController.java =================================================================== RCS file: /cvsroot/sink/sink/src/org/sink/swing/BuddyListController.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** BuddyListController.java 6 Jun 2005 07:36:14 -0000 1.37 --- BuddyListController.java 6 Jun 2005 21:53:31 -0000 1.38 *************** *** 81,87 **** --- 81,91 ---- buddyList = BuddyList.getInstance(); blw.initBuddyListContent(buddyList.getBuddies()); + blw.updateFrameTitle(); setConnected(true); setWithOrWithoutBuddies(); } catch (ConnectionException e) { + if (e.getWrappedMessage().equals("(401)")) { + e = new ConnectionException("Cannot Login: wrong username or password. Please check your settings and try again.",e); + } new ErrorController(e); } catch (IllegalStateException e) { *************** *** 94,97 **** --- 98,102 ---- disconnect(); blw.clearBuddyList(); + blw.updateFrameTitle(); setConnected(false); setWithOrWithoutBuddies(); *************** *** 246,250 **** public Vector getBuddies() { ! if (connection.isConnected()) { buddyList = BuddyList.getInstance(); return buddyList.getBuddies(); --- 251,255 ---- public Vector getBuddies() { ! if (isConnected()) { buddyList = BuddyList.getInstance(); return buddyList.getBuddies(); *************** *** 624,628 **** public boolean isConnected() { ! return Connection.getConnection().isConnected(); } --- 629,633 ---- public boolean isConnected() { ! return Connection.getConnection().isLoggedIn(); } Index: ListBuddies.java =================================================================== RCS file: /cvsroot/sink/sink/src/org/sink/swing/ListBuddies.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ListBuddies.java 6 Jun 2005 06:09:54 -0000 1.4 --- ListBuddies.java 6 Jun 2005 21:53:31 -0000 1.5 *************** *** 22,26 **** buddyList = bl; selectedRow = -1; ! data = buddyList.getBuddies(); if (data.size() > 0) { initData(data); --- 22,30 ---- buddyList = bl; selectedRow = -1; ! if (Connection.getConnection().isLoggedIn()) ! data = buddyList.getBuddies(); ! else ! data = new Vector(); ! if (data.size() > 0) { initData(data); *************** *** 50,68 **** } - /* - public void add(String categoryName) throws ResourceException { - Category category = categoryStore.addCategory(categoryName); - data.addElement(category); - System.out.println("Added " + categoryName + " to model"); - int idx = data.indexOf(category); - fireIntervalAdded(this, idx, idx); - } - - public void remove(Category cat, int index) throws ResourceException { - categoryStore.removeCategory(cat); - data.removeElement(cat); - fireIntervalRemoved(this, index, index); - }*/ - public void update() { data = buddyList.getBuddies(); --- 54,57 ---- *************** *** 74,103 **** fireContentsChanged(this, 0 ,data.size()); } - /* - public void shutdown() throws ResourceException { - categoryStore.shutdown(); - } - - public void addItemToCategory (Category category, int itemId) - { - try { - category.addItemId(itemId); - categoryStore.updateCategory(category); - } - catch (ResourceException rex) { - //rex.printStackTrace(); - } - } - - public void deleteItemInCategory (int itemId) throws ResourceException { - Category cat; - Iterator cit = data.iterator(); - while (cit.hasNext()) { - cat = (Category) cit.next(); - if (cat.hasItemId(itemId)) { - cat.removeItemId(itemId); - categoryStore.updateCategory(cat); - } - } - }*/ } --- 63,65 ---- Index: GBPanel.java =================================================================== RCS file: /cvsroot/sink/sink/src/org/sink/swing/GBPanel.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** GBPanel.java 31 May 2005 02:57:04 -0000 1.4 --- GBPanel.java 6 Jun 2005 21:53:31 -0000 1.5 *************** *** 25,57 **** import javax.swing.*; ! class GBPanel extends JPanel{ ! private GridBagConstraints gbc =new GridBagConstraints(); ! GBPanel(){ ! setLayout(new GridBagLayout()); ! } ! void addComponent(Component comp, int gx,int gy,int gw,int an, int fl){ ! GridBagConstraints gbc=new GridBagConstraints(); ! ! gbc.gridx=gx; ! gbc.gridy=gy; ! gbc.gridwidth=gw; ! gbc.anchor=an; ! gbc.fill=fl; ! ! this.add(comp,gbc); ! } ! void addComponent(Component comp, int gx,int gy,int gw,int an, int fl,int wx,int wy){ ! GridBagConstraints gbc=new GridBagConstraints(); ! ! gbc.gridx=gx; ! gbc.gridy=gy; ! gbc.gridwidth=gw; ! gbc.anchor=an; ! gbc.fill=fl; ! gbc.weightx=wx; ! gbc.weighty=wy; ! ! this.add(comp,gbc); ! } ! } \ No newline at end of file --- 25,65 ---- import javax.swing.*; ! public class GBPanel extends JPanel{ ! private GridBagConstraints gbc =new GridBagConstraints(); ! ! public GBPanel(){ ! setLayout(new GridBagLayout()); ! } ! ! public void addComponent(Component comp, int gx,int gy,int gw,int an, int fl){ ! GridBagConstraints gbc=new GridBagConstraints(); ! gbc.gridx=gx; ! gbc.gridy=gy; ! gbc.gridwidth=gw; ! gbc.anchor=an; ! gbc.fill=fl; ! ! // some usability stuff. ! gbc.insets = new Insets(6,6,6,6); ! //gbc.ipadx = 6; gbc.ipady = 6; ! this.add(comp,gbc); ! } ! ! public void addComponent(Component comp, int gx,int gy,int gw,int an, int fl,int wx,int wy){ ! GridBagConstraints gbc=new GridBagConstraints(); ! ! gbc.gridx=gx; ! gbc.gridy=gy; ! gbc.gridwidth=gw; ! gbc.anchor=an; ! gbc.fill=fl; ! gbc.weightx=wx; ! gbc.weighty=wy; ! ! // some usability stuff ! gbc.insets = new Insets(6,6,6,6); ! gbc.ipadx = 6; gbc.ipady = 6; ! this.add(comp,gbc); ! } ! } |
From: Jan A. <jma...@us...> - 2005-06-06 21:54:10
|
Update of /cvsroot/sink/sink/src/org/sink/swing/wizard In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5858/src/org/sink/swing/wizard Added Files: AccountDetailsDescriptor.java AccountDetailsPanel.java AccountRegDescriptor.java AccountRegPanel.java SetupWizard.java Log Message: Setup wizard, new settings using the Java Preferences API, partial fix on wrong username on login --- NEW FILE: AccountRegPanel.java --- package org.sink.swing.wizard; import javax.swing.*; import javax.swing.border.*; import java.awt.*; import java.awt.event.*; import com.nexes.wizard.*; import org.sink.swing.GBPanel; public class AccountRegPanel extends JPanel { private JLabel progressText; private JProgressBar progressBar; private JLabel welcomeTitle; private JPanel contentPanel; private JPanel titlePanel; private JPanel accountPanel; private JPanel devicesPanel; private JLabel textLabel; private JLabel iconLabel; private JLabel doneLabel; private JSeparator separator; private GBPanel panelContent; public AccountRegPanel() { super(); contentPanel = getContentPanel(); ImageIcon icon = getImageIcon(); titlePanel = new JPanel(); textLabel = new JLabel(); iconLabel = new JLabel(); separator = new JSeparator(); setLayout( new BorderLayout()); titlePanel.setLayout(new BorderLayout()); titlePanel.setBackground(Color.gray); textLabel.setBackground(Color.gray); textLabel.setForeground(Color.white); textLabel.setFont(new Font("Sans", Font.BOLD, 14)); textLabel.setText("Setting up Account and Devices"); textLabel.setBorder( new EmptyBorder(new Insets( 10,10,10,10))); textLabel.setOpaque(true); iconLabel.setBackground(Color.gray); if (icon != null) iconLabel.setIcon(icon); titlePanel.add(textLabel, BorderLayout.CENTER); titlePanel.add(iconLabel, BorderLayout.EAST); titlePanel.add(separator, BorderLayout.SOUTH); add(titlePanel, BorderLayout.NORTH); JPanel contentHolderPanel = new JPanel(); contentHolderPanel.add(contentPanel, BorderLayout.NORTH); add(contentHolderPanel, BorderLayout.WEST); } public void setProgressText(String s) { progressText.setText(s); } public void setProgressValue(int value) { progressBar.setValue(value); } public void setWelcomeTitle(String text) { welcomeTitle.setText(text); } private JPanel getContentPanel() { panelContent = new GBPanel(); welcomeTitle = new JLabel(); progressText = new JLabel(); progressBar = new JProgressBar(); // Progress Panel JPanel progressPanel = new JPanel(); progressPanel.setLayout(new GridLayout(0,2)); welcomeTitle.setText("Setting Up Account ..."); add (welcomeTitle, 0, 0, 2); progressBar.setStringPainted(true); progressPanel.add(progressBar); progressPanel.add(new JLabel()); // space progressText.setFont(new Font("Sans-Serif", 1, 12)); progressText.setText("Connecting to server..."); progressPanel.add(progressText); add (progressPanel, 0, 1, 2); // Account Panel accountPanel = new JPanel(); accountPanel.setLayout(new GridLayout(0,1)); add (accountPanel, 0, 2, 2); // Devices Panel devicesPanel = new JPanel(); devicesPanel.setLayout(new GridLayout(0,1)); add (devicesPanel, 0, 3, 2); doneLabel = new JLabel(); doneLabel.setText("Setup is complete. Press 'Finish' to start sink.."); doneLabel.setVisible(false); add (doneLabel, 0, 4, 2); return panelContent; } public void reset() { welcomeTitle.setText("Setting Up Account ..."); progressText.setText("Connecting to server..."); doneLabel.setVisible(false); // clear account panel objects Component[] comps = accountPanel.getComponents(); destroyComps(comps, accountPanel); // clear devices panel objects comps = devicesPanel.getComponents(); destroyComps(comps, devicesPanel); } private void destroyComps(Component[] cs, JPanel comp) { for (int x=0; x < cs.length; x++) { JLabel l = (JLabel) cs[x]; l.setText(""); comp.remove(cs[x]); } } public void addAccountSummaryLabel() { JLabel label = new JLabel(); label.setForeground(Color.BLUE); label.setFont(new Font("Sans-Serif", 1, 14)); label.setText("Account Summary"); accountPanel.add(label); } public void accountSummary(String text) { JLabel summ = new JLabel(); summ.setText(text); accountPanel.add(summ); } public void addDevicesLabel(String text) { JLabel label = new JLabel(); label.setForeground(Color.BLUE); label.setFont(new Font("Sans-Serif", 1, 14)); label.setText(text); devicesPanel.add(new JLabel()); // space devicesPanel.add(label); } public void devicesSummary(String text) { JLabel summ = new JLabel(); summ.setText("Device Name: " + text); devicesPanel.add(summ); } public void setupDone() { doneLabel.setVisible(true); } private void add(JComponent comp, int x, int y, int width) { panelContent.addComponent(comp, x, y, width, GridBagConstraints.FIRST_LINE_START, GridBagConstraints.HORIZONTAL); } private ImageIcon getImageIcon() { return new ImageIcon("data/pixmaps/sink.jpg"); } } --- NEW FILE: AccountDetailsDescriptor.java --- package org.sink.swing.wizard; import com.nexes.wizard.*; import java.awt.*; import javax.swing.*; import java.awt.event.*; public class AccountDetailsDescriptor extends WizardPanelDescriptor implements ActionListener, KeyListener { public static final String IDENTIFIER = "ACCOUNT_DETAILS"; private AccountDetailsPanel panel; private boolean isNew; private SetupWizard wiz; public AccountDetailsDescriptor () { panel = new AccountDetailsPanel(); panel.addCheckBoxActionListener(this); panel.addUseridPasswordListener(this); setPanelDescriptorIdentifier(IDENTIFIER); setPanelComponent(panel); } public Object getNextPanelDescriptor () { return AccountRegDescriptor.IDENTIFIER; } public Object getBackPanelDescriptor () { return null; } public void actionPerformed(ActionEvent event) { if ("newAccount".equals(event.getActionCommand())) { isNew = panel.isCheckBoxSelected(); } } public void aboutToHidePanel() { wiz = (SetupWizard) getWizard(); wiz.setAccountDetails(panel.getUserID(), panel.getPassword(), isNew); } public void aboutToDisplayPanel() { setNextAccordingly(); } public void keyPressed(KeyEvent evt) {} public void keyTyped(KeyEvent evt) {} public void keyReleased(KeyEvent e){ setNextAccordingly(); } private void setNextAccordingly() { String uid = panel.getUserID(); String pass = panel.getPassword(); boolean b = false; wiz = (SetupWizard) getWizard(); if (uid.length() > 0 && pass.length() > 0) { b = true; } wiz.setNextFinishButtonEnabled(b); } } --- NEW FILE: SetupWizard.java --- /** * Copyright (C) 2005 Jan Alonzo * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package org.sink.swing.wizard; import com.nexes.wizard.*; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import javax.swing.*; import org.jivesoftware.smack.AccountManager; import org.jivesoftware.smack.util.StringUtils; import org.sink.Settings; import org.sink.chat.Connection; import org.sink.chat.ConnectionException; import org.sink.exceptions.ConfigException; import org.sink.media.DeviceController; import org.sink.media.DeviceRegistry; import org.sink.media.DeviceInformation; public class SetupWizard extends Wizard { private HashMap setupDetails; private HashMap auDevDetails; private HashMap viDevDetails; private Connection conn; private AccountManager accountMgr; private DeviceController devCtrlr; private DeviceRegistry devReg; public SetupWizard() { super(); getDialog().setTitle("Sink Setup"); WizardPanelDescriptor accountDetailsDescriptor = new AccountDetailsDescriptor(); registerWizardPanel (AccountDetailsDescriptor.IDENTIFIER, accountDetailsDescriptor); WizardPanelDescriptor accRegDesc = new AccountRegDescriptor(); registerWizardPanel (AccountRegDescriptor.IDENTIFIER, accRegDesc); setupDetails = new HashMap(); devCtrlr = new DeviceController(); devReg = devCtrlr.getRegistry(); } public int start() { setCurrentPanel (AccountDetailsDescriptor.IDENTIFIER); int ret = showModalDialog(); return ret; } public void setAccountDetails(String userid, String password, boolean isNew) { String username = StringUtils.parseName(userid); String server = StringUtils.parseServer(userid); setupDetails.put("username", username); setupDetails.put("password", password); setupDetails.put("server", server); setupDetails.put("isNew", new Boolean(isNew).toString()); } public Object getAccountProperty(String key) { return setupDetails.get(key); } public void connect() throws ConnectionException { conn = Connection.getConnection(); if (! conn.isInitialized()) conn.initialize((String) setupDetails.get("server")); } public boolean checkAccountCreationSupport() { accountMgr = conn.getAccountManager(); return accountMgr.supportsAccountCreation(); } public void createAccount() throws ConnectionException { conn.createAccount((String)setupDetails.get("username"), (String)setupDetails.get("password")); } public void saveToPrefs() throws ConfigException { Settings settings = Settings.getSettings(); settings.setProperty("username", (String)setupDetails.get("username")); settings.setProperty("password", (String)setupDetails.get("password")); settings.setProperty("server", (String)setupDetails.get("server")); settings.store(); } public ArrayList getVideoDevices() { devCtrlr.deviceLookup(); ArrayList videoDevs = devReg.getVideoDevices(); viDevDetails = devicesToHashMap(videoDevs); return videoDevs; } public ArrayList getAudioDevices() { devCtrlr.deviceLookup(); ArrayList audioDevs = devReg.getAudioDevices(); auDevDetails = devicesToHashMap(audioDevs); return audioDevs; } private HashMap devicesToHashMap(ArrayList devs) { DeviceInformation devInfo; HashMap devices = new HashMap(); for (Iterator it=devs.iterator(); it.hasNext();) { devInfo = (DeviceInformation) it.next(); devices.put(devInfo.getLocator(), (String) devInfo.getName()); } return devices; } } --- NEW FILE: AccountRegDescriptor.java --- package org.sink.swing.wizard; import com.nexes.wizard.*; import java.util.ArrayList; import java.util.Iterator; import java.util.HashMap; import java.awt.*; import javax.swing.*; import org.sink.media.DeviceInformation; import org.sink.chat.ConnectionException; public class AccountRegDescriptor extends WizardPanelDescriptor { public static final String IDENTIFIER = "ACCOUNT_REG"; private AccountRegPanel panel; private SetupWizard wiz; private String username; private String server; private String password; private boolean isnew; public AccountRegDescriptor () { panel = new AccountRegPanel(); setPanelDescriptorIdentifier(IDENTIFIER); setPanelComponent(panel); } public Object getNextPanelDescriptor () { return FINISH; } public Object getBackPanelDescriptor () { return AccountDetailsDescriptor.IDENTIFIER; } private void initAccountDetails() { username = (String) wiz.getAccountProperty("username"); server = (String) wiz.getAccountProperty("server"); password = (String) wiz.getAccountProperty("password"); isnew = new Boolean((String)wiz.getAccountProperty("isNew")).booleanValue(); } public void aboutToDisplayPanel() { wiz = (SetupWizard) getWizard(); initAccountDetails(); StringBuffer buf = new StringBuffer(); buf.append("Connecting to server '"); buf.append(this.server); buf.append("' ..."); panel.setProgressValue(0); panel.setProgressText(buf.toString()); wiz.setNextFinishButtonEnabled(false); wiz.setBackButtonEnabled(false); } public void displayingPanel() { Thread t = new Thread() { public void run () { try { Thread.sleep(2000); connect(); panel.setProgressValue(15); panel.setProgressText("Server connection established"); if (isnew) createAccount(); else saveAccount(); Thread.sleep(2000); findDevices(); Thread.sleep(1000); panel.setProgressValue(100); panel.setProgressText("Saving setup details ..."); panel.setupDone(); panel.setProgressText("Saving setup detail ... Done!"); getWizard().setNextFinishButtonEnabled(true); getWizard().setBackButtonEnabled(true); } catch (InterruptedException e) { panel.setProgressValue(0); panel.setProgressText(e.getMessage()); getWizard().setBackButtonEnabled(true); } } }; t.start(); } private void connect() throws InterruptedException { try { wiz.connect(); } catch (ConnectionException ex) { panel.setProgressText(ex.getMessage()); throw new InterruptedException("Error while connecting to the '"+server+"' ..."); } } private void createAccount() throws InterruptedException { StringBuffer buf = new StringBuffer(); buf.append("Checking if server supports account creation... "); panel.setProgressValue(30); panel.setProgressText(buf.toString()); boolean supported = wiz.checkAccountCreationSupport(); String supstr = (supported) ? "supported!" : "not supported!"; buf.append(supstr); panel.setProgressText(buf.toString()); String userid = username+"@"+server; if (supported) { try { wiz.createAccount(); displayAccountSummary("Created account "+userid); } catch (Exception ex) { panel.setProgressText(ex.getMessage()); displayAccountSummary("Unable to create account "+userid); displayAccountSummary(ex.getMessage()); } } //else // panel.setAccountInstructions(wiz.getInstructions()); } private void saveAccount() { panel.setProgressValue(30); panel.setProgressValue(40); try { wiz.saveToPrefs(); displayAccountSummary("Account details of "+username+" saved"); } catch (Exception ex) { panel.setProgressText(ex.getMessage()); displayAccountSummary("Unable to save account"); } } private void displayAccountSummary(String text) { panel.setProgressValue(45); panel.addAccountSummaryLabel(); panel.accountSummary(text); } private void findDevices() { panel.setWelcomeTitle("Setting Up Devices ..."); panel.setProgressValue(60); panel.setProgressText("Searching for audio devices ..."); ArrayList auDevices = wiz.getAudioDevices(); panel.setProgressValue(75); panel.setProgressText("Searching for video devices ..."); ArrayList viDevices = wiz.getVideoDevices(); DeviceInformation devinfo; int size = auDevices.size(); String d = (size > 1) ? "devices" : "device"; panel.addDevicesLabel(size+" audio "+d+ " found"); for(Iterator it=auDevices.iterator();it.hasNext();) { devinfo = (DeviceInformation) it.next(); panel.devicesSummary(devinfo.getName()); } size = viDevices.size(); d = (size > 1) ? "devices" : "device"; panel.addDevicesLabel(size+" video "+d+ " found"); for(Iterator it=viDevices.iterator();it.hasNext();) { devinfo = (DeviceInformation) it.next(); panel.devicesSummary(devinfo.getName()); } } public void aboutToHidePanel() { panel.reset(); } } --- NEW FILE: AccountDetailsPanel.java --- package org.sink.swing.wizard; import java.awt.*; import java.awt.event.*; import java.net.*; import javax.swing.*; import javax.swing.border.*; public class AccountDetailsPanel extends JPanel { private ImageIcon icon; private JLabel iconLabel; private JLabel welcomeTitle; private JLabel textLabel; private JPanel contentPanel; private org.sink.swing.GBPanel innerPanel; //private JLabel descrptionLabel; private JTextField userIdField; private JPasswordField passwordField; private JCheckBox newCheckBox; public AccountDetailsPanel() { iconLabel = new JLabel(); contentPanel = getContentPanel(); contentPanel.setBorder( new EmptyBorder( new Insets(10,10,10,10))); icon = getImageIcon(); setLayout ( new java.awt.BorderLayout()); if (icon != null) { iconLabel.setIcon(icon); } iconLabel.setBorder(new EtchedBorder(EtchedBorder.RAISED)); add(iconLabel, BorderLayout.WEST);; JPanel secondaryPanel = new JPanel(); secondaryPanel.add(contentPanel, BorderLayout.NORTH); add(secondaryPanel, BorderLayout.CENTER); } private ImageIcon getImageIcon() { return new ImageIcon ( "data/pixmaps/clouds.jpg"); } private JPanel getContentPanel() { innerPanel = new org.sink.swing.GBPanel(); welcomeTitle = new JLabel(); userIdField = new JTextField(); passwordField = new JPasswordField(); newCheckBox = new JCheckBox(); welcomeTitle.setFont( new java.awt.Font("Sans", Font.BOLD, 12)); welcomeTitle.setText("Welcome to Sink!"); add (welcomeTitle, 0, 0, 2); innerPanel.add(Box.createHorizontalStrut(30)); textLabel = new JLabel(); textLabel.setText("This dialog will help you setup Sink."); add (textLabel, 0, 1, 2); // instructions JPanel instPanel = new JPanel(); instPanel.setLayout(new GridLayout(0,1)); instPanel.add(new JLabel("Please enter your user ID and password if you")); instPanel.add(new JLabel("have an existing account.")); instPanel.add(new JLabel()); // whitespace instPanel.add(new JLabel("If you don't have an existing account, please tick")); instPanel.add(new JLabel("'I want to create a new account' and fill in")); instPanel.add(new JLabel("the user ID and password fields")); instPanel.add(new JLabel()); // whitespace add (instPanel, 0, 2, 2); // user Id JLabel uidLabel = new JLabel("User ID:"); add (uidLabel, 0, 3, 1); JPanel useridPanel = new JPanel(); useridPanel.setLayout(new GridLayout(2,1)); useridPanel.add(userIdField); JLabel example = new JLabel(); example.setText("(i.e. ja...@ja...)"); useridPanel.add(example); add (useridPanel, 1, 3, 1); // password JLabel passwordLabel = new JLabel("Password:"); add (passwordLabel, 0, 4, 1); add (passwordField, 1, 4, 1); newCheckBox.setText("I want to create a new account"); newCheckBox.setActionCommand("newAccount"); add (newCheckBox, 1, 5, 1); return innerPanel; } public void addCheckBoxActionListener (ActionListener l) { newCheckBox.addActionListener (l); } public void addUseridPasswordListener (KeyListener kl) { userIdField.addKeyListener(kl); passwordField.addKeyListener(kl); } public boolean isCheckBoxSelected() { return newCheckBox.isSelected(); } public String getUserID() { return userIdField.getText(); } public String getPassword() { return passwordField.getText(); } private void add(JComponent comp, int x, int y, int width) { innerPanel.addComponent(comp, x, y, width, GridBagConstraints.FIRST_LINE_START, GridBagConstraints.HORIZONTAL); } } |
From: Jan A. <jma...@us...> - 2005-06-06 21:50:11
|
Update of /cvsroot/sink/sink/tests/org/sink/chat In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4900/tests/org/sink/chat Log Message: Directory /cvsroot/sink/sink/tests/org/sink/chat added to the repository |
From: Jan A. <jma...@us...> - 2005-06-06 21:49:53
|
Update of /cvsroot/sink/sink/tests/org/sink In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4694/tests/org/sink Log Message: Directory /cvsroot/sink/sink/tests/org/sink added to the repository |
From: Jan A. <jma...@us...> - 2005-06-06 21:49:37
|
Update of /cvsroot/sink/sink/tests/org In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4473/tests/org Log Message: Directory /cvsroot/sink/sink/tests/org added to the repository |
From: Jan A. <jma...@us...> - 2005-06-06 21:49:12
|
Update of /cvsroot/sink/sink/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4246/tests Log Message: Directory /cvsroot/sink/sink/tests added to the repository |
From: Jan A. <jma...@us...> - 2005-06-06 21:48:16
|
Update of /cvsroot/sink/sink/src/org/sink/swing/wizard In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3573/src/org/sink/swing/wizard Log Message: Directory /cvsroot/sink/sink/src/org/sink/swing/wizard added to the repository |
From: Michael S. <mic...@us...> - 2005-06-06 07:36:22
|
Update of /cvsroot/sink/sink/src/org/sink/swing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3467/src/org/sink/swing Modified Files: BuddyListController.java Log Message: changed help dialog Index: BuddyListController.java =================================================================== RCS file: /cvsroot/sink/sink/src/org/sink/swing/BuddyListController.java,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** BuddyListController.java 6 Jun 2005 06:09:54 -0000 1.36 --- BuddyListController.java 6 Jun 2005 07:36:14 -0000 1.37 *************** *** 131,135 **** } else if ("help".equals(cmd)) { ! String msg = "User documentation can be found at http://sink.sf.net/UserDoc/\n\nFor all other issues visit our website http://sink.sf.net\nor subscribe to our mailing list at http://sourceforge.net/mail/?group_id=131203."; JOptionPane.showMessageDialog(null, msg, "Help", JOptionPane.INFORMATION_MESSAGE); } --- 131,135 ---- } else if ("help".equals(cmd)) { ! String msg = "User documentation can be found at http://sink.sf.net/UserDocumentation/\n\nFor all other issues visit our website http://sink.sf.net\nor subscribe to our mailing list at http://sourceforge.net/mail/?group_id=131203."; JOptionPane.showMessageDialog(null, msg, "Help", JOptionPane.INFORMATION_MESSAGE); } |
From: Michael S. <mic...@us...> - 2005-06-06 06:25:17
|
Update of /cvsroot/sink/sink/src/org/sink/swing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv620/src/org/sink/swing Modified Files: AccountDetails.java Log Message: changed label Index: AccountDetails.java =================================================================== RCS file: /cvsroot/sink/sink/src/org/sink/swing/AccountDetails.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AccountDetails.java 6 Jun 2005 06:09:54 -0000 1.3 --- AccountDetails.java 6 Jun 2005 06:25:09 -0000 1.4 *************** *** 119,123 **** if(getUserId().trim().equals("")){ ! llErrors.add("- The User ID field is empty"); } if(getServer().trim().equals("")){ --- 119,123 ---- if(getUserId().trim().equals("")){ ! llErrors.add("- The Jabber ID field is empty"); } if(getServer().trim().equals("")){ |
From: Michael S. <mic...@us...> - 2005-06-06 06:10:09
|
Update of /cvsroot/sink/sink/src/org/sink/media In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25774/src/org/sink/media Modified Files: DeviceRegistry.java Log Message: when adding and removing buddies, the menu and toolbar icons are handled properly Index: DeviceRegistry.java =================================================================== RCS file: /cvsroot/sink/sink/src/org/sink/media/DeviceRegistry.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** DeviceRegistry.java 1 Jun 2005 02:37:00 -0000 1.12 --- DeviceRegistry.java 6 Jun 2005 06:09:55 -0000 1.13 *************** *** 104,107 **** --- 104,110 ---- } + //videoDevices.add(new DeviceInformation("none", "none")); + //audioDevices.add(new DeviceInformation("none", "none")); + saveDevicesToFile(); } |
From: Michael S. <mic...@us...> - 2005-06-06 06:10:09
|
Update of /cvsroot/sink/sink/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25774/data Modified Files: sink.conf Log Message: when adding and removing buddies, the menu and toolbar icons are handled properly Index: sink.conf =================================================================== RCS file: /cvsroot/sink/sink/data/sink.conf,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** sink.conf 11 May 2005 01:38:45 -0000 1.4 --- sink.conf 6 Jun 2005 06:09:55 -0000 1.5 *************** *** 10,14 **** [chat] ! username = '' ! server = '' ! password = '' --- 10,14 ---- [chat] ! username=mike ! server=umfg05 ! password=test |