1 19 20 package org.jahia.data.containers; 21 22 import java.util.HashMap ; 23 import java.util.Vector ; 24 25 import org.jahia.utils.JahiaConsole; 26 import java.io.Serializable ; 27 28 29 34 35 public class ContainerEditView implements Serializable { 36 37 private static final String CLASS_NAME = ContainerEditView.class.getName(); 38 39 private HashMap views = new HashMap (); 40 41 42 private Vector fields = new Vector (); 43 44 51 public ContainerEditView(){} 52 53 63 public void addField(String groupName, String groupTitle, String groupDescr, String fieldName,String fieldDescr){ 64 if ( groupName == null || groupName.trim().equals("") ){ 65 return; 66 } 67 if ( fieldName == null || fieldName.trim().equals("") ){ 68 return; 69 } 70 71 ContainerEditViewFieldGroup fieldGroup = new ContainerEditViewFieldGroup(groupName,groupTitle,groupDescr); 72 fieldGroup.addField(fieldName,fieldDescr); 73 addFieldGroup(fieldGroup); 74 } 75 76 77 83 public void addFieldGroup(ContainerEditViewFieldGroup fieldGroup){ 84 85 JahiaConsole.println("ContainerEditView.addFieldGroup", 86 "Added Group [" + fieldGroup.getName() + "]"); 87 88 if ( fieldGroup == null || fieldGroup.getName()==null || fieldGroup.getName().trim().equals("") ){ 89 return; 90 } 91 fieldGroup.setPos(views.size()); 92 views.put(fieldGroup.getName(),fieldGroup); 93 94 fields.addAll(fieldGroup.getFieldNames()); 95 96 } 97 98 104 public ContainerEditViewFieldGroup getFieldGroupByFieldName(String fieldName){ 105 if ( fieldName == null ){ 106 return null; 107 } 108 Vector v = new Vector (views.values()); 109 int size = v.size(); 110 ContainerEditViewFieldGroup fieldGroup = null; 111 for ( int i=0 ; i<size ; i++ ){ 112 fieldGroup = (ContainerEditViewFieldGroup)v.get(i); 113 if ( fieldGroup.fieldExists(fieldName) ){ 114 return fieldGroup; 115 } 116 } 117 return null; 118 } 119 120 125 public HashMap getViews(){ 126 return views; 127 } 128 129 134 public Vector getFields(){ 135 return this.fields; 136 } 137 138 } 139 | Popular Tags |