1 package org.tigris.scarab.screens; 2 3 48 49 import org.apache.turbine.RunData; 51 import org.apache.turbine.TemplateContext; 52 import org.apache.turbine.tool.IntakeTool; 53 54 import org.tigris.scarab.tools.ScarabRequestTool; 56 import org.tigris.scarab.tools.ScarabLocalizationTool; 57 import org.tigris.scarab.util.Log; 58 59 65 public class MoveIssue extends Default 66 { 67 private static final String MOVE = "move"; 68 private static final String COPY = "copy"; 69 private static final Integer MOVE_CHOICE = new Integer (0); 70 private static final Integer COPY_CHOICE = new Integer (1); 71 private static final String KEY = "MoveIssueTitle1"; 72 73 private TemplateContext context; 74 private RunData data; 75 76 protected String getTitle(ScarabRequestTool scarabR, 77 ScarabLocalizationTool l10n) 78 throws Exception 79 { 80 return getTitle(scarabR, l10n, data, context); 81 } 82 83 protected String getTitle(ScarabRequestTool scarabR, 84 ScarabLocalizationTool l10n, 85 RunData data, TemplateContext context) 86 throws Exception 87 { 88 String title = null; 89 try 90 { 91 String action = ((IntakeTool) context.get("intake")) 92 .get("MoveIssue").getDefault().get("Action").toString(); 93 String l10nKey = getKey(); 94 if (COPY.equals(action)) 95 { 96 title = l10n.format(l10nKey, COPY_CHOICE); 97 } 98 else if (MOVE.equals(action)) 99 { 100 title = l10n.format(l10nKey, MOVE_CHOICE); 101 } 102 else 103 { 104 scarabR.setAlertMessage(l10n.get("NoActionSpecified")); 105 setTarget(data, "ViewIssue.vm"); 106 } 107 } 108 catch (Exception e) 109 { 110 title = "Error; Copy or Move?"; 111 Log.get().warn("Error determining title", e); 112 } 113 return title; 114 } 115 116 protected String getKey() 117 { 118 return KEY; 119 } 120 121 protected void doBuildTemplate(RunData data, TemplateContext context) 122 throws Exception 123 { 124 this.data = data; 125 this.context = context; 126 super.doBuildTemplate(data, context); 127 } 128 } 129 | Popular Tags |