KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > data > fields > JahiaColorField


1 // JahiaColorField
2
// NK 05.02.2002
3

4 package org.jahia.data.fields;
5
6 import org.jahia.exceptions.JahiaException;
7 import org.jahia.params.ParamBean;
8 import org.jahia.services.fields.ContentField;
9
10 /**
11  *
12  * @auhtor Khue Nguyen
13  */

14 public class JahiaColorField extends JahiaSmallTextField implements JahiaAllowApplyChangeToAllLangField
15 {
16
17
18     public JahiaColorField( Integer JavaDoc ID,
19                             Integer JavaDoc jahiaID,
20                             Integer JavaDoc pageID,
21                             Integer JavaDoc ctnid,
22                             Integer JavaDoc fieldDefID,
23                             Integer JavaDoc fieldType,
24                             Integer JavaDoc connectType,
25                             String JavaDoc fieldValue,
26                             Integer JavaDoc rank,
27                             Integer JavaDoc aclID,
28                             Integer JavaDoc versionID,
29                             Integer JavaDoc versionStatus,
30                             String JavaDoc languageCode)
31     {
32         super(ID, jahiaID, pageID, ctnid, fieldDefID, fieldType, connectType,
33               fieldValue, rank, aclID, versionID, versionStatus, languageCode);
34
35         if ( isShared() ){
36             this.languageCode = ContentField.SHARED_LANGUAGE;
37         }
38
39     } // end constructor
40

41
42     public Object JavaDoc clone()
43     {
44         Object JavaDoc objItem = this.getObject();
45
46         JahiaColorField st = new JahiaColorField (
47                                         new Integer JavaDoc(ID),
48                                         new Integer JavaDoc(jahiaID),
49                                         new Integer JavaDoc(pageID),
50                                         new Integer JavaDoc(ctnid),
51                                         new Integer JavaDoc(fieldDefID),
52                                         new Integer JavaDoc(fieldType),
53                                         new Integer JavaDoc(connectType),
54                                         fieldValue, new Integer JavaDoc(rank),
55                                         new Integer JavaDoc(aclID),
56                                         new Integer JavaDoc(versionID),
57                                         new Integer JavaDoc(workflowState),
58                                        new String JavaDoc(getLanguageCode()) );
59         st.setObject(objItem);
60         return st;
61     }
62
63     /**
64      * Is this kind of field shared (i.e. not one version for each language, but one version for every language)
65      */

66     public boolean isShared (){
67         return true;
68     }
69
70     /**
71      * Copy the internal value of current language to another language.
72      * Must be implemented by conctrete field for specific implementation.
73      *
74      * @param aField A same field in another language
75      */

76     public void copyValueInAnotherLanguage (JahiaField aField,ParamBean jParams)
77     throws JahiaException {
78         if ( aField == null ){
79             return;
80         }
81         aField.setValue(this.getValue());
82         aField.setRawValue(this.getValue());
83         aField.setObject(this.getObject());
84     }
85
86 }
87
Popular Tags