| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package org.kuali.student.common.ui.client.mvc; |
| 17 | |
|
| 18 | |
import java.util.ArrayList; |
| 19 | |
import java.util.HashMap; |
| 20 | |
import java.util.Iterator; |
| 21 | |
import java.util.Map; |
| 22 | |
|
| 23 | |
import org.kuali.student.common.assembly.data.Data; |
| 24 | |
import org.kuali.student.common.rice.authorization.PermissionType; |
| 25 | |
import org.kuali.student.common.ui.client.application.KSAsyncCallback; |
| 26 | |
import org.kuali.student.common.ui.client.application.ViewContext; |
| 27 | |
import org.kuali.student.common.ui.client.configurable.mvc.LayoutController; |
| 28 | |
import org.kuali.student.common.ui.client.configurable.mvc.views.SectionView; |
| 29 | |
import org.kuali.student.common.ui.client.mvc.breadcrumb.BreadcrumbSupport; |
| 30 | |
import org.kuali.student.common.ui.client.mvc.history.HistoryManager; |
| 31 | |
import org.kuali.student.common.ui.client.mvc.history.HistorySupport; |
| 32 | |
import org.kuali.student.common.ui.client.mvc.history.NavigationEvent; |
| 33 | |
import org.kuali.student.common.ui.client.reporting.ReportExport; |
| 34 | |
import org.kuali.student.common.ui.client.security.AuthorizationCallback; |
| 35 | |
import org.kuali.student.common.ui.client.security.RequiresAuthorization; |
| 36 | |
import org.kuali.student.common.ui.client.service.GwtExportRpcService; |
| 37 | |
import org.kuali.student.common.ui.client.service.GwtExportRpcServiceAsync; |
| 38 | |
import org.kuali.student.common.ui.client.util.ExportElement; |
| 39 | |
import org.kuali.student.common.ui.client.util.ExportUtils; |
| 40 | |
import org.kuali.student.common.ui.client.widgets.progress.BlockingTask; |
| 41 | |
import org.kuali.student.common.ui.client.widgets.progress.KSBlockingProgressIndicator; |
| 42 | |
|
| 43 | |
import com.google.gwt.core.client.GWT; |
| 44 | |
import com.google.gwt.event.shared.GwtEvent.Type; |
| 45 | |
import com.google.gwt.event.shared.HandlerManager; |
| 46 | |
import com.google.gwt.event.shared.HandlerRegistration; |
| 47 | |
import com.google.gwt.user.client.Window; |
| 48 | |
import com.google.gwt.user.client.ui.Composite; |
| 49 | |
import com.google.gwt.user.client.ui.Widget; |
| 50 | |
|
| 51 | |
|
| 52 | |
|
| 53 | |
|
| 54 | |
|
| 55 | |
|
| 56 | |
|
| 57 | 0 | public abstract class Controller extends Composite implements HistorySupport, BreadcrumbSupport, ReportExport{ |
| 58 | 0 | public static final Callback<Boolean> NO_OP_CALLBACK = new Callback<Boolean>() { |
| 59 | |
@Override |
| 60 | |
public void exec(Boolean result) { |
| 61 | |
|
| 62 | 0 | } |
| 63 | |
}; |
| 64 | |
|
| 65 | |
|
| 66 | |
|
| 67 | 0 | protected Controller parentController = null; |
| 68 | 0 | private View currentView = null; |
| 69 | 0 | private Enum<?> currentViewEnum = null; |
| 70 | 0 | private String defaultModelId = null; |
| 71 | 0 | protected ViewContext context = new ViewContext(); |
| 72 | 0 | private final Map<String, ModelProvider<? extends Model>> models = new HashMap<String, ModelProvider<? extends Model>>(); |
| 73 | 0 | private boolean fireNavEvents = true; |
| 74 | 0 | private HandlerManager applicationEventHandlers = new HandlerManager(this); |
| 75 | 0 | private GwtExportRpcServiceAsync reportExportRpcService = GWT.create(GwtExportRpcService.class); |
| 76 | |
|
| 77 | 0 | protected Controller() { |
| 78 | 0 | } |
| 79 | |
|
| 80 | |
|
| 81 | |
|
| 82 | |
|
| 83 | |
|
| 84 | |
|
| 85 | |
|
| 86 | |
|
| 87 | |
public <V extends Enum<?>> void showView(final V viewType){ |
| 88 | 0 | this.showView(viewType, NO_OP_CALLBACK); |
| 89 | 0 | } |
| 90 | |
|
| 91 | |
|
| 92 | |
|
| 93 | |
|
| 94 | |
|
| 95 | |
|
| 96 | |
|
| 97 | |
|
| 98 | |
|
| 99 | |
|
| 100 | |
|
| 101 | |
|
| 102 | |
|
| 103 | |
|
| 104 | |
|
| 105 | |
|
| 106 | |
|
| 107 | |
|
| 108 | |
|
| 109 | |
|
| 110 | |
|
| 111 | |
public <V extends Enum<?>> void showView(final V viewType, final Callback<Boolean> onReadyCallback) { |
| 112 | 0 | GWT.log("showView " + viewType.toString(), null); |
| 113 | 0 | getView(viewType, new Callback<View>(){ |
| 114 | |
|
| 115 | |
@Override |
| 116 | |
public void exec(View result) { |
| 117 | 0 | View view = result; |
| 118 | 0 | if (view == null) { |
| 119 | 0 | onReadyCallback.exec(false); |
| 120 | |
|
| 121 | |
} |
| 122 | 0 | beginShowView(view, viewType, onReadyCallback); |
| 123 | |
|
| 124 | 0 | }}); |
| 125 | 0 | } |
| 126 | |
|
| 127 | |
private <V extends Enum<?>> void beginShowView(final View view, final V viewType, final Callback<Boolean> onReadyCallback){ |
| 128 | 0 | beforeViewChange(viewType, new Callback<Boolean>(){ |
| 129 | |
|
| 130 | |
@Override |
| 131 | |
public void exec(Boolean result) { |
| 132 | 0 | if(result){ |
| 133 | 0 | boolean requiresAuthz = (view instanceof RequiresAuthorization) && ((RequiresAuthorization)view).isAuthorizationRequired(); |
| 134 | |
|
| 135 | 0 | if (requiresAuthz){ |
| 136 | 0 | ViewContext tempContext = new ViewContext(); |
| 137 | 0 | if(view instanceof LayoutController){ |
| 138 | 0 | tempContext = ((LayoutController) view).getViewContext(); |
| 139 | |
} |
| 140 | |
else{ |
| 141 | 0 | tempContext = view.getController().getViewContext(); |
| 142 | |
} |
| 143 | |
|
| 144 | 0 | PermissionType permType = (tempContext != null) ? tempContext.getPermissionType() : null; |
| 145 | 0 | if (permType != null) { |
| 146 | 0 | GWT.log("Checking permission type '" + permType.getPermissionTemplateName() + "' for view '" + view.toString() + "'", null); |
| 147 | |
|
| 148 | 0 | ((RequiresAuthorization)view).checkAuthorization(permType, new AuthorizationCallback(){ |
| 149 | |
public void isAuthorized() { |
| 150 | 0 | finalizeShowView(view, viewType, onReadyCallback); |
| 151 | 0 | } |
| 152 | |
|
| 153 | |
public void isNotAuthorized(String msg) { |
| 154 | 0 | Window.alert(msg); |
| 155 | 0 | onReadyCallback.exec(false); |
| 156 | 0 | } |
| 157 | |
}); |
| 158 | |
} |
| 159 | |
else { |
| 160 | 0 | GWT.log("Cannot find PermissionType for view '" + view.toString() + "' which requires authorization", null); |
| 161 | 0 | finalizeShowView(view, viewType, onReadyCallback); |
| 162 | |
} |
| 163 | 0 | } else { |
| 164 | 0 | GWT.log("Not Requiring Auth.", null); |
| 165 | 0 | finalizeShowView(view, viewType, onReadyCallback); |
| 166 | |
} |
| 167 | 0 | } |
| 168 | |
else{ |
| 169 | 0 | onReadyCallback.exec(false); |
| 170 | |
} |
| 171 | |
|
| 172 | 0 | } |
| 173 | |
}); |
| 174 | 0 | } |
| 175 | |
|
| 176 | |
private <V extends Enum<?>> void finalizeShowView(final View view, final V viewType, final Callback<Boolean> onReadyCallback){ |
| 177 | 0 | if ((currentView == null) || currentView.beforeHide()) { |
| 178 | 0 | view.beforeShow(new Callback<Boolean>() { |
| 179 | |
@Override |
| 180 | |
public void exec(Boolean result) { |
| 181 | 0 | if (!result) { |
| 182 | 0 | GWT.log("showView: beforeShow yielded false " + viewType, null); |
| 183 | 0 | onReadyCallback.exec(false); |
| 184 | |
} else { |
| 185 | 0 | if (currentView != null) { |
| 186 | 0 | hideView(currentView); |
| 187 | |
} |
| 188 | |
|
| 189 | 0 | currentViewEnum = viewType; |
| 190 | 0 | currentView = view; |
| 191 | 0 | GWT.log("renderView " + viewType.toString(), null); |
| 192 | 0 | if(fireNavEvents){ |
| 193 | 0 | fireNavigationEvent(); |
| 194 | |
} |
| 195 | 0 | renderView(view); |
| 196 | 0 | onReadyCallback.exec(true); |
| 197 | |
|
| 198 | |
} |
| 199 | 0 | } |
| 200 | |
}); |
| 201 | |
} else { |
| 202 | 0 | onReadyCallback.exec(false); |
| 203 | 0 | GWT.log("Current view canceled hide action", null); |
| 204 | |
} |
| 205 | 0 | } |
| 206 | |
|
| 207 | |
protected void fireNavigationEvent() { |
| 208 | |
|
| 209 | |
|
| 210 | |
|
| 211 | 0 | fireApplicationEvent(new NavigationEvent(Controller.this)); |
| 212 | |
|
| 213 | |
|
| 214 | 0 | } |
| 215 | |
|
| 216 | |
|
| 217 | |
|
| 218 | |
|
| 219 | |
|
| 220 | |
|
| 221 | |
public View getCurrentView() { |
| 222 | 0 | return currentView; |
| 223 | |
} |
| 224 | |
|
| 225 | |
public Enum<?> getCurrentViewEnum() { |
| 226 | 0 | return currentViewEnum; |
| 227 | |
} |
| 228 | |
|
| 229 | |
public void setCurrentViewEnum(Enum<?> currentViewEnum) { |
| 230 | 0 | this.currentViewEnum = currentViewEnum; |
| 231 | 0 | } |
| 232 | |
|
| 233 | |
|
| 234 | |
|
| 235 | |
|
| 236 | |
|
| 237 | |
|
| 238 | |
|
| 239 | |
|
| 240 | |
|
| 241 | |
|
| 242 | |
public void setParentController(Controller controller) { |
| 243 | 0 | parentController = controller; |
| 244 | 0 | } |
| 245 | |
|
| 246 | |
|
| 247 | |
|
| 248 | |
|
| 249 | |
|
| 250 | |
|
| 251 | |
|
| 252 | |
public Controller getParentController() { |
| 253 | 0 | if (parentController == null) { |
| 254 | 0 | parentController = Controller.findController(this); |
| 255 | |
} |
| 256 | 0 | return parentController; |
| 257 | |
} |
| 258 | |
|
| 259 | |
|
| 260 | |
|
| 261 | |
|
| 262 | |
|
| 263 | |
|
| 264 | |
|
| 265 | |
|
| 266 | |
public static Controller findController(Widget w) { |
| 267 | 0 | Controller result = null; |
| 268 | |
while (true) { |
| 269 | 0 | w = w.getParent(); |
| 270 | 0 | if (w == null) { |
| 271 | 0 | break; |
| 272 | 0 | } else if (w instanceof Controller) { |
| 273 | 0 | result = (Controller) w; |
| 274 | 0 | break; |
| 275 | 0 | } else if (w instanceof View) { |
| 276 | |
|
| 277 | |
|
| 278 | 0 | result = ((View) w).getController(); |
| 279 | 0 | break; |
| 280 | |
} |
| 281 | |
} |
| 282 | 0 | return result; |
| 283 | |
} |
| 284 | |
|
| 285 | |
|
| 286 | |
|
| 287 | |
|
| 288 | |
|
| 289 | |
|
| 290 | |
|
| 291 | |
|
| 292 | |
|
| 293 | |
|
| 294 | |
|
| 295 | |
|
| 296 | |
|
| 297 | |
@SuppressWarnings("unchecked") |
| 298 | |
public void requestModel(final Class modelType, final ModelRequestCallback callback) { |
| 299 | 0 | requestModel((modelType == null) ? null : modelType.getName(), callback); |
| 300 | 0 | } |
| 301 | |
|
| 302 | |
@SuppressWarnings("unchecked") |
| 303 | |
public void requestModel(final String modelId, final ModelRequestCallback callback) { |
| 304 | 0 | String id = (modelId == null) ? defaultModelId : modelId; |
| 305 | |
|
| 306 | 0 | ModelProvider<? extends Model> p = models.get(id); |
| 307 | 0 | if (p != null) { |
| 308 | 0 | p.requestModel(callback); |
| 309 | 0 | } else if (getParentController() != null) { |
| 310 | 0 | parentController.requestModel(modelId, callback); |
| 311 | |
} else { |
| 312 | 0 | if (callback != null) { |
| 313 | 0 | callback.onRequestFail(new RuntimeException("The requested model was not found: " + modelId)); |
| 314 | |
} |
| 315 | |
} |
| 316 | 0 | } |
| 317 | |
|
| 318 | |
@SuppressWarnings("unchecked") |
| 319 | |
public void requestModel(final ModelRequestCallback callback) { |
| 320 | 0 | requestModel((String)null, callback); |
| 321 | 0 | } |
| 322 | |
|
| 323 | |
public <T extends Model> void registerModel(String modelId, ModelProvider<T> provider) { |
| 324 | 0 | models.put(modelId, provider); |
| 325 | 0 | } |
| 326 | |
|
| 327 | |
public String getDefaultModelId() { |
| 328 | 0 | return defaultModelId; |
| 329 | |
} |
| 330 | |
public void setDefaultModelId(String defaultModelId) { |
| 331 | 0 | this.defaultModelId = defaultModelId; |
| 332 | 0 | } |
| 333 | |
|
| 334 | |
|
| 335 | |
|
| 336 | |
|
| 337 | |
|
| 338 | |
|
| 339 | |
|
| 340 | |
|
| 341 | |
|
| 342 | |
|
| 343 | |
@SuppressWarnings("unchecked") |
| 344 | |
public HandlerRegistration addApplicationEventHandler(Type type, ApplicationEventHandler handler) { |
| 345 | 0 | if ((handler instanceof UncheckedApplicationEventHandler) && (getParentController() != null)) { |
| 346 | 0 | return parentController.addApplicationEventHandler(type, handler); |
| 347 | |
} |
| 348 | 0 | return applicationEventHandlers.addHandler(type, handler); |
| 349 | |
} |
| 350 | |
|
| 351 | |
|
| 352 | |
|
| 353 | |
|
| 354 | |
|
| 355 | |
|
| 356 | |
@SuppressWarnings("unchecked") |
| 357 | |
public void fireApplicationEvent(ApplicationEvent event) { |
| 358 | |
|
| 359 | |
|
| 360 | 0 | if ((event instanceof UncheckedApplicationEvent) && (getParentController() != null)) { |
| 361 | 0 | parentController.fireApplicationEvent(event); |
| 362 | |
} |
| 363 | |
|
| 364 | 0 | applicationEventHandlers.fireEvent(event); |
| 365 | |
|
| 366 | 0 | } |
| 367 | |
|
| 368 | |
|
| 369 | |
|
| 370 | |
|
| 371 | |
|
| 372 | |
|
| 373 | |
protected abstract void renderView(View view); |
| 374 | |
|
| 375 | |
|
| 376 | |
|
| 377 | |
|
| 378 | |
|
| 379 | |
|
| 380 | |
protected abstract void hideView(View view); |
| 381 | |
|
| 382 | |
|
| 383 | |
|
| 384 | |
|
| 385 | |
|
| 386 | |
|
| 387 | |
|
| 388 | |
|
| 389 | |
protected abstract <V extends Enum<?>> void getView(V viewType, Callback<View> callback); |
| 390 | |
|
| 391 | |
|
| 392 | |
|
| 393 | |
|
| 394 | |
|
| 395 | |
|
| 396 | |
|
| 397 | |
public void beforeViewChange(Enum<?> viewChangingTo, Callback<Boolean> okToChangeCallback) { |
| 398 | 0 | okToChangeCallback.exec(true); |
| 399 | 0 | } |
| 400 | |
|
| 401 | |
|
| 402 | |
|
| 403 | |
|
| 404 | |
public abstract void showDefaultView(Callback<Boolean> onReadyCallback); |
| 405 | |
|
| 406 | |
public abstract Enum<?> getViewEnumValue(String enumValue); |
| 407 | |
|
| 408 | |
|
| 409 | |
|
| 410 | |
|
| 411 | |
|
| 412 | |
|
| 413 | |
|
| 414 | |
@Override |
| 415 | |
public String collectHistory(String historyStack) { |
| 416 | 0 | String token = getHistoryToken(); |
| 417 | 0 | historyStack = historyStack + "/" + token; |
| 418 | |
|
| 419 | 0 | if(currentView != null){ |
| 420 | 0 | String tempHistoryStack = historyStack; |
| 421 | 0 | historyStack = currentView.collectHistory(historyStack); |
| 422 | |
|
| 423 | |
|
| 424 | 0 | if(historyStack == null){ |
| 425 | 0 | historyStack = tempHistoryStack; |
| 426 | |
} |
| 427 | 0 | else if(historyStack != null && historyStack.isEmpty()){ |
| 428 | 0 | historyStack = tempHistoryStack; |
| 429 | |
} |
| 430 | |
} |
| 431 | 0 | return historyStack; |
| 432 | |
} |
| 433 | |
|
| 434 | |
protected String getHistoryToken() { |
| 435 | 0 | String historyToken = ""; |
| 436 | 0 | if (currentViewEnum != null) { |
| 437 | 0 | historyToken = currentViewEnum.toString(); |
| 438 | 0 | if(currentView != null && currentView instanceof Controller |
| 439 | |
&& ((Controller)currentView).getViewContext() != null){ |
| 440 | 0 | ViewContext context = ((Controller) currentView).getViewContext(); |
| 441 | 0 | historyToken = HistoryManager.appendContext(historyToken, context); |
| 442 | |
} |
| 443 | |
|
| 444 | |
} |
| 445 | 0 | return historyToken; |
| 446 | |
} |
| 447 | |
|
| 448 | |
|
| 449 | |
|
| 450 | |
|
| 451 | |
|
| 452 | |
|
| 453 | |
|
| 454 | |
|
| 455 | |
|
| 456 | |
|
| 457 | |
|
| 458 | |
|
| 459 | |
|
| 460 | |
@Override |
| 461 | |
public void onHistoryEvent(String historyStack) { |
| 462 | 0 | final String nextHistoryStack = HistoryManager.nextHistoryStack(historyStack); |
| 463 | 0 | String[] tokens = HistoryManager.splitHistoryStack(nextHistoryStack); |
| 464 | 0 | if (tokens.length >= 1 && tokens[0] != null && !tokens[0].isEmpty()) { |
| 465 | 0 | final Map<String, String> tokenMap = HistoryManager.getTokenMap(tokens[0]); |
| 466 | |
|
| 467 | 0 | String viewEnumString = tokenMap.get("view"); |
| 468 | 0 | if (viewEnumString != null) { |
| 469 | 0 | final Enum<?> viewEnum = getViewEnumValue(viewEnumString); |
| 470 | |
|
| 471 | 0 | if (viewEnum != null) { |
| 472 | 0 | getView(viewEnum, new Callback<View>(){ |
| 473 | |
|
| 474 | |
@Override |
| 475 | |
public void exec(View result) { |
| 476 | 0 | View theView = result; |
| 477 | 0 | boolean sameContext = true; |
| 478 | 0 | if(theView instanceof Controller){ |
| 479 | |
|
| 480 | 0 | ViewContext newContext = new ViewContext(); |
| 481 | 0 | Iterator<String> tokenIt = tokenMap.keySet().iterator(); |
| 482 | 0 | while(tokenIt.hasNext()){ |
| 483 | 0 | String key = tokenIt.next(); |
| 484 | 0 | if(key.equals(ViewContext.ID_ATR)){ |
| 485 | 0 | newContext.setId(tokenMap.get(ViewContext.ID_ATR)); |
| 486 | |
} |
| 487 | 0 | else if(key.equals(ViewContext.ID_TYPE_ATR)){ |
| 488 | 0 | newContext.setIdType(tokenMap.get(ViewContext.ID_TYPE_ATR)); |
| 489 | |
} |
| 490 | |
|
| 491 | 0 | else if(!key.equals("view")){ |
| 492 | 0 | newContext.setAttribute(key, tokenMap.get(key)); |
| 493 | |
} |
| 494 | 0 | } |
| 495 | |
|
| 496 | 0 | ViewContext viewContext = ((Controller) theView).getViewContext(); |
| 497 | 0 | if(viewContext.compareTo(newContext) != 0){ |
| 498 | 0 | ((Controller) theView).setViewContext(newContext); |
| 499 | 0 | sameContext = false; |
| 500 | |
} |
| 501 | |
} |
| 502 | 0 | if (currentViewEnum == null || !viewEnum.equals(currentViewEnum) |
| 503 | |
|| !sameContext) { |
| 504 | 0 | beginShowView(theView, viewEnum, new Callback<Boolean>() { |
| 505 | |
@Override |
| 506 | |
public void exec(Boolean result) { |
| 507 | 0 | if (result) { |
| 508 | 0 | currentView.onHistoryEvent(nextHistoryStack); |
| 509 | |
} |
| 510 | 0 | } |
| 511 | |
}); |
| 512 | 0 | } else if (currentView != null) { |
| 513 | 0 | currentView.onHistoryEvent(nextHistoryStack); |
| 514 | |
} |
| 515 | 0 | } |
| 516 | |
}); |
| 517 | |
|
| 518 | |
} |
| 519 | |
} |
| 520 | 0 | } |
| 521 | |
else{ |
| 522 | 0 | this.showDefaultView(new Callback<Boolean>(){ |
| 523 | |
|
| 524 | |
@Override |
| 525 | |
public void exec(Boolean result) { |
| 526 | 0 | if(result){ |
| 527 | 0 | currentView.onHistoryEvent(nextHistoryStack); |
| 528 | |
} |
| 529 | |
|
| 530 | 0 | } |
| 531 | |
}); |
| 532 | |
} |
| 533 | |
|
| 534 | 0 | } |
| 535 | |
|
| 536 | |
|
| 537 | |
|
| 538 | |
|
| 539 | |
|
| 540 | |
|
| 541 | |
|
| 542 | |
|
| 543 | |
public void setViewContext(ViewContext viewContext){ |
| 544 | 0 | this.context = viewContext; |
| 545 | 0 | } |
| 546 | |
|
| 547 | |
public ViewContext getViewContext() { |
| 548 | 0 | return this.context; |
| 549 | |
} |
| 550 | |
|
| 551 | |
public void resetCurrentView(){ |
| 552 | 0 | currentView = null; |
| 553 | 0 | } |
| 554 | |
|
| 555 | |
|
| 556 | |
|
| 557 | |
|
| 558 | |
|
| 559 | |
|
| 560 | |
|
| 561 | |
|
| 562 | |
@Override |
| 563 | |
public void doReportExport(ArrayList<ExportElement> exportElements, final String format, final String reportTitle) { |
| 564 | |
|
| 565 | 0 | final BlockingTask loadDataTask = new BlockingTask("Generating Export File"); |
| 566 | |
|
| 567 | 0 | DataModel dataModel = getExportDataModel(); |
| 568 | 0 | Data modelDataObject = null; |
| 569 | 0 | if (dataModel != null) { |
| 570 | 0 | modelDataObject = dataModel.getRoot(); |
| 571 | |
} |
| 572 | |
|
| 573 | |
|
| 574 | |
|
| 575 | 0 | KSBlockingProgressIndicator.addTask(loadDataTask); |
| 576 | |
|
| 577 | 0 | reportExportRpcService.reportExport(exportElements, modelDataObject, getExportTemplateName(), format, reportTitle, new KSAsyncCallback<String>() { |
| 578 | |
@Override |
| 579 | |
public void onSuccess(String result) { |
| 580 | |
|
| 581 | |
|
| 582 | |
|
| 583 | 0 | String baseUrl = GWT.getHostPageBaseURL(); |
| 584 | 0 | baseUrl = baseUrl.replaceFirst(GWT.getModuleName() + "/", ""); |
| 585 | |
|
| 586 | 0 | KSBlockingProgressIndicator.removeTask(loadDataTask); |
| 587 | |
|
| 588 | 0 | Window.open(baseUrl + "exportDownloadHTTPServlet?exportId="+result + "&format=" + format, "", ""); |
| 589 | 0 | } |
| 590 | |
|
| 591 | |
@Override |
| 592 | |
public void handleFailure(Throwable caught) { |
| 593 | 0 | KSBlockingProgressIndicator.removeTask(loadDataTask); |
| 594 | 0 | super.handleFailure(caught); |
| 595 | 0 | } |
| 596 | |
|
| 597 | |
}); |
| 598 | |
|
| 599 | |
|
| 600 | |
|
| 601 | 0 | } |
| 602 | |
|
| 603 | |
|
| 604 | |
@Override |
| 605 | |
public DataModel getExportDataModel() { |
| 606 | 0 | return null; |
| 607 | |
} |
| 608 | |
|
| 609 | |
|
| 610 | |
|
| 611 | |
|
| 612 | |
|
| 613 | |
@Override |
| 614 | |
public String getExportTemplateName() { |
| 615 | 0 | return exportTemplateName; |
| 616 | |
} |
| 617 | |
|
| 618 | |
@Override |
| 619 | |
public ArrayList<ExportElement> getExportElementsFromView() { |
| 620 | 0 | String viewName = null; |
| 621 | 0 | View currentView = this.getCurrentView(); |
| 622 | 0 | if (currentView != null) { |
| 623 | |
|
| 624 | 0 | ArrayList<ExportElement> exportElements = null; |
| 625 | |
|
| 626 | 0 | if (currentView != null && currentView instanceof SectionView) { |
| 627 | 0 | viewName = currentView.getName(); |
| 628 | 0 | exportElements = ExportUtils.getExportElementsFromView((SectionView)currentView, exportElements, viewName, "Sectionname"); |
| 629 | 0 | return exportElements; |
| 630 | |
} else { |
| 631 | |
|
| 632 | |
} |
| 633 | |
} else { |
| 634 | |
|
| 635 | |
} |
| 636 | 0 | return null; |
| 637 | |
} |
| 638 | |
} |