1 19 20 package com.sslexplorer.properties.attributes.wizards.actions; 21 22 import javax.servlet.http.HttpServletRequest ; 23 import javax.servlet.http.HttpServletResponse ; 24 25 import org.apache.struts.action.ActionForm; 26 import org.apache.struts.action.ActionForward; 27 import org.apache.struts.action.ActionMapping; 28 29 import com.sslexplorer.boot.PropertyDefinition; 30 import com.sslexplorer.properties.attributes.AttributeDefinition; 31 import com.sslexplorer.properties.attributes.wizards.forms.AttributeDefinitionOptionsForm; 32 import com.sslexplorer.security.SessionInfo; 33 import com.sslexplorer.wizard.actions.AbstractWizardAction; 34 35 41 public class AttributeDefinitionOptionsAction extends AbstractWizardAction { 42 43 46 public final static String ATTR_LABEL = "label"; 47 48 51 public final static String ATTR_CATEGORY = "category"; 52 53 56 public final static String ATTR_TYPE_META = "typeMeta"; 57 58 61 public final static String ATTR_TYPE = "type"; 62 63 66 public final static String ATTR_VALIDATION_STRING = "validationString"; 67 68 71 public final static String ATTR_DEFAULT_VALUE = "defaultValue"; 72 73 76 public final static String ATTR_VISIBILITY = "visibility"; 77 78 81 public final static String ATTR_SORT_ORDER = "sortOrder"; 82 83 86 public AttributeDefinitionOptionsAction() { 87 super(); 88 } 89 90 public int getNavigationContext(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { 91 return SessionInfo.MANAGEMENT_CONSOLE_CONTEXT; 92 } 93 94 104 public ActionForward typeChanged(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { 105 106 AttributeDefinitionOptionsForm adof = (AttributeDefinitionOptionsForm)form; 108 if(adof.getType() == PropertyDefinition.TYPE_COLOR || 109 adof.getType() == PropertyDefinition.TYPE_LIST || 110 adof.getType() == PropertyDefinition.TYPE_MULTI_ENTRY_LIST || 111 adof.getType() == PropertyDefinition.TYPE_MULTI_SELECT_LIST || 112 adof.getType() == PropertyDefinition.TYPE_TIME_IN_MS) { 113 getWizardSequence(request).putAttribute(AttributeDefinitionOptionsAction.ATTR_VALIDATION_STRING, ""); 114 } 115 else if(adof.getType() == PropertyDefinition.TYPE_BOOLEAN ) { 116 getWizardSequence(request).putAttribute(AttributeDefinitionOptionsAction.ATTR_VALIDATION_STRING, "com.sslexplorer.input.validators.BooleanValidator"); 117 } 118 else if(adof.getType() == PropertyDefinition.TYPE_INTEGER) { 119 getWizardSequence(request).putAttribute(AttributeDefinitionOptionsAction.ATTR_VALIDATION_STRING, "com.sslexplorer.input.validators.IntegerValidator(minValue=0,maxValue=9999999)"); 120 } 121 else if(adof.getType() == PropertyDefinition.TYPE_STRING) { 122 getWizardSequence(request).putAttribute(AttributeDefinitionOptionsAction.ATTR_VALIDATION_STRING, "com.sslexplorer.input.validators.StringValidator(minLength=0,maxLength=30,trim=true,regExp=,pattern=)"); 123 } 124 else if(adof.getType() == PropertyDefinition.TYPE_TEXT_AREA) { 125 getWizardSequence(request).putAttribute(AttributeDefinitionOptionsAction.ATTR_VALIDATION_STRING, "com.sslexplorer.input.validators.StringValidator(minLength=0,maxLength=255,trim=true,regExp=,pattern=)"); 126 } 127 128 getWizardSequence(request).putAttribute(AttributeDefinitionOptionsAction.ATTR_TYPE, new Integer (adof.getType())); 129 130 return super.unspecified(mapping, form, request, response); 131 } 132 } 133 | Popular Tags |