Source code: com/pjsofts/eurobudget/beans/TransactionExt.java
1 /*
2 * TransactionExt.java
3 *
4 * Created on 17 avril 2002, 19:17
5 */
6
7 package com.pjsofts.eurobudget.beans;
8
9 import com.pjsofts.eurobudget.EBConstants;
10 import java.awt.datatransfer.DataFlavor;
11 import java.awt.datatransfer.Transferable;
12 import java.awt.datatransfer.UnsupportedFlavorException;
13 import java.io.IOException;
14 import java.io.Serializable;
15 import java.util.ResourceBundle;
16
17 /**
18 * JavaBean
19 * Not really used yet .
20 * Idea is to used this one to extand capabilities of Transaction in its
21 * export(improve transferable methods or add new members data like sum or account)
22 * Extends our Transaction class without modifying the serialization
23 * @author pj
24 */
25 public class TransactionExt implements Transferable, Serializable {
26
27 private Transaction txn;
28 private Account account;
29 private double solde;
30
31 private static final transient ResourceBundle i8n = EBConstants.i18n;
32
33 /** Creates a new instance of TransactionExt
34 *
35 */
36 public TransactionExt() {
37 }
38
39 public TransactionExt(Transaction t, Account account, double solde) {
40 this.txn = t;
41 this.account = account;
42 this.solde = solde;
43 }
44
45 /** Getter for property txn.
46 * @return Value of property txn.
47 */
48 public com.pjsofts.eurobudget.beans.Transaction getTxn() {
49 return txn;
50 }
51
52 /** Setter for property txn.
53 * @param txn New value of property txn.
54 */
55 public void setTxn(com.pjsofts.eurobudget.beans.Transaction txn) {
56 this.txn = txn;
57 }
58
59 /** Getter for property account.
60 * @return Value of property account.
61 */
62 public com.pjsofts.eurobudget.beans.Account getAccount() {
63 return account;
64 }
65
66 /** Setter for property account.
67 * @param account New value of property account.
68 */
69 public void setAccount(com.pjsofts.eurobudget.beans.Account account) {
70 this.account = account;
71 }
72
73 /** Getter for property solde.
74 * @return Value of property solde.
75 */
76 public double getSolde() {
77 return solde;
78 }
79
80 /** Setter for property solde.
81 * @param solde New value of property solde.
82 */
83 public void setSolde(double solde) {
84 this.solde = solde;
85 }
86
87 /**
88 * Returns an object which represents the data to be transferred. The class
89 * of the object returned is defined by the representation class of the flavor.
90 *
91 * @param flavor the requested flavor for the data
92 * @see DataFlavor#getRepresentationClass
93 * @exception IOException if the data is no longer available
94 * in the requested flavor.
95 * @exception UnsupportedFlavorException if the requested data flavor is
96 * not supported.
97 */
98 public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException {
99 return txn.getTransferData(flavor);
100 }
101
102 /**
103 * Returns an array of DataFlavor objects indicating the flavors the data
104 * can be provided in. The array should be ordered according to preference
105 * for providing the data (from most richly descriptive to least descriptive).
106 * @return an array of data flavors in which this data can be transferred
107 */
108 public DataFlavor[] getTransferDataFlavors() {
109 return txn.getTransferDataFlavors();
110 }
111
112 /**
113 * Returns whether or not the specified data flavor is supported for
114 * this object.
115 * @param flavor the requested flavor for the data
116 * @return boolean indicating whether or not the data flavor is supported
117 */
118 public boolean isDataFlavorSupported(DataFlavor flavor) {
119 return txn.isDataFlavorSupported(flavor);
120 }
121
122 /** Returns a string representation of the object. In general, the
123 * <code>toString</code> method returns a string that
124 * "textually represents" this object. The result should
125 * be a concise but informative representation that is easy for a
126 * person to read.
127 * It is recommended that all subclasses override this method.
128 * <p>
129 * The <code>toString</code> method for class <code>Object</code>
130 * returns a string consisting of the name of the class of which the
131 * object is an instance, the at-sign character `<code>@</code>', and
132 * the unsigned hexadecimal representation of the hash code of the
133 * object. In other words, this method returns a string equal to the
134 * value of:
135 * <blockquote>
136 * <pre>
137 * getClass().getName() + '@' + Integer.toHexString(hashCode())
138 * </pre></blockquote>
139 *
140 * @return a string representation of the object.
141 *
142 */
143 public String toString() {
144 String retValue;
145
146 retValue = super.toString();
147 return retValue;
148 }
149
150 }
151