|
From: Frederic D. <de...@us...> - 2004-06-01 11:22:10
|
Update of /cvsroot/fudaa/fudaa_devel/ctulu/src/ghm/followgui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22734/src/ghm/followgui Modified Files: DefaultNoExitSystemInterface.java FollowApp.java Added Files: FollowAppResourceBundle_fr.properties Log Message: francais --- NEW FILE: FollowAppResourceBundle_fr.properties --- (This appears to be a binary file; contents omitted.) Index: FollowApp.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/ctulu/src/ghm/followgui/FollowApp.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FollowApp.java 11 Dec 2003 12:47:14 -0000 1.1 --- FollowApp.java 1 Jun 2004 11:21:59 -0000 1.2 *************** *** 22,30 **** import java.awt.Cursor; import java.awt.Dimension; - import java.awt.Frame; import java.awt.GraphicsEnvironment; import java.awt.Window; import java.awt.dnd.DropTarget; - import java.awt.event.InputEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; --- 22,28 ---- *************** *** 42,47 **** import java.util.Map; import java.util.ResourceBundle; ! import javax.swing.Action; ! import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JMenuBar; --- 40,44 ---- import java.util.Map; import java.util.ResourceBundle; ! import javax.swing.JFrame; import javax.swing.JMenuBar; *************** *** 57,69 **** */ public class FollowApp { ! public JFrame getFrame() { ! return frame_; } ! public void setCloseFrameExitJvm(boolean _b) { ! if (_b) ! systemInterface_= new DefaultSystemInterface(this); ! else ! systemInterface_= new DefaultNoExitSystemInterface(this); } /** * @param fileNames names of files to be opened --- 54,152 ---- */ public class FollowApp { ! static final boolean DEBUG= Boolean.getBoolean("follow.debug"); ! static final String fileSeparator= System.getProperty("file.separator"); ! static boolean HAS_SOLARIS_BUG= false; ! static FollowApp instance_; ! static final String messageLineSeparator= "\n"; ! // We should remove this hack once JDK 1.4 gets wide adoption on Solaris. ! static { ! boolean isSolaris= "SunOS".equals(System.getProperty("os.name")); ! if (isSolaris) { ! String version= System.getProperty("java.version"); ! if ((version != null) && version.startsWith("1.")) { ! String substring= version.substring(2, 3); ! try { ! int minor= Integer.parseInt(substring); ! if (minor < 4) { ! HAS_SOLARIS_BUG= true; ! } ! } catch (NumberFormatException nfe) { ! // Nothing else to do. ! } ! } ! } } ! static void centerWindowInScreen(Window window) { ! Dimension screenSize= window.getToolkit().getScreenSize(); ! Dimension windowSize= window.getPreferredSize(); ! window.setLocation( ! (int) (screenSize.getWidth() / 2 - windowSize.getWidth() / 2), ! (int) (screenSize.getHeight() / 2 - windowSize.getHeight() / 2)); ! } ! /** ! Invoke this method to start the Follow application. If any command-line ! arguments are passed in, they are assume to be filenames and are opened ! in the Follow application ! @param args files to be opened ! */ ! public static void main(String[] args) ! throws IOException, InterruptedException, InvocationTargetException { ! instance_= new FollowApp(args); ! SwingUtilities.invokeAndWait(new Runnable() { ! public void run() { ! // ensure all widgets inited before opening files ! instance_.show(); ! instance_.startupStatus_.markDone( ! instance_.startupStatus_.CREATE_WIDGETS); ! } ! }); ! instance_.startupStatus_.dispose(); ! for (int i= 0; i < instance_.tabbedPane_.getTabCount(); i++) { ! ((FileFollowingPane)instance_.tabbedPane_.getComponentAt(i)) ! .startFollowing(); ! } } + public static FollowApp openFollowApp(String[] args,boolean _show) + throws IOException, InterruptedException, InvocationTargetException { + final FollowApp instance= new FollowApp(args); + if(_show) + instance.show(); + instance.startupStatus_.markDone(instance.startupStatus_.CREATE_WIDGETS); + instance.startupStatus_.dispose(); + for (int i= 0; i < instance.tabbedPane_.getTabCount(); i++) { + ((FileFollowingPane)instance.tabbedPane_.getComponentAt(i)) + .startFollowing(); + } + return instance; + } + About about_; + FollowAppAttributes attributes_; + Bottom bottom_; + Clear clear_; + ClearAll clearAll_; + Close close_; + Configure configure_; + int currentCursor_= Cursor.DEFAULT_CURSOR; + Debug debug_; + Cursor defaultCursor_; + Delete delete_; + DeleteAll deleteAll_; + Edit edit_; + Exit exit_; + Map fileToFollowingPaneMap_= new HashMap(); + JFrame frame_; + // Actions + Open open_; + PopupMenu popupMenu_; + Reload reload_; + ResourceBundle resBundle_= + ResourceBundle.getBundle("ghm.followgui.FollowAppResourceBundle"); + private MouseListener rightClickListener_; + private StartupStatus startupStatus_; + SystemInterface systemInterface_; + JTabbedPane tabbedPane_; + ToolBar toolBar_; + Top top_; + Cursor waitCursor_; /** * @param fileNames names of files to be opened *************** *** 101,105 **** resBundle_.getString("message.cmdLineFileNotFound.text"), new Object[] { file }); - System.out.println(msg); } else if (!attributes_.followedFileListContains(file)) { attributes_.addFollowedFile(file); --- 184,187 ---- *************** *** 144,149 **** toolsMenu.addFollowAppAction(clear_); toolsMenu.addFollowAppAction(clearAll_); ! toolsMenu.addFollowAppAction(delete_); ! toolsMenu.addFollowAppAction(deleteAll_); toolsMenu.addSeparator(); toolsMenu.addFollowAppAction(configure_); --- 226,231 ---- toolsMenu.addFollowAppAction(clear_); toolsMenu.addFollowAppAction(clearAll_); ! // toolsMenu.addFollowAppAction(delete_); ! // toolsMenu.addFollowAppAction(deleteAll_); toolsMenu.addSeparator(); toolsMenu.addFollowAppAction(configure_); *************** *** 164,167 **** --- 246,250 ---- // initialize popupMenu popupMenu_= new PopupMenu(); + popupMenu_.setInvoker(frame_); popupMenu_.addFollowAppAction(open_); popupMenu_.addFollowAppAction(close_); *************** *** 173,178 **** popupMenu_.addFollowAppAction(clear_); popupMenu_.addFollowAppAction(clearAll_); ! popupMenu_.addFollowAppAction(delete_); ! popupMenu_.addFollowAppAction(deleteAll_); popupMenu_.addSeparator(); popupMenu_.addFollowAppAction(configure_); --- 256,261 ---- popupMenu_.addFollowAppAction(clear_); popupMenu_.addFollowAppAction(clearAll_); ! //popupMenu_.addFollowAppAction(delete_); ! //popupMenu_.addFollowAppAction(deleteAll_); popupMenu_.addSeparator(); popupMenu_.addFollowAppAction(configure_); *************** *** 187,192 **** toolBar_.addFollowAppAction(clear_); toolBar_.addFollowAppAction(clearAll_); ! toolBar_.addFollowAppAction(delete_); ! toolBar_.addFollowAppAction(deleteAll_); toolBar_.addSeparator(); toolBar_.addFollowAppAction(configure_); --- 270,275 ---- toolBar_.addFollowAppAction(clear_); toolBar_.addFollowAppAction(clearAll_); ! //toolBar_.addFollowAppAction(delete_); ! //toolBar_.addFollowAppAction(deleteAll_); toolBar_.addSeparator(); toolBar_.addFollowAppAction(configure_); *************** *** 209,218 **** frame_.addWindowListener(new WindowTracker(attributes_)); frame_.addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent e) { - if (tabbedPane_.getTabCount() > 0) { - attributes_.setSelectedTabIndex(tabbedPane_.getSelectedIndex()); - } - ((Window)e.getSource()).dispose(); - } public void windowClosed(WindowEvent e) { try { --- 292,295 ---- *************** *** 222,228 **** --- 299,316 ---- ioe.printStackTrace(System.err); } finally { + //on arrete les threads + for (int i= 0; i < tabbedPane_.getTabCount(); i++) { + ((FileFollowingPane)tabbedPane_.getComponentAt(i)) + .stopFollowing(); + } systemInterface_.exit(0); } } + public void windowClosing(WindowEvent e) { + if (tabbedPane_.getTabCount() > 0) { + attributes_.setSelectedTabIndex(tabbedPane_.getSelectedIndex()); + } + ((Window)e.getSource()).dispose(); + } }); enableDragAndDrop(frame_); *************** *** 287,313 **** } } ! private StartupStatus startupStatus_; ! public void show() { ! frame_.show(); } ! public void openFile( ! final File file, ! final boolean addFileToAttributes, ! final boolean startFollowing) { ! if (SwingUtilities.isEventDispatchThread()) { ! open(file, addFileToAttributes, startFollowing); ! } else { ! try { ! SwingUtilities.invokeAndWait(new Runnable() { ! public void run() { ! open(file, addFileToAttributes, startFollowing); } ! }); ! } catch (InterruptedException e) { ! e.printStackTrace(); ! } catch (InvocationTargetException e) { ! e.printStackTrace(); ! } } } /* --- 375,415 ---- } } ! void disableDragAndDrop(Component c) { ! c.setDropTarget(null); } ! void enableDragAndDrop(Component c) { ! // Invoking this constructor automatically sets the component's drop target ! new DropTarget(c, new DndFileOpener(this)); ! } ! List getAllFileFollowingPanes() { ! int tabCount= tabbedPane_.getTabCount(); ! List allFileFollowingPanes= new ArrayList(); ! for (int i= 0; i < tabCount; i++) { ! allFileFollowingPanes.add(tabbedPane_.getComponentAt(i)); ! } ! return allFileFollowingPanes; ! } ! public JFrame getFrame() { ! return frame_; ! } ! // Lazy initializer for the right-click listener which invokes a popup menu ! private MouseListener getRightClickListener() { ! if (rightClickListener_ == null) { ! rightClickListener_= new MouseAdapter() { ! public void mouseReleased(MouseEvent e) { ! if (SwingUtilities.isRightMouseButton(e)) { ! Component source= e.getComponent(); ! popupMenu_.show(source, e.getX(), e.getY()); } ! } ! }; } + return rightClickListener_; + } + FileFollowingPane getSelectedFileFollowingPane() { + return (FileFollowingPane)tabbedPane_.getSelectedComponent(); + } + void open(File file, boolean addFileToAttributes) { + open(file, addFileToAttributes, true); } /* *************** *** 359,364 **** } } ! void open(File file, boolean addFileToAttributes) { ! open(file, addFileToAttributes, true); } /** --- 461,489 ---- } } ! public void openFile( ! final File file, ! final boolean addFileToAttributes, ! final boolean startFollowing) { ! if (SwingUtilities.isEventDispatchThread()) { ! open(file, addFileToAttributes, startFollowing); ! } else { ! try { ! SwingUtilities.invokeAndWait(new Runnable() { ! public void run() { ! open(file, addFileToAttributes, startFollowing); ! } ! }); ! } catch (InterruptedException e) { ! e.printStackTrace(); ! } catch (InvocationTargetException e) { ! e.printStackTrace(); ! } ! } ! } ! public void setCloseFrameExitJvm(boolean _b) { ! if (_b) ! systemInterface_= new DefaultSystemInterface(this); ! else ! systemInterface_= new DefaultNoExitSystemInterface(this); } /** *************** *** 389,517 **** currentCursor_= cursorType; } ! int currentCursor_= Cursor.DEFAULT_CURSOR; ! Cursor defaultCursor_; ! Cursor waitCursor_; ! // Lazy initializer for the right-click listener which invokes a popup menu ! private MouseListener getRightClickListener() { ! if (rightClickListener_ == null) { ! rightClickListener_= new MouseAdapter() { ! public void mouseReleased(MouseEvent e) { ! if (SwingUtilities.isRightMouseButton(e)) { ! Component source= e.getComponent(); ! popupMenu_.show(source, e.getX(), e.getY()); ! } ! } ! }; ! } ! return rightClickListener_; ! } ! void enableDragAndDrop(Component c) { ! // Invoking this constructor automatically sets the component's drop target ! new DropTarget(c, new DndFileOpener(this)); ! } ! void disableDragAndDrop(Component c) { ! c.setDropTarget(null); ! } ! FileFollowingPane getSelectedFileFollowingPane() { ! return (FileFollowingPane)tabbedPane_.getSelectedComponent(); ! } ! List getAllFileFollowingPanes() { ! int tabCount= tabbedPane_.getTabCount(); ! List allFileFollowingPanes= new ArrayList(); ! for (int i= 0; i < tabCount; i++) { ! allFileFollowingPanes.add(tabbedPane_.getComponentAt(i)); ! } ! return allFileFollowingPanes; ! } ! FollowAppAttributes attributes_; ! Map fileToFollowingPaneMap_= new HashMap(); ! JFrame frame_; ! JTabbedPane tabbedPane_; ! ToolBar toolBar_; ! PopupMenu popupMenu_; ! private MouseListener rightClickListener_; ! ResourceBundle resBundle_= ! ResourceBundle.getBundle("ghm.followgui.FollowAppResourceBundle"); ! // Actions ! Open open_; ! Close close_; ! Reload reload_; ! Edit edit_; ! Exit exit_; ! Top top_; ! Bottom bottom_; ! Clear clear_; ! ClearAll clearAll_; ! Delete delete_; ! DeleteAll deleteAll_; ! Configure configure_; ! About about_; ! Debug debug_; ! SystemInterface systemInterface_; ! static final String fileSeparator= System.getProperty("file.separator"); ! static final String messageLineSeparator= "\n"; ! static final boolean DEBUG= Boolean.getBoolean("follow.debug"); ! static boolean HAS_SOLARIS_BUG= false; ! // We should remove this hack once JDK 1.4 gets wide adoption on Solaris. ! static { ! boolean isSolaris= "SunOS".equals(System.getProperty("os.name")); ! if (isSolaris) { ! String version= System.getProperty("java.version"); ! if ((version != null) && version.startsWith("1.")) { ! String substring= version.substring(2, 3); ! try { ! int minor= Integer.parseInt(substring); ! if (minor < 4) { ! HAS_SOLARIS_BUG= true; ! } ! } catch (NumberFormatException nfe) { ! // Nothing else to do. ! } ! } ! } ! } ! static void centerWindowInScreen(Window window) { ! Dimension screenSize= window.getToolkit().getScreenSize(); ! Dimension windowSize= window.getPreferredSize(); ! window.setLocation( ! (int) (screenSize.getWidth() / 2 - windowSize.getWidth() / 2), ! (int) (screenSize.getHeight() / 2 - windowSize.getHeight() / 2)); ! } ! /** ! Invoke this method to start the Follow application. If any command-line ! arguments are passed in, they are assume to be filenames and are opened ! in the Follow application ! @param args files to be opened ! */ ! public static void main(String[] args) ! throws IOException, InterruptedException, InvocationTargetException { ! instance_= new FollowApp(args); ! SwingUtilities.invokeAndWait(new Runnable() { ! public void run() { ! // ensure all widgets inited before opening files ! instance_.show(); ! instance_.startupStatus_.markDone( ! instance_.startupStatus_.CREATE_WIDGETS); ! } ! }); ! instance_.startupStatus_.dispose(); ! for (int i= 0; i < instance_.tabbedPane_.getTabCount(); i++) { ! ((FileFollowingPane)instance_.tabbedPane_.getComponentAt(i)) ! .startFollowing(); ! } ! } ! public static FollowApp openFollowApp(String[] args,boolean _show) ! throws IOException, InterruptedException, InvocationTargetException { ! final FollowApp instance= new FollowApp(args); ! if(_show) ! instance.show(); ! instance.startupStatus_.markDone(instance.startupStatus_.CREATE_WIDGETS); ! instance.startupStatus_.dispose(); ! for (int i= 0; i < instance.tabbedPane_.getTabCount(); i++) { ! ((FileFollowingPane)instance.tabbedPane_.getComponentAt(i)) ! .startFollowing(); ! } ! return instance; } - static FollowApp instance_; } --- 514,519 ---- currentCursor_= cursorType; } ! public void show() { ! frame_.show(); } } Index: DefaultNoExitSystemInterface.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/ctulu/src/ghm/followgui/DefaultNoExitSystemInterface.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DefaultNoExitSystemInterface.java 11 Dec 2003 12:47:14 -0000 1.1 --- DefaultNoExitSystemInterface.java 1 Jun 2004 11:21:59 -0000 1.2 *************** *** 1,3 **** ! /* * @file DefaultNoExitSystemInterface.java * @creation 2 déc. 2003 --- 1,3 ---- ! /** * @file DefaultNoExitSystemInterface.java * @creation 2 déc. 2003 *************** *** 9,12 **** --- 9,16 ---- package ghm.followgui; + import javax.swing.MenuSelectionManager; + + import com.memoire.bu.BuRegistry; + /** * @author deniger *************** *** 14,17 **** --- 18,22 ---- */ public class DefaultNoExitSystemInterface extends DefaultSystemInterface { + /** * @param app *************** *** 20,26 **** super(app); } ! ! public void exit (int code) { app_.getFrame().setVisible(false); } ! ! ! } --- 25,38 ---- super(app); } ! ! /** ! * @see ghm.followgui.SystemInterface#exit(int) ! */ ! public void exit(int code) { ! app_.getFrame().setVisible(false); ! app_.popupMenu_.removeAll(); ! MenuSelectionManager.defaultManager().clearSelectedPath(); ! BuRegistry.unregister(app_.getFrame()); ! } ! ! } \ No newline at end of file |