| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
package org.kuali.student.common.ui.client.widgets.containers; |
| 17 |
|
|
| 18 |
|
import java.util.ArrayList; |
| 19 |
|
import java.util.Arrays; |
| 20 |
|
import java.util.List; |
| 21 |
|
import java.util.Map; |
| 22 |
|
|
| 23 |
|
import org.kuali.student.common.ui.client.application.Application; |
| 24 |
|
import org.kuali.student.common.ui.client.application.ApplicationContext; |
| 25 |
|
import org.kuali.student.common.ui.client.application.KSAsyncCallback; |
| 26 |
|
import org.kuali.student.common.ui.client.mvc.Callback; |
| 27 |
|
import org.kuali.student.common.ui.client.service.ServerPropertiesRpcService; |
| 28 |
|
import org.kuali.student.common.ui.client.service.ServerPropertiesRpcServiceAsync; |
| 29 |
|
import org.kuali.student.common.ui.client.theme.Theme; |
| 30 |
|
import org.kuali.student.common.ui.client.widgets.KSButton; |
| 31 |
|
import org.kuali.student.common.ui.client.widgets.KSLabel; |
| 32 |
|
import org.kuali.student.common.ui.client.widgets.KSLightBox; |
| 33 |
|
import org.kuali.student.common.ui.client.widgets.NavigationHandler; |
| 34 |
|
import org.kuali.student.common.ui.client.widgets.StylishDropDown; |
| 35 |
|
import org.kuali.student.common.ui.client.widgets.headers.KSHeader; |
| 36 |
|
import org.kuali.student.common.ui.client.widgets.menus.KSMenu.MenuImageLocation; |
| 37 |
|
import org.kuali.student.common.ui.client.widgets.menus.KSMenuItemData; |
| 38 |
|
|
| 39 |
|
import com.google.gwt.core.client.GWT; |
| 40 |
|
import com.google.gwt.event.dom.client.ClickEvent; |
| 41 |
|
import com.google.gwt.event.dom.client.ClickHandler; |
| 42 |
|
import com.google.gwt.event.dom.client.MouseOutEvent; |
| 43 |
|
import com.google.gwt.event.dom.client.MouseOutHandler; |
| 44 |
|
import com.google.gwt.event.dom.client.MouseOverEvent; |
| 45 |
|
import com.google.gwt.event.dom.client.MouseOverHandler; |
| 46 |
|
import com.google.gwt.user.client.Window; |
| 47 |
|
import com.google.gwt.user.client.ui.Anchor; |
| 48 |
|
import com.google.gwt.user.client.ui.Composite; |
| 49 |
|
import com.google.gwt.user.client.ui.FlowPanel; |
| 50 |
|
import com.google.gwt.user.client.ui.FocusPanel; |
| 51 |
|
import com.google.gwt.user.client.ui.Frame; |
| 52 |
|
import com.google.gwt.user.client.ui.HTML; |
| 53 |
|
import com.google.gwt.user.client.ui.PopupPanel; |
| 54 |
|
import com.google.gwt.user.client.ui.SimplePanel; |
| 55 |
|
import com.google.gwt.user.client.ui.VerticalPanel; |
| 56 |
|
import com.google.gwt.user.client.ui.Widget; |
| 57 |
|
|
| 58 |
|
|
|
|
|
| 0% |
Uncovered Elements: 123 (123) |
Complexity: 27 |
Complexity Density: 0.3 |
|
| 59 |
|
public class KSWrapper extends Composite{ |
| 60 |
|
|
| 61 |
|
private static final String LUM_APP_URL = "lum.application.url"; |
| 62 |
|
private static final String APP_URL = "application.url"; |
| 63 |
|
private static final String DOC_SEARCH_URL = "ks.rice.docSearch.serviceAddress"; |
| 64 |
|
private static final String RICE_URL = "ks.rice.url"; |
| 65 |
|
private static final String RICE_LINK_LABEL = "ks.rice.label"; |
| 66 |
|
private static final String APP_VERSION = "ks.application.version"; |
| 67 |
|
|
| 68 |
|
|
| 69 |
|
private static final String CODE_SERVER = "ks.gwt.codeServer"; |
| 70 |
|
|
| 71 |
|
private ServerPropertiesRpcServiceAsync serverPropertiesRpcService = GWT.create(ServerPropertiesRpcService.class); |
| 72 |
|
|
| 73 |
|
private FlowPanel layout = new FlowPanel(); |
| 74 |
|
|
| 75 |
|
private KSHeader ksHeader = new KSHeader(); |
| 76 |
|
|
| 77 |
|
private StylishDropDown navDropDown = new StylishDropDown(getMessage("wrapperPanelTitleHome")); |
| 78 |
|
private Anchor versionAnchor = new Anchor(" ( Version ) "); |
| 79 |
|
|
| 80 |
|
|
| 81 |
|
private SimplePanel content = new SimplePanel(); |
| 82 |
|
private KSLightBox docSearchDialog = new KSLightBox(); |
| 83 |
|
|
| 84 |
|
private Frame docSearch; |
| 85 |
|
private String docSearchUrl = ""; |
| 86 |
|
private String appUrl = ".."; |
| 87 |
|
private String lumAppUrl = ".."; |
| 88 |
|
private String riceURL =".."; |
| 89 |
|
private String riceLinkLabel="Rice"; |
| 90 |
|
private String appVersion = ""; |
| 91 |
|
private String codeServer = ""; |
| 92 |
|
|
| 93 |
|
private boolean loaded = false; |
| 94 |
|
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
| 95 |
|
private static class WrapperNavigationHandler extends NavigationHandler{ |
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 96 |
0
|
public WrapperNavigationHandler(String url) {... |
| 97 |
0
|
super(url); |
| 98 |
|
} |
| 99 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 100 |
0
|
@Override... |
| 101 |
|
public void beforeNavigate(Callback<Boolean> callback) { |
| 102 |
|
|
| 103 |
|
|
| 104 |
0
|
callback.exec(true); |
| 105 |
|
} |
| 106 |
|
} |
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 107 |
0
|
public KSWrapper(){... |
| 108 |
0
|
this.initWidget(layout); |
| 109 |
|
} |
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 110 |
0
|
protected void onLoad() {... |
| 111 |
0
|
super.onLoad(); |
| 112 |
0
|
if (!loaded){ |
| 113 |
0
|
List<String> serverPropertyList = Arrays.asList(APP_URL, DOC_SEARCH_URL, LUM_APP_URL,RICE_URL,RICE_LINK_LABEL, APP_VERSION, CODE_SERVER); |
| 114 |
|
|
| 115 |
0
|
serverPropertiesRpcService.get(serverPropertyList, new KSAsyncCallback<Map<String,String>>() { |
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 116 |
0
|
public void handleFailure(Throwable caught) {... |
| 117 |
|
|
| 118 |
0
|
init(); |
| 119 |
|
} |
| 120 |
|
|
|
|
|
| 0% |
Uncovered Elements: 16 (16) |
Complexity: 3 |
Complexity Density: 0.25 |
|
| 121 |
0
|
public void onSuccess(Map<String,String> result) {... |
| 122 |
0
|
GWT.log("ServerProperties fetched: "+result.toString(), null); |
| 123 |
0
|
if(result != null){ |
| 124 |
0
|
appUrl = result.get(APP_URL); |
| 125 |
0
|
docSearchUrl = result.get(DOC_SEARCH_URL); |
| 126 |
0
|
lumAppUrl = result.get(LUM_APP_URL); |
| 127 |
0
|
riceURL = result.get(RICE_URL); |
| 128 |
0
|
riceLinkLabel = result.get(RICE_LINK_LABEL); |
| 129 |
0
|
appVersion = result.get(APP_VERSION); |
| 130 |
0
|
Application.getApplicationContext().setVersion(appVersion); |
| 131 |
0
|
if (result.get(CODE_SERVER) != null){ |
| 132 |
0
|
codeServer = result.get(CODE_SERVER); |
| 133 |
|
} |
| 134 |
|
} |
| 135 |
0
|
init(); |
| 136 |
|
} |
| 137 |
|
|
| 138 |
|
}); |
| 139 |
|
|
| 140 |
0
|
loaded = false; |
| 141 |
|
} |
| 142 |
|
} |
|
|
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 1 |
Complexity Density: 0.06 |
|
| 143 |
0
|
private void init(){... |
| 144 |
|
|
| 145 |
0
|
createUserDropDown(); |
| 146 |
|
|
| 147 |
0
|
ksHeader.setHiLabelText("Hi,"); |
| 148 |
0
|
ksHeader.setUserName(Application.getApplicationContext().getUserId()); |
| 149 |
0
|
Anchor logoutLink = new Anchor(getMessage("wrapperPanelLogout")); |
| 150 |
0
|
logoutLink.addClickHandler(new WrapperNavigationHandler("j_spring_security_logout")); |
| 151 |
0
|
ksHeader.addLogout(logoutLink); |
| 152 |
0
|
ksHeader.addLogout(versionAnchor); |
| 153 |
|
|
| 154 |
|
|
| 155 |
0
|
createHelpInfo(); |
| 156 |
0
|
createNavDropDown(); |
| 157 |
0
|
ksHeader.addNavigation(navDropDown); |
| 158 |
|
|
| 159 |
|
|
| 160 |
0
|
List<KSLabel> topLinks = new ArrayList<KSLabel>(); |
| 161 |
|
|
| 162 |
0
|
topLinks.add(buildLink(riceLinkLabel,riceLinkLabel,riceURL+"/portal.do")); |
| 163 |
0
|
setHeaderCustomLinks(topLinks); |
| 164 |
|
|
| 165 |
0
|
layout.add(ksHeader); |
| 166 |
0
|
layout.add(content); |
| 167 |
|
|
| 168 |
0
|
navDropDown.addStyleName("KS-Navigation-DropDown"); |
| 169 |
0
|
content.addStyleName("KS-Wrapper-Content"); |
| 170 |
0
|
layout.addStyleName("KS-Wrapper"); |
| 171 |
|
} |
| 172 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 173 |
0
|
private void createHelpInfo(){... |
| 174 |
0
|
versionAnchor.addClickHandler(new ClickHandler(){ |
| 175 |
|
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 176 |
0
|
public void onClick(ClickEvent event) {... |
| 177 |
0
|
final PopupPanel helpPopup = new PopupPanel(true); |
| 178 |
0
|
helpPopup.setWidget(new HTML("<br><h3> " + appVersion + " <h3>")); |
| 179 |
|
|
| 180 |
0
|
helpPopup.setPopupPositionAndShow(new PopupPanel.PositionCallback() { |
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 181 |
0
|
public void setPosition(int offsetWidth, int offsetHeight) {... |
| 182 |
0
|
int left = (Window.getClientWidth() - offsetWidth); |
| 183 |
0
|
int top = 0; |
| 184 |
0
|
helpPopup.setPopupPosition(left, top); |
| 185 |
|
} |
| 186 |
|
}); |
| 187 |
|
} |
| 188 |
|
}); |
| 189 |
|
} |
| 190 |
|
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 191 |
0
|
private void createUserDropDown() {... |
| 192 |
0
|
List<KSMenuItemData> items = new ArrayList<KSMenuItemData>(); |
| 193 |
0
|
items.add(new KSMenuItemData(getMessage("wrapperPanelLogout"),new WrapperNavigationHandler("j_spring_security_logout"))); |
| 194 |
|
} |
| 195 |
|
|
|
|
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 3 |
Complexity Density: 0.27 |
|
| 196 |
0
|
private void createNavDropDown() {... |
| 197 |
0
|
navDropDown.setImageLocation(MenuImageLocation.LEFT); |
| 198 |
|
|
| 199 |
0
|
List<KSMenuItemData> items = new ArrayList<KSMenuItemData>(); |
| 200 |
|
|
| 201 |
0
|
items.add(new KSMenuItemData(getMessage("wrapperPanelTitleHome"),Theme.INSTANCE.getCommonImages().getSpacerIcon(), |
| 202 |
|
new WrapperNavigationHandler( |
| 203 |
|
"#")) |
| 204 |
|
); |
| 205 |
0
|
items.add(new KSMenuItemData(getMessage("wrapperPanelTitleMyActionList"),Theme.INSTANCE.getCommonImages().getApplicationIcon(), |
| 206 |
|
new WrapperNavigationHandler( |
| 207 |
0
|
lumAppUrl+"/org.kuali.student.lum.lu.ui.main.LUMMain/LUMMain.jsp"+(codeServer.isEmpty()?"":"?"+codeServer))) |
| 208 |
|
); |
| 209 |
0
|
items.add(new KSMenuItemData(getMessage("wrapperPanelTitleCurriculumManagement"),Theme.INSTANCE.getCommonImages().getBookIcon(), |
| 210 |
|
new WrapperNavigationHandler( |
| 211 |
0
|
lumAppUrl+"/org.kuali.student.lum.lu.ui.main.LUMMain/LUMMain.jsp?view=CURRICULUM_MANAGEMENT"+(codeServer.isEmpty()?"":"&"+codeServer))) |
| 212 |
|
); |
| 213 |
0
|
items.add(new KSMenuItemData(getMessage("wrapperPanelTitleOrg"), Theme.INSTANCE.getCommonImages().getPeopleIcon(), |
| 214 |
|
new WrapperNavigationHandler( |
| 215 |
|
lumAppUrl+"/org.kuali.student.core.organization.ui.OrgEntry/OrgEntry.jsp")) |
| 216 |
|
); |
| 217 |
0
|
items.add(new KSMenuItemData(getMessage("wrapperPanelTitleWorkflowDocSearch"), Theme.INSTANCE.getCommonImages().getNodeIcon(), |
| 218 |
|
new ClickHandler(){ |
| 219 |
|
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 220 |
0
|
@Override... |
| 221 |
|
public void onClick(ClickEvent event) { |
| 222 |
0
|
buildDocSearchPanel(); |
| 223 |
0
|
docSearchDialog.show(); |
| 224 |
|
}}) |
| 225 |
|
); |
| 226 |
0
|
items.add(new KSMenuItemData(getMessage("wrapperPanelTitleRice"), Theme.INSTANCE.getCommonImages().getRiceIcon(), |
| 227 |
|
new WrapperNavigationHandler( |
| 228 |
|
riceURL+"/portal.do?selectedTab=main")) |
| 229 |
|
); |
| 230 |
|
|
| 231 |
0
|
navDropDown.setShowSelectedItem(true); |
| 232 |
0
|
navDropDown.setItems(items); |
| 233 |
0
|
navDropDown.setArrowImage(Theme.INSTANCE.getCommonImages().getDropDownIconWhite()); |
| 234 |
|
|
| 235 |
|
} |
| 236 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 237 |
0
|
public void setContent(Widget wrappedContent){... |
| 238 |
0
|
content.setWidget(wrappedContent); |
| 239 |
|
} |
| 240 |
|
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
| 241 |
0
|
public void setHeaderCustomLinks(List<KSLabel> links){... |
| 242 |
0
|
for(KSLabel link: links){ |
| 243 |
0
|
FocusPanel panel = new FocusPanel(); |
| 244 |
0
|
panel.setWidget(link); |
| 245 |
|
|
| 246 |
0
|
panel.addStyleName("KS-Wrapper-Header-Custom-Link-Panel"); |
| 247 |
0
|
link.addStyleName("KS-Wrapper-Header-Custom-Link"); |
| 248 |
|
} |
| 249 |
|
} |
| 250 |
|
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 251 |
0
|
public void setFooterLinks(List<KSLabel> links){... |
| 252 |
0
|
for(KSLabel link: links){ |
| 253 |
|
|
| 254 |
0
|
link.addStyleName("KS-Wrapper-Footer-Link"); |
| 255 |
|
} |
| 256 |
|
} |
| 257 |
|
|
| 258 |
|
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
|
| 259 |
0
|
private KSLabel buildLink(final String text, final String title, final String actionUrl) {... |
| 260 |
|
|
| 261 |
|
|
| 262 |
0
|
final KSLabel link = new KSLabel(text); |
| 263 |
0
|
link.addStyleName("KS-Header-Link"); |
| 264 |
0
|
link.setTitle(title); |
| 265 |
0
|
link.addMouseOverHandler(new MouseOverHandler() { |
| 266 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 267 |
0
|
@Override... |
| 268 |
|
public void onMouseOver(MouseOverEvent event) { |
| 269 |
0
|
link.addStyleName("KS-Header-Link-Focus"); |
| 270 |
|
}}); |
| 271 |
|
|
| 272 |
0
|
link.addMouseOutHandler(new MouseOutHandler() { |
| 273 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 274 |
0
|
@Override... |
| 275 |
|
public void onMouseOut(MouseOutEvent event) { |
| 276 |
0
|
link.removeStyleName("KS-Header-Link-Focus"); |
| 277 |
|
|
| 278 |
|
}}); |
| 279 |
0
|
link.addClickHandler(new ClickHandler() { |
| 280 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 281 |
0
|
@Override... |
| 282 |
|
public void onClick(ClickEvent event) { |
| 283 |
0
|
Window.Location.assign(actionUrl); |
| 284 |
|
}}); |
| 285 |
|
|
| 286 |
0
|
return link; |
| 287 |
|
|
| 288 |
|
} |
| 289 |
|
|
| 290 |
|
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 2 |
Complexity Density: 0.18 |
|
| 291 |
0
|
private void buildDocSearchPanel(){... |
| 292 |
0
|
if (docSearch == null){ |
| 293 |
0
|
docSearch = new Frame(); |
| 294 |
0
|
docSearch.setSize("700px", "500px"); |
| 295 |
0
|
docSearch.setUrl(docSearchUrl); |
| 296 |
|
|
| 297 |
0
|
VerticalPanel docSearchPanel = new VerticalPanel(); |
| 298 |
0
|
docSearchPanel.add(docSearch); |
| 299 |
|
|
| 300 |
0
|
KSButton closeActionButton = new KSButton(getMessage("wrapperPanelClose")); |
| 301 |
0
|
closeActionButton.addClickHandler(new ClickHandler(){ |
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 302 |
0
|
public void onClick(ClickEvent event) {... |
| 303 |
0
|
docSearchDialog.hide(); |
| 304 |
|
} |
| 305 |
|
}); |
| 306 |
|
|
| 307 |
0
|
docSearchPanel.add(closeActionButton); |
| 308 |
0
|
docSearchDialog.setWidget(docSearchPanel); |
| 309 |
0
|
docSearchDialog.setSize(750, 550); |
| 310 |
|
} |
| 311 |
|
} |
| 312 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 313 |
0
|
private static String getMessage(final String messageId) {... |
| 314 |
0
|
return Application.getApplicationContext().getMessage(messageId); |
| 315 |
|
} |
| 316 |
|
} |