1 31 32 package org.opencms.util.ant; 33 34 import javax.swing.UIManager ; 35 36 47 public class CmsAntTaskSelectionPrompt extends org.apache.tools.ant.Task { 48 49 50 public static final String LIST_SEPARATOR = ","; 51 52 53 private String m_allValues; 55 private int m_columns = 2; 56 57 private String m_defaultValue = ""; 58 59 private String m_prompt = "Please make your choice:"; 60 61 private String m_property; 63 private boolean m_singleSelection = false; 64 65 66 private String m_title = "Selection Dialog"; 67 68 71 public CmsAntTaskSelectionPrompt() { 72 73 super(); 74 } 75 76 86 public void execute() throws org.apache.tools.ant.BuildException { 87 88 log("Prompting user for " + m_property); 89 90 String value = new CmsAntTaskSelectionDialog(this).getSelection(); 91 92 if (value == null) { 93 value = "__ABORT__"; 94 } else { 95 log("user selection: " + value); 96 } 97 getProject().setProperty(m_property, value); 98 } 99 100 105 public String getAllValues() { 106 107 return m_allValues; 108 } 109 110 115 public int getColumns() { 116 117 return m_columns; 118 } 119 120 125 public String getDefaultValue() { 126 127 return m_defaultValue; 128 } 129 130 135 public String getPrompt() { 136 137 return m_prompt; 138 } 139 140 145 public String getProperty() { 146 147 return m_property; 148 } 149 150 155 public String getTitle() { 156 157 return m_title; 158 } 159 160 163 public void init() { 164 165 super.init(); 166 try { 167 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); 168 } catch (Exception e) { 169 } 171 } 172 173 178 public boolean isSingleSelection() { 179 180 return m_singleSelection; 181 } 182 183 188 public void setAllValues(String allValues) { 189 190 this.m_allValues = allValues; 191 } 192 193 198 public void setColumns(String cols) { 199 200 m_columns = Integer.parseInt(cols); 201 } 202 203 208 public void setDefaultValue(String defaultValue) { 209 210 this.m_defaultValue = defaultValue; 211 } 212 213 218 public void setPrompt(String prompt) { 219 220 m_prompt = prompt; 221 } 222 223 228 public void setProperty(String property) { 229 230 this.m_property = property; 231 } 232 233 238 public void setSingleSelection(boolean singleSelection) { 239 240 m_singleSelection = singleSelection; 241 } 242 243 248 public void setTitle(String title) { 249 250 m_title = title; 251 } 252 253 } | Popular Tags |