1 23 24 package com.sun.enterprise.tools.guiframework.view.descriptors; 25 26 import com.iplanet.jato.ModelManager; 27 import com.iplanet.jato.RequestContext; 28 import com.iplanet.jato.RequestManager; 29 import com.iplanet.jato.view.ContainerView; 30 import com.iplanet.jato.view.View; 31 32 import com.sun.enterprise.tools.guiframework.view.DescriptorCCPrimaryMasthead; 33 import com.sun.web.ui.model.CCMastheadModel; 34 import com.sun.web.ui.model.CCMastheadModelInterface; 35 36 37 40 public class CCPrimaryMastheadDescriptor extends DisplayFieldDescriptor { 41 42 45 public CCPrimaryMastheadDescriptor(String name) { 46 super(name); 47 } 48 49 57 public CCMastheadModelInterface getModel() { 58 boolean fromSession = shouldGetModelFromSession(); 60 boolean toSession = shouldPutModelToSession(); 61 String value = getModelInstanceName(); 62 63 ModelManager mgr = RequestManager.getRequestContext().getModelManager(); 65 CCMastheadModelInterface model = 67 (CCMastheadModelInterface) mgr.getModel(CCMastheadModel.class, 68 value, fromSession, toSession); 69 70 if (model.getShowDate() != null) { 72 return model; 74 } 75 76 String helpFile = (String ) getParameter(HELP_FILENAME); 78 if (helpFile != null) { 79 ((CCMastheadModel) model).setHelpFileName(helpFile); 80 } 81 82 value = (String ) getParameter(SHOW_DATE); 84 if (value == null) { 85 value = "false"; 86 } 87 model.setShowDate(new Boolean (value).booleanValue()); 88 89 value = (String ) getParameter(TASK_STATUS_HREF); 91 if (value != null) { 92 model.setTaskStatusHREF(value); 93 } 94 95 value = (String ) getParameter(CURRENT_ALARMS_HREF); 97 if (value != null) { 98 model.setCurrentAlarmsHREF(value); 99 } 100 101 value = (String ) getParameter(ALARM_COUNT_HREF); 103 if (value != null) { 104 model.setAlarmCountHREF(value); 105 } 106 107 value = (String ) getParameter(NUM_TASKS); 109 if (value != null) { 110 model.setNumTasks(Integer.parseInt(value)); 111 } 112 113 value = (String ) getParameter(NUM_DOWN); 115 if (value != null) { 116 ((CCMastheadModel) model).setAlarms( 117 value, 118 (String ) getParameter(NUM_CRITICAL), 119 (String ) getParameter(NUM_MAJOR), 120 (String ) getParameter(NUM_MINOR)); 121 } 122 123 int count = 0; 125 value = (String ) getParameter(LINK + count); 126 while (value != null) { 127 model.addLink( 128 value, 129 (String ) getParameter(LINK_LABEL + count), 130 (String ) getParameter(LINK_TOOLTIP + count), 131 (String ) getParameter(LINK_STATUS + count)); 132 count++; 133 value = (String ) getParameter(LINK + count); 134 } 135 136 value = (String ) getParameter(SHOW_SERVER); 138 if (value != null) { 139 model.setShowServer(Boolean.valueOf(value)); 140 } 141 142 value = (String ) getParameter(SHOW_USER_ROLE); 144 if (value != null) { 145 model.setShowUserRole(Boolean.valueOf(value)); 146 } 147 148 String imageSrc = (String ) getParameter(IMAGE_SRC); 150 if (imageSrc != null) { 151 model.setSrc(imageSrc); 152 } 153 154 String versionFile = (String ) getParameter(VERSION_FILE); 156 if (versionFile != null) { 157 ((CCMastheadModel) model).setVersionFileName(versionFile); 158 } 159 160 String versionWindowHeight = (String ) getParameter(VERSION_WINDOW_HEIGHT); 161 if (versionWindowHeight != null) { 162 ((CCMastheadModel) model).setVersionHeight(versionWindowHeight); 163 } 164 165 String versionWindowWidth = (String ) getParameter(VERSION_WINDOW_WIDTH); 166 if (versionWindowWidth != null) { 167 ((CCMastheadModel) model).setVersionWidth(versionWindowWidth); 168 } 169 170 String prodNameSrc = (String ) getParameter(PRODUCT_NAME_SRC); 171 if (prodNameSrc != null) { 172 ((CCMastheadModel) model).setVersionProductNameSrc(prodNameSrc); 173 } 174 175 String prodNameHeight = (String ) getParameter(PRODUCT_NAME_HEIGHT); 176 if (prodNameHeight != null) { 177 ((CCMastheadModel) model).setVersionProductNameHeight(prodNameHeight); 178 } 179 180 String prodNameWidth = (String ) getParameter(PRODUCT_NAME_WIDTH); 181 if (prodNameWidth != null) { 182 ((CCMastheadModel) model).setVersionProductNameWidth(prodNameWidth); 183 } 184 185 String helpType = (String ) getParameter(HELP_TYPE); 187 if (helpType == null) { 188 helpType = DEFAULT_HELP_TYPE; 189 } 190 ((CCMastheadModel) model).setHelpType(helpType); 191 192 String helpMastheadTitle = (String ) getParameter(HELP_MASTHEADTITLE); 193 if (helpMastheadTitle != null) { 194 ((CCMastheadModel) model).setHelpMastheadTitle(helpMastheadTitle); 195 } 196 197 return model; 199 } 200 201 210 public View getInstance(RequestContext ctx, ContainerView container, String name) { 211 DescriptorCCPrimaryMasthead mh = new DescriptorCCPrimaryMasthead( 213 ctx, container, name, this, getModel()); 214 215 String value = (String ) getParameter(SUBMIT_FORM_DATA); 218 if (value == null) { 219 value = "false"; 220 } 221 mh.setSubmitFormData(new Boolean (value).booleanValue()); 222 223 value = (String ) getParameter(USER_INFO_HREF); 225 if (value != null) { 226 mh.setUserInfoHREF(value); 227 } 228 229 value = (String ) getParameter(NOTIFICATION_MSG); 231 if (value != null) { 232 mh.setNotificationMsg(value); 233 } 234 235 value = (String ) getParameter(NOTIFICATION_HREF); 237 if (value != null) { 238 mh.setNotificationHREF(value); 239 } 240 241 value = (String ) getParameter(USER_NAME); 242 if (value != null) { 243 mh.setUserName(value); 244 } 245 246 return mh; 248 } 249 250 254 public static final String SHOW_DATE = "showDate"; 255 256 261 public static final String TASK_STATUS_HREF = "taskStatusHref"; 262 263 268 public static final String CURRENT_ALARMS_HREF = "currentAlarmsHref"; 269 270 275 public static final String ALARM_COUNT_HREF = "alarmCountHref"; 276 277 282 public static final String NUM_TASKS = "numTasks"; 283 284 289 public static final String NUM_DOWN = "numDown"; 290 291 296 public static final String NUM_CRITICAL = "numCritical"; 297 298 303 public static final String NUM_MAJOR = "numMajor"; 304 305 310 public static final String NUM_MINOR = "numMinor"; 311 312 318 public static final String LINK = "link"; 319 320 326 public static final String LINK_LABEL = "linkLabel"; 327 328 334 public static final String LINK_TOOLTIP = "linkTooltip"; 335 336 342 public static final String LINK_STATUS = "linkStatus"; 343 344 349 public static final String SUBMIT_FORM_DATA = "submitFormData"; 350 351 356 public static final String USER_INFO_HREF = "userInfoHref"; 357 358 363 public static final String NOTIFICATION_MSG = "notificationMsg"; 364 365 370 public static final String NOTIFICATION_HREF = "notificationHref"; 371 372 377 public static final String PRODUCT_NAME_SRC = "productNameSrc"; 378 379 384 public static final String PRODUCT_NAME_HEIGHT = "productNameHeight"; 385 386 391 public static final String PRODUCT_NAME_WIDTH = "productNameWidth"; 392 393 403 public static final String VERSION_FILE = "versionFile"; 404 405 public static final String SHOW_SERVER = "showServer"; 406 public static final String SHOW_USER_ROLE = "showUserRole"; 407 public static final String IMAGE_SRC = "imageSrc"; 408 409 public static final String VERSION_WINDOW_HEIGHT = "versionWindowHeight"; 410 public static final String VERSION_WINDOW_WIDTH = "versionWindowWidth"; 411 public static final String USER_NAME = "userName"; 412 413 public static final String HELP_MASTHEADTITLE = "helpMastheadTitle"; 415 public static final String HELP_TYPE = "helpType"; 416 public static final String DEFAULT_HELP_TYPE = "help2"; 417 public static final String HELP_FILENAME = "helpFile"; 418 public static final String HELP_RESOURCES = "helpResources"; 419 } 420 | Popular Tags |