1 31 32 package org.opencms.workplace.list; 33 34 import java.io.IOException ; 35 36 import javax.servlet.ServletException ; 37 import javax.servlet.jsp.JspException ; 38 import javax.servlet.jsp.JspWriter ; 39 40 49 public class CmsTwoListsDialog { 50 51 52 private A_CmsListDialog m_activeWp; 53 54 55 private A_CmsListDialog m_firstWp; 56 57 58 private A_CmsListDialog m_passiveWp; 59 60 61 private A_CmsListDialog m_secondWp; 62 63 69 public CmsTwoListsDialog(A_CmsListDialog wp1, A_CmsListDialog wp2) { 70 71 m_activeWp = (wp1.isActive() ? wp1 : wp2); 72 m_passiveWp = (!wp1.isActive() ? wp1 : wp2); 73 m_firstWp = wp1; 74 m_secondWp = wp2; 75 } 76 77 82 protected String defaultActionHtml() { 83 84 StringBuffer result = new StringBuffer (2048); 85 result.append(defaultActionHtmlStart()); 86 result.append(defaultActionHtmlContent()); 87 result.append(defaultActionHtmlEnd()); 88 return result.toString(); 89 } 90 91 96 protected String defaultActionHtmlContent() { 97 98 StringBuffer result = new StringBuffer (2048); 99 result.append("<table id='twolists' cellpadding='0' cellspacing='0' align='center' width='100%'>\n"); 100 result.append("\t<tr>\n"); 101 result.append("\t\t<td width='50%' valign='top'>\n"); 102 result.append("\t\t\t").append(m_firstWp.defaultActionHtmlContent()).append("\n"); 103 result.append("\t\t</td>\n"); 104 result.append("\t\t<td width='20'> </td>"); 105 result.append("\t\t<td width='50%' valign='top'>\n"); 106 result.append("\t\t\t").append(m_secondWp.defaultActionHtmlContent()).append("\n"); 107 result.append("\t\t</td>\n"); 108 result.append("\t</tr>\n"); 109 result.append("</table>\n"); 110 return result.toString(); 111 } 112 113 118 protected String defaultActionHtmlEnd() { 119 120 return m_activeWp.defaultActionHtmlEnd(); 121 } 122 123 128 protected String defaultActionHtmlStart() { 129 130 return m_activeWp.defaultActionHtmlStart(); 131 } 132 133 140 public void displayDialog() throws JspException , IOException , ServletException { 141 142 displayDialog(false); 143 } 144 145 146 151 public void writeDialog() throws IOException { 152 153 if (m_activeWp.isForwarded() || m_passiveWp.isForwarded()) { 154 return; 155 } 156 157 JspWriter out = m_activeWp.getJsp().getJspContext().getOut(); 158 out.print(defaultActionHtml()); 159 } 160 161 171 public void displayDialog(boolean writeLater) throws JspException , IOException , ServletException { 172 173 m_activeWp.actionDialog(); 175 if (m_activeWp.isForwarded()) { 176 return; 177 } 178 179 m_activeWp.refreshList(); 180 m_passiveWp.refreshList(); 181 182 if (writeLater) { 183 return; 184 } 185 JspWriter out = m_activeWp.getJsp().getJspContext().getOut(); 186 out.print(defaultActionHtml()); 187 } 188 189 194 public A_CmsListDialog getActiveWp() { 195 196 return m_activeWp; 197 } 198 199 204 public A_CmsListDialog getFirstWp() { 205 206 return m_firstWp; 207 } 208 209 214 public A_CmsListDialog getPassiveWp() { 215 216 return m_passiveWp; 217 } 218 219 224 public A_CmsListDialog getSecondWp() { 225 226 return m_secondWp; 227 } 228 } 229 | Popular Tags |