Update of
/var/cvs/contributions/CMSContainer_Portlets/portlets-googlemap/src/java/com/finalist/portlets/googlemap
In directory
james.mmbase.org:/tmp/cvs-serv25166/portlets-googlemap/src/java/com/finalist/portlets/googlemap
Modified Files:
Tag: b1_4
GoogleMapPortlet.java
Log Message:
CMSC-871 - Updated GoogleMap code: added height & width portlet parameters;
refactored edit screen.
See also:
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer_Portlets/portlets-googlemap/src/java/com/finalist/portlets/googlemap
See also: http://www.mmbase.org/jira/browse/CMSC-871
Index: GoogleMapPortlet.java
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer_Portlets/portlets-googlemap/src/java/com/finalist/portlets/googlemap/GoogleMapPortlet.java,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -u -b -r1.4 -r1.4.2.1
--- GoogleMapPortlet.java 26 Nov 2007 11:42:56 -0000 1.4
+++ GoogleMapPortlet.java 25 Apr 2008 11:56:21 -0000 1.4.2.1
@@ -16,48 +16,59 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-public class GoogleMapPortlet extends CmscPortlet
+public class GoogleMapPortlet extends CmscPortlet {
-{
+ /**
+ * Configuration constants.
+ */
+ public static final String GOOGLE_KEY_PROPERTY = "google.key";
+ public static final String ACTION_PARAM = "action";
+ public static final String WINDOW = "window";
+ public static final String PAGE = "page";
+ public static final String ADDRESS = "address";
+ public static final String INFO = "info";
+ public static final String KEY = "key";
+ public static final String HEIGHT = "height";
+ public static final String WIDTH = "width";
+
+ /**
+ * Configuration default constants.
+ */
+ public static final String HEIGHT_ATTR_DEFAULT = "260px";
+ public static final String WIDTH_ATTR_DEFAULT = "370px";
- private static Log log =
LogFactory.getLog(com.finalist.portlets.googlemap.GoogleMapPortlet.class);
-
- private static final String ACTION_PARAM = "action";
- private static final String WINDOW = "window";
- private static final String PAGE = "page";
- private static final String ADDRESS = "address";
- private static final String INFO = "info";
- private static final String KEY = "key";
-
-
- public GoogleMapPortlet() {
- }
+ private static Log log = LogFactory.getLog(GoogleMapPortlet.class);
protected void doView(RenderRequest request, RenderResponse response)
throws PortletException, IOException {
PortletPreferences preferences = request.getPreferences();
- request.setAttribute("address", preferences.getValue("address", null));
- request.setAttribute("info", preferences.getValue("info", null));
- String key = StringUtils.isEmpty(preferences.getValue("key", null)) ?
PropertiesUtil.getProperty("google.key")
- : preferences.getValue("key", null);
- request.setAttribute("key", key);
+ request.setAttribute(ADDRESS, preferences.getValue(ADDRESS, null));
+ request.setAttribute(INFO, preferences.getValue(INFO, null));
+ request.setAttribute(HEIGHT, preferences.getValue(HEIGHT,
HEIGHT_ATTR_DEFAULT));
+ request.setAttribute(WIDTH, preferences.getValue(WIDTH,
WIDTH_ATTR_DEFAULT));
+
+ String key = StringUtils.isEmpty(preferences.getValue(KEY, null)) ?
PropertiesUtil.getProperty(GOOGLE_KEY_PROPERTY)
+ : preferences.getValue(KEY, null);
+ request.setAttribute(KEY, key);
super.doView(request, response);
}
- public void processEditDefaults(ActionRequest request, ActionResponse
response) throws PortletException, IOException {
- String action = request.getParameter("action");
+ public void processEditDefaults(ActionRequest request, ActionResponse
response) throws PortletException {
+ String action = request.getParameter(ACTION_PARAM);
if (action == null)
response.setPortletMode(CmscPortletMode.EDIT_DEFAULTS);
else if (action.equals("edit")) {
PortletPreferences preferences = request.getPreferences();
String portletId =
preferences.getValue("com.finalist.cmsc.beans.om.portletId", null);
if (portletId != null) {
- setPortletParameter(portletId, "address",
request.getParameter("address"));
- setPortletParameter(portletId, "info",
request.getParameter("info"));
- setPortletParameter(portletId, "window",
request.getParameter("window"));
- setPortletParameter(portletId, "key", request.getParameter("key"));
- setPortletNodeParameter(portletId, "page",
request.getParameter("page"));
+ setPortletParameter(portletId, ADDRESS,
request.getParameter(ADDRESS));
+ setPortletParameter(portletId, INFO, request.getParameter(INFO));
+ setPortletParameter(portletId, WINDOW,
request.getParameter(WINDOW));
+ setPortletParameter(portletId, KEY, request.getParameter(KEY));
+ setPortletParameter(portletId, WIDTH, request.getParameter(WIDTH));
+ setPortletParameter(portletId, HEIGHT,
request.getParameter(HEIGHT));
+ setPortletNodeParameter(portletId, PAGE,
request.getParameter(PAGE));
}
else if (log.isDebugEnabled())
log.error((new StringBuilder()).append("Unknown action:
'").append(action).append("'").toString());
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs