From 671708d240a998f33b32c9759270312ff5c83697 Mon Sep 17 00:00:00 2001 From: Marc Englund Date: Tue, 15 Apr 2008 09:16:32 +0000 Subject: [PATCH] Strange Liferay / Portlet problem fixed, intermediate commit. svn changeset:4177/svn branch:trunk --- WebContent/WEB-INF/liferay-display.xml | 6 ++--- WebContent/WEB-INF/liferay-portlet.xml | 6 ++--- WebContent/WEB-INF/portlet.xml | 12 +++++----- WebContent/WEB-INF/web.xml | 15 +++++++++++- .../com/itmill/toolkit/demo/PortletDemo.java | 23 +++++++++++++------ ...let.java => ITMillApplicationPortlet.java} | 8 ++----- 6 files changed, 44 insertions(+), 26 deletions(-) rename portlet-src/com/itmill/toolkit/terminal/gwt/server/{ApplicationPortlet.java => ITMillApplicationPortlet.java} (90%) diff --git a/WebContent/WEB-INF/liferay-display.xml b/WebContent/WEB-INF/liferay-display.xml index 8ba4a93f7f..c0a3308aa3 100644 --- a/WebContent/WEB-INF/liferay-display.xml +++ b/WebContent/WEB-INF/liferay-display.xml @@ -3,8 +3,8 @@ - - - + + + \ No newline at end of file diff --git a/WebContent/WEB-INF/liferay-portlet.xml b/WebContent/WEB-INF/liferay-portlet.xml index d445af65a7..d863fdac60 100644 --- a/WebContent/WEB-INF/liferay-portlet.xml +++ b/WebContent/WEB-INF/liferay-portlet.xml @@ -4,17 +4,17 @@ - PortletDemo + PortletDemoPortlet true false - Calc + CalcPortlet true false - FeatureBrowser + FeatureBrowserPortlet true false diff --git a/WebContent/WEB-INF/portlet.xml b/WebContent/WEB-INF/portlet.xml index e0b00b5dae..dc48102bc5 100644 --- a/WebContent/WEB-INF/portlet.xml +++ b/WebContent/WEB-INF/portlet.xml @@ -5,9 +5,9 @@ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"> - PortletDemo + PortletDemoPortlet IT Mill Toolkit PortletDemo - com.itmill.toolkit.terminal.gwt.server.ApplicationPortlet + com.itmill.toolkit.terminal.gwt.server.ITMillApplicationPortlet application PortletDemo @@ -37,9 +37,9 @@ - FeatureBrowser + FeatureBrowserPortlet IT Mill Toolkit FeatureBrowser - com.itmill.toolkit.terminal.gwt.server.ApplicationPortlet + com.itmill.toolkit.terminal.gwt.server.ITMillApplicationPortlet application FeatureBrowser @@ -69,9 +69,9 @@ - Calc + CalcPortlet IT Mill Toolkit Calc - com.itmill.toolkit.terminal.gwt.server.ApplicationPortlet + com.itmill.toolkit.terminal.gwt.server.ITMillApplicationPortlet application Calc diff --git a/WebContent/WEB-INF/web.xml b/WebContent/WEB-INF/web.xml index 78508e6b67..02817d0816 100644 --- a/WebContent/WEB-INF/web.xml +++ b/WebContent/WEB-INF/web.xml @@ -20,7 +20,7 @@ testingToolsServerUri - http://192.168.1.120:8099/TestingToolsServer + http://192.168.1.242:8099/TestingToolsServer IT Mill Testing Tools URI @@ -383,6 +383,19 @@ com.itmill.toolkit.demo.WindowedDemos + + + PortletDemo + com.itmill.toolkit.terminal.gwt.server.ApplicationServlet + + application + com.itmill.toolkit.demo.PortletDemo + + + + PortletDemo + /PortletDemo/* + ITMillToolkitApplicationRunner diff --git a/portlet-src/com/itmill/toolkit/demo/PortletDemo.java b/portlet-src/com/itmill/toolkit/demo/PortletDemo.java index d519874812..98859653f0 100644 --- a/portlet-src/com/itmill/toolkit/demo/PortletDemo.java +++ b/portlet-src/com/itmill/toolkit/demo/PortletDemo.java @@ -37,10 +37,8 @@ public class PortletDemo extends Application { tf.setEnabled(false); main.addComponent(tf); - portletEdit.setCaption("Portlet edit/view"); portletEdit.setEnabled(false); main.addComponent(portletEdit); - portletMax.setCaption("Maximize/normal portlet"); portletMax.setEnabled(false); main.addComponent(portletMax); @@ -48,7 +46,8 @@ public class PortletDemo extends Application { PortletApplicationContext ctx = (PortletApplicationContext) getContext(); ctx.addPortletListener(this, new DemoPortletListener()); } else { - getMainWindow().showNotification("Not inited via Portal!"); + getMainWindow().showNotification("Not inited via Portal!", + Notification.TYPE_ERROR_MESSAGE); } } @@ -64,11 +63,15 @@ public class PortletDemo extends Application { public void handleRenderRequest(RenderRequest request, RenderResponse response) { + portletEdit.setEnabled(true); + portletMax.setEnabled(true); + tf.setEnabled((request.getPortletMode() == PortletMode.EDIT)); + getMainWindow().showNotification( "Portlet status", - "mode: " + request.getPortletMode() + "
state: " + "Mode: " + request.getPortletMode() + " State: " + request.getWindowState(), - Notification.TYPE_TRAY_NOTIFICATION); + Notification.TYPE_WARNING_MESSAGE); PortletURL url = response.createActionURL(); try { @@ -76,6 +79,9 @@ public class PortletDemo extends Application { .setPortletMode((request.getPortletMode() == PortletMode.VIEW ? PortletMode.EDIT : PortletMode.VIEW)); portletEdit.setResource(new ExternalResource(url.toString())); + portletEdit + .setCaption((request.getPortletMode() == PortletMode.VIEW ? "Edit" + : "Done")); } catch (Exception e) { portletEdit.setEnabled(false); } @@ -85,9 +91,12 @@ public class PortletDemo extends Application { url .setWindowState((request.getWindowState() == WindowState.NORMAL ? WindowState.MAXIMIZED : WindowState.NORMAL)); - portletEdit.setResource(new ExternalResource(url.toString())); + portletMax.setResource(new ExternalResource(url.toString())); + portletMax + .setCaption((request.getWindowState() == WindowState.NORMAL ? "Maximize" + : "Back to normal")); } catch (Exception e) { - portletEdit.setEnabled(false); + portletMax.setEnabled(false); } } diff --git a/portlet-src/com/itmill/toolkit/terminal/gwt/server/ApplicationPortlet.java b/portlet-src/com/itmill/toolkit/terminal/gwt/server/ITMillApplicationPortlet.java similarity index 90% rename from portlet-src/com/itmill/toolkit/terminal/gwt/server/ApplicationPortlet.java rename to portlet-src/com/itmill/toolkit/terminal/gwt/server/ITMillApplicationPortlet.java index 5a924cd41a..7c744dc4c2 100644 --- a/portlet-src/com/itmill/toolkit/terminal/gwt/server/ApplicationPortlet.java +++ b/portlet-src/com/itmill/toolkit/terminal/gwt/server/ITMillApplicationPortlet.java @@ -15,7 +15,7 @@ import javax.portlet.RenderResponse; import com.itmill.toolkit.Application; -public class ApplicationPortlet implements Portlet { +public class ITMillApplicationPortlet implements Portlet { // The application to show protected String app = "Calc"; // some applications might require that the height is specified @@ -61,10 +61,7 @@ public class ApplicationPortlet implements Portlet { response.setContentType("text/html"); PrintWriter out = response.getWriter(); - out.println("

WTF?

"); - if (app != null) { - System.err.println("WTFFF???"); PortletSession sess = request.getPortletSession(); PortletApplicationContext ctx = PortletApplicationContext .getApplicationContext(sess); @@ -78,8 +75,7 @@ public class ApplicationPortlet implements Portlet { -*/ PortletRequestDispatcher dispatcher = sess.getPortletContext() - .getRequestDispatcher( - "/" + request.getContextPath() + "/" + app); + .getRequestDispatcher("/" + app); try { // TODO remove: -- 2.39.5