[Jrisk-cvs] SF.net SVN: jrisk:[553] TranslationTool
Brought to you by:
yuranet
From: <yu...@us...> - 2011-10-20 18:53:55
|
Revision: 553 http://jrisk.svn.sourceforge.net/jrisk/?rev=553&view=rev Author: yuranet Date: 2011-10-20 18:53:48 +0000 (Thu, 20 Oct 2011) Log Message: ----------- F5 to refresh Modified Paths: -------------- TranslationTool/ChangeLog.txt TranslationTool/src/net/yura/translation/MessageTool.java TranslationTool/src/net/yura/translation/MyNode.java Modified: TranslationTool/ChangeLog.txt =================================================================== --- TranslationTool/ChangeLog.txt 2011-10-17 13:49:46 UTC (rev 552) +++ TranslationTool/ChangeLog.txt 2011-10-20 18:53:48 UTC (rev 553) @@ -1,3 +1,13 @@ + +2.6 + + F5 to refresh tree + fixed dodgy equals bug + +2.5 + + ?? + 2.4 added search for missing string in advanced filters Modified: TranslationTool/src/net/yura/translation/MessageTool.java =================================================================== --- TranslationTool/src/net/yura/translation/MessageTool.java 2011-10-17 13:49:46 UTC (rev 552) +++ TranslationTool/src/net/yura/translation/MessageTool.java 2011-10-20 18:53:48 UTC (rev 553) @@ -49,8 +49,12 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Map; +import javax.swing.AbstractAction; +import javax.swing.Action; +import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JTabbedPane; +import javax.swing.KeyStroke; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.ListSelectionModel; @@ -79,7 +83,7 @@ private JCheckBox filter3; private JToolBar toolbar; public static final String appName = "yura.net CUNNING LINGUIST Translation Tool"; - public static final String version = "2.5"; + public static final String version = "2.6"; public static final String WEBSITE = "http://cunninglinguist.sf.net/"; private Map partmap; public static final Comparator CASE_POSTERIORITY_ORDER = new Comparator() { @@ -154,10 +158,17 @@ add.setActionCommand("add"); add.addActionListener(this); - JButton remove = new JButton("refresh tree", new ImageIcon(MessageTool.class.getResource("Refresh16.gif"))); - remove.setActionCommand("refresh"); - remove.addActionListener(this); + Action refresh = new AbstractAction( "refresh tree", new ImageIcon(MessageTool.class.getResource("Refresh16.gif")) ) { + public void actionPerformed(ActionEvent e) { + MessageTool.this.actionPerformed( new ActionEvent(e.getSource(), e.getID(), "refresh") ); + } + }; + // this does the global mapping for F5 to fire the action + getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("F5"), "refresh_tree"); + getActionMap().put("refresh_tree", refresh); + + JButton save = new JButton("save Message", new ImageIcon(MessageTool.class.getResource("Save16.gif"))); save.setActionCommand("save message"); save.addActionListener(this); @@ -170,7 +181,7 @@ toolbar.addSeparator(); toolbar.add(add); - toolbar.add(remove); + toolbar.add( new JButton( refresh ) ); // says this is how you should add actions toolbar.addSeparator(); toolbar.add(save); toolbar.add(revert); @@ -1325,7 +1336,7 @@ MessageTool mt = new MessageTool(); - JFrame frame = new JFrame( mt.getName() ); + JFrame frame = new JFrame( mt.getName() +" "+WEBSITE ); frame.getContentPane().add(mt.getToolBar(), BorderLayout.NORTH); frame.getContentPane().add(mt); Modified: TranslationTool/src/net/yura/translation/MyNode.java =================================================================== --- TranslationTool/src/net/yura/translation/MyNode.java 2011-10-17 13:49:46 UTC (rev 552) +++ TranslationTool/src/net/yura/translation/MyNode.java 2011-10-20 18:53:48 UTC (rev 553) @@ -78,7 +78,25 @@ public void add(MutableTreeNode newChild) { - if (this.children!=null && this.children.contains(newChild)) { return; } + if (this.children!=null) { + MyNode newNode = ((MyNode)newChild); + for (int c=0;c<children.size();c++) { + MyNode child = (MyNode)children.elementAt(c); + if (child.getUserObject().equals( newNode.getUserObject() )) { + + if ( !child.hasMessage() && newNode.hasMessage() ) { + child.hasmessage = true; + child.setup(); + } + if ( !child.hasChildren() && newNode.hasChildren() ) { + child.haschildren = true; + child.setup(); + } + + return; + } + } + } super.add(newChild); Collections.sort(this.children,MessageTool.CASE_POSTERIORITY_ORDER); @@ -263,44 +281,4 @@ return (MyNode)this.children.elementAt(a); } - - // this is used to update during the search if things do match - - public boolean equals(Object o) { - - MyNode no = (MyNode)o; - - if (getUserObject().equals(no.getUserObject())) { - - if ( hasMessage() && !no.hasMessage() ) { - - no.hasmessage = true; - no.setup(); - - } - else if ( !hasMessage() && no.hasMessage() ) { - - hasmessage = true; - setup(); - - } - - if ( hasChildren() && !no.hasChildren() ) { - - no.haschildren = true; - no.setup(); - - } - else if ( !hasChildren() && no.hasChildren() ) { - - haschildren = true; - setup(); - - } - return true; - } - - return false; - } - } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |