Rev 1310 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | fvelez | 1 | package pt.estgp.estgweb.domain.views; |
2 | |||
3 | import pt.estgp.estgweb.domain.DomainObject; |
||
1791 | jmachado | 4 | import pt.estgp.estgweb.domain.DomainSerializableObject; |
1 | fvelez | 5 | |
84 | jmachado | 6 | import java.text.DateFormat; |
7 | import java.text.SimpleDateFormat; |
||
1791 | jmachado | 8 | import java.util.Date; |
1 | fvelez | 9 | |
10 | /** |
||
11 | * @author Jorge Machado |
||
12 | * @date 2/Mar/2008 |
||
13 | * @time 19:54:22 |
||
14 | * @see pt.estgp.estgweb.domain.views |
||
15 | */ |
||
1791 | jmachado | 16 | public abstract class DomainObjectView extends DomainSerializableObject |
1 | fvelez | 17 | { |
18 | public abstract 1.5.0/docs/api/java/lang/Class.html">Class getReferenceClass(); |
||
75 | jmachado | 19 | |
1791 | jmachado | 20 | |
84 | jmachado | 21 | private 5+0%2Fdocs%2Fapi+Date">Date saveDate; |
215 | jmachado | 22 | protected 1.5.0/docs/api/java/text/DateFormat.html">DateFormat df= new 1.5.0/docs/api/java/text/SimpleDateFormat.html">SimpleDateFormat("yyyy/MM/dd"); |
84 | jmachado | 23 | |
75 | jmachado | 24 | public 1.5.0/docs/api/java/lang/String.html">String getFragment(int maxSize, 1.5.0/docs/api/java/lang/String.html">String text) |
25 | { |
||
26 | if(text.length() > maxSize) |
||
27 | return text.substring(0,text.substring(0, maxSize).lastIndexOf(' ')) + "..."; |
||
28 | return text; |
||
29 | } |
||
84 | jmachado | 30 | |
31 | public DomainObjectView() |
||
32 | {} |
||
33 | |||
34 | public DomainObjectView(DomainObject obj) |
||
35 | { |
||
428 | jmachado | 36 | if(obj != null) |
37 | this.saveDate = obj.getSaveDate(); |
||
84 | jmachado | 38 | } |
39 | |||
40 | public 1.5.0/docs/api/java/lang/String.html">String getFormatedSaveDate() |
||
41 | { |
||
42 | if(saveDate == null) |
||
43 | return null; |
||
44 | return df.format(saveDate); |
||
45 | } |
||
1 | fvelez | 46 | } |