📄 baseformeventimpl.java
字号:
/** * Return an existing <code>TextAreaBean</code> or create a new one * * @param beanId the bean identifier * @return a TextAreaBean */ public TextAreaBean getTextAreaBean(String beanId) { String beanKey = getBeanKey(beanId); if (tagBeans.containsKey(beanKey)) { return (TextAreaBean) tagBeans.get(beanKey); } TextAreaBean ta = new TextAreaBean(beanId); configureBean(ta); tagBeans.put(beanKey, ta); return ta; } /** * Return an existing <code>FrameBean</code> or create a new one * * @param beanId the bean identifier * @return a FrameBean */ public FrameBean getFrameBean(String beanId) { String beanKey = getBeanKey(beanId); if (tagBeans.containsKey(beanKey)) { return (FrameBean) tagBeans.get(beanKey); } FrameBean fb = new FrameBean(beanId); configureBean(fb); //System.err.println("Creating new frame bean" + beanId + " bean key= " + beanKey); tagBeans.put(beanKey, fb); return fb; } /** * Return an existing <code>TextBean</code> or create a new one * * @param beanId the bean identifier * @return a TextBean */ public TextBean getTextBean(String beanId) { String beanKey = getBeanKey(beanId); //log.debug("Checking for textbean with bean key=" + beanKey); if (tagBeans.containsKey(beanKey)) { return (TextBean) tagBeans.get(beanKey); } TextBean tb = new TextBean(beanId); configureBean(tb); tagBeans.put(beanKey, tb); return tb; } /** * Return an existing <code>ImageBean</code> or create a new one * * @param beanId the bean identifier * @return a ImageBean */ public ImageBean getImageBean(String beanId) { String beanKey = getBeanKey(beanId); if (tagBeans.containsKey(beanKey)) { return (ImageBean) tagBeans.get(beanKey); } ImageBean ib = new ImageBean(beanId); configureBean(ib); tagBeans.put(beanKey, ib); return ib; } /** * Return an existing <code>IncludeBean</code> or create a new one * * @param beanId the bean identifier * @return a IncludeBean */ public IncludeBean getIncludeBean(String beanId) { String beanKey = getBeanKey(beanId); if (tagBeans.containsKey(beanKey)) { return (IncludeBean) tagBeans.get(beanKey); } IncludeBean includeBean = new IncludeBean(beanId); configureBean(includeBean); tagBeans.put(beanKey, includeBean); return includeBean; } /** * Return an existing <code>ActionComponentBean</code> or create a new one * * @param beanId the bean identifier * @return a IncludeBean */ public ActionComponentBean getActionComponentBean(String beanId) { String beanKey = getBeanKey(beanId); if (tagBeans.containsKey(beanKey)) { return (ActionComponentBean) tagBeans.get(beanKey); } ActionComponentBean bean = new ActionComponentBean(beanId); configureBean(bean); tagBeans.put(beanKey, bean); return bean; } /** * Return an existing <code>TableBean</code> or create a new one * * @param beanId the bean identifier * @return a TableBean */ public TableBean getTableBean(String beanId) { String beanKey = getBeanKey(beanId); if (tagBeans.containsKey(beanKey)) { return (TableBean) tagBeans.get(beanKey); } TableBean tb = new TableBean(beanId); configureBean(tb); tagBeans.put(beanKey, tb); return tb; } /** * Return an existing <code>TableRowBean</code> or create a new one * * @param beanId the bean identifier * @return a TableRowBean */ public TableRowBean getTableRowBean(String beanId) { String beanKey = getBeanKey(beanId); if (tagBeans.containsKey(beanKey)) { return (TableRowBean) tagBeans.get(beanKey); } TableRowBean tr = new TableRowBean(beanId); configureBean(tr); tagBeans.put(beanKey, tr); return tr; } /** * Return an existing <code>TableCellBean</code> or create a new one * * @param beanId the bean identifier * @return a TableCellBean */ public TableCellBean getTableCellBean(String beanId) { String beanKey = getBeanKey(beanId); if (tagBeans.containsKey(beanKey)) { return (TableCellBean) tagBeans.get(beanKey); } TableCellBean tc = new TableCellBean(beanId); configureBean(tc); tagBeans.put(beanKey, tc); return tc; } /** * Return an existing <code>ListBoxBean</code> or create a new one * * @param beanId the bean identifier * @return a ListBoxBean */ public ListBoxBean getListBoxBean(String beanId) { String beanKey = getBeanKey(beanId); if (tagBeans.containsKey(beanKey)) { return (ListBoxBean) tagBeans.get(beanKey); } ListBoxBean lb = new ListBoxBean(beanId); configureBean(lb); tagBeans.put(beanKey, lb); return lb; } /** * Return an existing <code>ListBoxItemBean</code> or create a new one * * @param beanId the bean identifier * @return a ListBoxItemBean */ public ListBoxItemBean getListBoxItemBean(String beanId) { String beanKey = getBeanKey(beanId); if (tagBeans.containsKey(beanKey)) { return (ListBoxItemBean) tagBeans.get(beanKey); } ListBoxItemBean lb = new ListBoxItemBean(beanId); configureBean(lb); tagBeans.put(beanKey, lb); return lb; } /** * Return an existing <code>MessageBoxBean</code> or create a new one * * @param beanId the bean identifier * @return a IncludeBean */ public MessageBoxBean getMessageBoxBean(String beanId) { String beanKey = getBeanKey(beanId); if (tagBeans.containsKey(beanKey)) { return (MessageBoxBean) tagBeans.get(beanKey); } MessageBoxBean messageBoxBean = new MessageBoxBean(beanId); configureBean(messageBoxBean); tagBeans.put(beanKey, messageBoxBean); return messageBoxBean; } /** * Prints the request parameters to stdout. Generally used for debugging */ public void logRequestParameters() { StringBuffer sb = new StringBuffer(); sb.append("\n\n show request params\n--------------------\n"); Enumeration e = null; if (portletRequest != null) { e = portletRequest.getParameterNames(); } if (e != null) { while (e.hasMoreElements()) { String name = (String) e.nextElement(); sb.append("\t\tname :").append(name); String values[] = null; if (portletRequest != null) { values = portletRequest.getParameterValues(name); } if (values != null) { if (values.length == 1) { String pval = values[0]; if (!name.startsWith("ui_pb")) { sb.append("\t\t value : ").append(pval); } } else { sb.append("\t\t value :"); for (int i = 0; i < values.length; i++) { sb.append("\t\t - ").append(values[i]); } } } } } sb.append("--------------------\n"); log.debug(sb.toString()); } /** * Prints the request attributes to stdout. Generally used for debugging */ public void logRequestAttributes() { StringBuffer sb = new StringBuffer(); sb.append("\n\n show request attributes\n--------------------\n"); Enumeration e = null; if (portletRequest != null) { e = portletRequest.getAttributeNames(); } if (e != null) { while (e.hasMoreElements()) { String name = (String) e.nextElement(); sb.append("name :").append(name); } } sb.append("--------------------\n"); log.debug(sb.toString()); } /** * Parses all request parameters for visual beans. * A visual bean parameter has the following encoding: * ui_<visual bean element>_<bean Id>_name * where <visual bean element> is a two letter encoding of the kind of * visual bean that it is. */ protected void createTagBeans() { if (tagBeans == null) tagBeans = new HashMap<String, TagBean>(); Map<String, String[]> paramsMap; // check for file upload paramsMap = parseFileUpload(); Enumeration e = portletRequest.getParameterNames(); if (e != null) { while (e.hasMoreElements()) { String uiname = (String) e.nextElement(); String[] vals = null; vals = portletRequest.getParameterValues(uiname); paramsMap.put(uiname, vals); } } for (String s : paramsMap.keySet()) { String uiname = (String) s; String vb = ""; String name; String beanId = ""; if (!uiname.startsWith("ui")) continue; //log.debug("found a tag bean: " + uiname); String vbname = uiname.substring(3); int idx = vbname.indexOf("_"); if (idx > 0) { vb = vbname.substring(0, idx); } vbname = vbname.substring(idx + 1);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -