1 19 20 21 package com.sslexplorer.extensions.forms; 22 23 import java.util.Collection ; 24 25 import javax.servlet.http.HttpSession ; 26 27 import org.apache.commons.logging.Log; 28 import org.apache.commons.logging.LogFactory; 29 30 import com.sslexplorer.core.actions.AbstractMultiFormDispatchAction.SubActionWrapper; 31 import com.sslexplorer.core.forms.CoreForm; 32 import com.sslexplorer.extensions.ExtensionBundle; 33 import com.sslexplorer.extensions.ExtensionBundleItem; 34 import com.sslexplorer.extensions.ExtensionBundleItemModel; 35 import com.sslexplorer.table.forms.AbstractPagerForm; 36 37 public class DefaultExtensionsForm extends AbstractPagerForm { 38 static final long serialVersionUID = 4283488241230531541L; 39 private static final Log logger = LogFactory.getLog(DefaultExtensionsForm.class); 40 41 private String submitAction = null; 42 private String subFormName = null; 43 44 45 public String getSubFormName() { 46 return subFormName; 47 } 48 49 public void setSubFormName(String subFormName) { 50 this.subFormName = subFormName; 51 } 52 53 public DefaultExtensionsForm(String submitAction, String subFormName) { 54 super(new ExtensionBundleItemModel()); 55 this.submitAction = submitAction + "?subForm=" + subFormName; 56 this.subFormName = subFormName; 57 } 58 59 public String getSubmitAction() { 60 return submitAction; 61 } 62 63 public void setSubmitAction(String submitAction) { 64 this.submitAction = submitAction; 65 } 66 67 74 public void initialise(HttpSession session, Collection <ExtensionBundle> extensions) { 75 super.initialize(session, "name"); 76 77 try { 78 for (ExtensionBundle bundle : extensions) { 79 this.getModel().addItem(new ExtensionBundleItem(bundle, false, subFormName)); 80 } 81 82 checkSort(); 83 getPager().rebuild(getFilterText()); 84 } catch (Throwable t) { 85 logger.error("Failed to initialise resources form.", t); 86 } 87 } 88 } | Popular Tags |