Salome HOME
fe347fa8a071cde6d1bd740299a7afafa7cb41e6
[tools/siman.git] / Workspace / Siman / src / org / splat / simer / StampFacade.java
1 package org.splat.simer;
2 /**
3  * 
4  * @author    Daniel Brunier-Coulin
5  * @copyright OPEN CASCADE 2012
6  */
7
8 import java.text.SimpleDateFormat;
9 import java.util.ResourceBundle;
10
11 import org.splat.som.Timestamp;
12 import org.splat.som.ValidationStep;
13
14
15 public class StampFacade implements HistoryFacade {
16
17     private String  icon;
18     private String  comment;
19     private String  date;
20     private String  empty;
21     private String  nonicon;
22
23 //  ==============================================================================================================================
24 //  Constructor
25 //  ==============================================================================================================================
26
27     public StampFacade (Timestamp stamp) {
28 //  ------------------------------------
29       ResourceBundle    labels  = ResourceBundle.getBundle("labels", ApplicationSettings.getCurrentLocale());
30       ResourceBundle    custom  = ResourceBundle.getBundle("som", ApplicationSettings.getCurrentLocale());
31           SimpleDateFormat  convert = new SimpleDateFormat(custom.getString("date.format"));  // Date display format
32           ValidationStep    type    = stamp.getType();
33
34       nonicon = "image.hold.gif";
35       empty   = "";
36       date    = convert.format(stamp.getDate());
37       comment = labels.getString("label." + type.toString()) + " " + stamp.getAuthor().toString();
38       if      (type == ValidationStep.APPROVAL)  icon = "icon.APPROVED.png";
39       else if (type == ValidationStep.REVIEW)    icon = "icon.inCHECK.png";
40       else if (type == ValidationStep.PROMOTION) icon = "icon.inDRAFT.png";
41       else                                       icon = "icon.inWORK.png";
42     }
43
44 //  ==============================================================================================================================
45 //  Getters
46 //  ==============================================================================================================================
47
48     public String getDate () {
49 //  ------------------------
50       return date;
51     }
52     public String getDescription () {
53 //  -------------------------------
54       return comment;
55     }
56     public String getFileIcon () {
57 //  ----------------------------
58       return icon;
59     }
60     public String getSharingIcon () {
61 //  -------------------------------
62       return nonicon;
63     }
64     public String getSize () {
65 //  ------------------------
66       return empty;
67     }
68     public String getVersion () {
69 //  ---------------------------
70       return empty;
71     }
72     public String getVersioningIcon () {
73 //  ----------------------------------
74       return nonicon;
75     }
76 }