Index: maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/ui/KeysModifier.java diff -u /dev/null maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/ui/KeysModifier.java:1.1 --- /dev/null Wed Oct 31 16:17:57 2007 +++ maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/ui/KeysModifier.java Wed Oct 31 16:17:52 2007 @@ -0,0 +1,114 @@ +package org.codelutin.i18n.plugin.ui; + +import java.awt.Container; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; +import java.io.File; + +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JTextArea; +import javax.swing.JTextField; + +import org.codelutin.i18n.plugin.core.ParserEvent; +import org.codelutin.i18n.plugin.core.ParserException; + +public class KeysModifier extends JFrame implements ParserEvent { + + private static final long serialVersionUID = 1L; + + protected JLabel name = new JLabel(); + protected JLabel path = new JLabel(); + protected JTextField key = new JTextField(); + protected JTextArea translate = new JTextArea("tututututututu\ntututututut"); + protected JButton next = new JButton("Next >>"); + + public KeysModifier() { + setLayout(new GridLayout(7, 2, 10, 10)); + + Container pane = getContentPane(); + pane.add(new JLabel("--- File information ---")); + pane.add(new JLabel()); + + pane.add(new JLabel("Name :")); + pane.add(name); + + pane.add(new JLabel("Path : ")); + pane.add(path); + + pane.add(new JLabel("--- Files language ---")); + pane.add(new JLabel()); + + pane.add(new JLabel("Key :")); + pane.add(key); + + pane.add(new JLabel("Translate :")); + pane.add(translate); + + pane.add(new JLabel()); + pane.add(next); + + next.addActionListener(new EventNextKey()); + addWindowListener(new EventWindows()); + + setTitle("Keys modifier"); + setSize(800, 300); +// pack(); + setVisible(true); + } + + public void eventChangeFile(File file) { + name.setText(file.getName()); + path.setText(file.getPath()); + key.setText(""); + repaint(); + } + + public synchronized void eventChangeKey(String keyI18n) { + key.setText(keyI18n); + repaint(); + if(isVisible()) { + try { + wait(); + } catch (InterruptedException e) { + throw new ParserException(e); + } + } + } + + public String eventGetRealKey() { + return key.getText(); + } + + public synchronized void eventNextKey() { + notifyAll(); + } + + class EventNextKey implements ActionListener { + public void actionPerformed(ActionEvent e) { + eventNextKey(); + } + } + + class EventWindows implements WindowListener { + + public void windowClosed(WindowEvent e) {} + public void windowActivated(WindowEvent e) {} + public void windowClosing(WindowEvent e) { + setVisible(false); + eventNextKey(); + } + public void windowDeactivated(WindowEvent e) {} + public void windowDeiconified(WindowEvent e) {} + public void windowIconified(WindowEvent e) {} + public void windowOpened(WindowEvent e) {} + + } + public static void main(String[] args) { + new KeysModifier(); + } +}