/** Does all the prep work before showing the form */ @RequestMapping(params = "action=addAnnouncement") public String showAddAnnouncementForm( @RequestParam(value = "editId", required = false) Long editId, @RequestParam(value = "topicId", required = false) Long topicId, RenderRequest request, Model model) throws PortletException { PortletPreferences prefs = request.getPreferences(); if (!model.containsAttribute("announcement")) { Announcement ann = new Announcement(); Topic topic = null; if (editId != null) { try { log.debug( "editId found. This is an edit request for announcement Id " + editId.toString()); ann = announcementService.getAnnouncement(editId); // return immediately when we have our announcement } catch (NumberFormatException e) { log.debug("No editId found. This is not an edit request"); } } if (ann != null && ann.getParent() == null) { try { topic = announcementService.getTopic(topicId); ann.setParent(topic); } catch (NumberFormatException e) { log.error("Unable to get topicId from request"); } } model.addAttribute("announcement", ann); } model.addAttribute("datePickerFormat", datePickerFormat); model.addAttribute( "abstractMaxLength", prefs.getValue(PREFERENCE_ABSTRACT_MAX_LENGTH, DEFAULT_ABSTRACT_MAX_LENGTH)); model.addAttribute( "tinyMceInitializationOptions", prefs.getValue( PREFERENCE_TINY_MCE_INITIALIZATION_OPTIONS, DEFAULT_TINY_MCE_INITIALIZATION_OPTIONS)); return "addAnnouncement"; }
public boolean getAllowEmptyMessage(PortletRequest req) { PortletPreferences prefs = req.getPreferences(); return Boolean.parseBoolean(prefs.getValue(PREFERENCE_ALLOW_EMPTY_MESSAGE, "false")); }
public boolean getAllowOpenEndDate(PortletRequest req) { PortletPreferences prefs = req.getPreferences(); return Boolean.parseBoolean(prefs.getValue(PREFERENCE_ALLOW_OPEN_ENDDATE, "false")); }
// set the Portlet's default View public void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException { PortletPreferences prefs = renderRequest.getPreferences(); String typeUtility = (String) prefs.getValue("typeUtility", ""); String chkStreetView = (String) prefs.getValue("chkStreetView", ""); log.info("chkStreetView: " + chkStreetView); String chkZoom = (String) prefs.getValue("chkZoom", ""); log.info("chkZoom: " + chkZoom); String chkDraggable = (String) prefs.getValue("chkDraggable", ""); log.info("chkDraggable: " + chkDraggable); String chkPanControl = (String) prefs.getValue("chkPanControl", ""); log.info("chkPanControl: " + chkPanControl); String chkRotateControl = (String) prefs.getValue("chkRotateControl", ""); log.info("chkRotateControl: " + chkRotateControl); String chkScaleControl = (String) prefs.getValue("chkScaleControl", ""); log.info("chkScaleControl: " + chkScaleControl); String typeMap = (String) prefs.getValue("typeMap", ""); String address = (String) prefs.getValue("address", ""); String descriptionMarker = (String) prefs.getValue("descriptionMarker", ""); String typeIcon = (String) prefs.getValue("typeIcon", ""); String fromAddress = (String) prefs.getValue("fromAddress", ""); String toAddress = (String) prefs.getValue("toAddress", ""); String notDefinedMessage = (String) prefs.getValue("notDefinedMessage", ""); /* Default value */ if (typeUtility.equals("")) { notDefinedMessage = "click on Preferences"; renderRequest.setAttribute("notDefinedMessage", notDefinedMessage); } else if (typeUtility.equals("OneMarker")) { renderRequest.setAttribute("typeUtility", typeUtility); renderRequest.setAttribute("chkStreetView", chkStreetView); renderRequest.setAttribute("chkZoom", chkZoom); renderRequest.setAttribute("chkDraggable", chkDraggable); renderRequest.setAttribute("chkPanControl", chkPanControl); renderRequest.setAttribute("chkRotateControl", chkRotateControl); renderRequest.setAttribute("chkScaleControl", chkScaleControl); renderRequest.setAttribute("typeMap", typeMap); renderRequest.setAttribute("address", address); renderRequest.setAttribute("descriptionMarker", descriptionMarker); renderRequest.setAttribute("typeIcon", typeIcon); renderRequest.setAttribute("fromAddress", null); renderRequest.setAttribute("toAddress", null); renderRequest.setAttribute("notDefinedMessage", new String("")); } else if (typeUtility.equals("GetRoute")) { renderRequest.setAttribute("typeUtility", typeUtility); renderRequest.setAttribute("chkStreetView", chkStreetView); renderRequest.setAttribute("chkZoom", chkZoom); renderRequest.setAttribute("chkDraggable", chkDraggable); renderRequest.setAttribute("chkPanControl", chkPanControl); renderRequest.setAttribute("chkRotateControl", chkRotateControl); renderRequest.setAttribute("chkScaleControl", chkScaleControl); renderRequest.setAttribute("typeMap", typeMap); renderRequest.setAttribute("address", null); renderRequest.setAttribute("descriptionMarker", null); renderRequest.setAttribute("typeIcon", null); renderRequest.setAttribute("fromAddress", fromAddress); renderRequest.setAttribute("toAddress", toAddress); renderRequest.setAttribute("notDefinedMessage", new String("")); } include(viewJSP, renderRequest, renderResponse); }