01: /*
02: * Created on 28.06.2005 for PIROL
03: *
04: * SVN header information:
05: * $Author: javamap $
06: * $Rev: 856 $
07: * $Date: 2007-06-18 21:15:27 -0700 (Mon, 18 Jun 2007) $
08: * $Id: AddTextFieldTextToTextAreaOnClick_Action.java 856 2007-06-19 04:15:27Z javamap $
09: */
10: package de.fho.jump.pirol.plugins.EditAttributeByFormula;
11:
12: import java.awt.event.ActionEvent;
13:
14: import javax.swing.AbstractAction;
15: import javax.swing.text.JTextComponent;
16:
17: /**
18: * Action add the text of a given text field to a text area on action performed.
19: *
20: * @author Ole Rahn
21: * <br>
22: * <br>FH Osnabrück - University of Applied Sciences Osnabrück,
23: * <br>Project: PIROL (2005),
24: * <br>Subproject: Daten- und Wissensmanagement
25: *
26: * @version $Rev: 856 $
27: *
28: */
29: public class AddTextFieldTextToTextAreaOnClick_Action extends
30: AbstractAction {
31:
32: private static final long serialVersionUID = -6699586829803392059L;
33:
34: protected JTextComponent textFrom = null, textTo = null;
35:
36: public AddTextFieldTextToTextAreaOnClick_Action(
37: JTextComponent textFrom, JTextComponent textTo,
38: String actionName) {
39: super ();
40: this .textFrom = textFrom;
41: this .textTo = textTo;
42: this .putValue(AbstractAction.NAME, actionName);
43: }
44:
45: /**
46: *@inheritDoc
47: */
48: public void actionPerformed(ActionEvent arg0) {
49: String number = textFrom.getText();
50: number = number.replaceAll(",", ".");
51: if (textTo.getText().length() != 0)
52: number = " " + number;
53: textTo.setText(textTo.getText() + number);
54: textFrom.setText("");
55: }
56:
57: }
|