1 31 32 package org.opencms.workplace.list; 33 34 import org.opencms.i18n.CmsMessageContainer; 35 import org.opencms.main.CmsIllegalArgumentException; 36 import org.opencms.util.CmsStringUtil; 37 import org.opencms.workplace.tools.A_CmsHtmlIconButton; 38 39 48 public abstract class A_CmsListAction extends A_CmsHtmlIconButton implements I_CmsListAction { 49 50 51 private CmsMessageContainer m_confirmationMsg; 52 53 54 private String m_listId; 55 56 61 public A_CmsListAction(String id) { 62 63 super(id); 64 if (CmsStringUtil.isEmptyOrWhitespaceOnly(id)) { 65 throw new CmsIllegalArgumentException(Messages.get().container(Messages.ERR_LIST_INVALID_NULL_ARG_1, "id")); 66 } 67 setConfirmationMessage(null); 68 } 69 70 79 public static String defaultConfirmationHtml(String confId, String confText) { 80 81 StringBuffer html = new StringBuffer (1024); 82 html.append("<div class='hide' id='conf"); 83 html.append(confId); 84 html.append("'>"); 85 html.append(CmsStringUtil.isEmptyOrWhitespaceOnly(confText) ? "null" : confText); 86 html.append("</div>\n"); 87 return html.toString(); 88 } 89 90 93 public CmsMessageContainer getConfirmationMessage() { 94 95 return m_confirmationMsg; 96 } 97 98 101 public String getListId() { 102 103 return m_listId; 104 } 105 106 109 public void setConfirmationMessage(CmsMessageContainer confirmationMsg) { 110 111 if (confirmationMsg == null) { 112 confirmationMsg = EMPTY_MESSAGE; 113 } 114 m_confirmationMsg = confirmationMsg; 115 } 116 117 120 public void setListId(String listId) { 121 122 if (CmsStringUtil.isEmptyOrWhitespaceOnly(listId)) { 123 throw new CmsIllegalArgumentException(Messages.get().container( 124 Messages.ERR_LIST_INVALID_NULL_ARG_1, 125 "listId")); 126 } 127 m_listId = listId; 128 } 129 } | Popular Tags |