[jboss-svn-commits] JBL Code SVN: r5225 - in labs/jbossforums/trunk/forums/src: main/org/jboss/portlet/forums/ui main/org/jboss/portlet/forums/ui/action main/org/jboss/portlet/forums/ui/event resources/portal-forums-war/WEB-INF/classes
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Jul 21 16:16:52 EDT 2006
Author: unibrew
Date: 2006-07-21 16:16:46 -0400 (Fri, 21 Jul 2006)
New Revision: 5225
Modified:
labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/DownloadFilter.java
labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java
labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/ModeratorAction.java
labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/SplitTopic.java
labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/TopicWatchController.java
labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/event/BeginTransactionListener.java
labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/event/EndTransactionListener.java
labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF.properties
Log:
[JBFORUMS-102] Repairing messages in java files of Forums.
Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/DownloadFilter.java
===================================================================
--- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/DownloadFilter.java 2006-07-21 19:23:55 UTC (rev 5224)
+++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/DownloadFilter.java 2006-07-21 20:16:46 UTC (rev 5225)
@@ -1,11 +1,25 @@
-/*****************************************
- * *
- * JBoss Portal: The OpenSource Portal *
- * *
- * Distributable under LGPL license. *
- * See terms of license at gnu.org. *
- * *
- *****************************************/
+ /*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
package org.jboss.portlet.forums.ui;
import java.io.IOException;
Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java
===================================================================
--- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java 2006-07-21 19:23:55 UTC (rev 5224)
+++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/PortalUtil.java 2006-07-21 20:16:46 UTC (rev 5225)
@@ -362,7 +362,7 @@
{
StringWriter stringWriter = new StringWriter();
getToHTMLRenderer(req).setWriter(stringWriter);
- System.out.println("REQ: "+req+" TEXT: "+text);
+ System.out.println("REQ: "+req+" TEXT: "+text+" TOHTMLREND: "+getToHTMLRenderer(req));
getToHTMLRenderer(req).render(text.toCharArray(), 0, text.length());
return stringWriter.toString();
}
@@ -395,6 +395,7 @@
ToHTMLConfig config = new ToHTMLConfig();
config.setLoader(loader);
renderer = new ToHTMLRenderer(config, bundle);
+ System.out.println("config: "+config+" loader:"+loader+" render"+renderer);
if (porReq!=null) {
porReq.getPortletSession().setAttribute("RENDERER", renderer);
} else if (serReq!=null){
Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/ModeratorAction.java
===================================================================
--- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/ModeratorAction.java 2006-07-21 19:23:55 UTC (rev 5224)
+++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/ModeratorAction.java 2006-07-21 20:16:46 UTC (rev 5225)
@@ -68,8 +68,6 @@
private Map topicNavigator = new HashMap();
private Map checkboxes;
- private ResourceBundle bundle;
-
// Page navigation methods
/**
*
@@ -162,15 +160,11 @@
}
} catch(Exception e)
{
- message = bundle.getString("ERR_CANNOT_REMOVE_TOPIC");
- FacesContext.getCurrentInstance().addMessage("message",
- new FacesMessage(FacesMessage.SEVERITY_WARN,message,"moderate"));
+ setWarnBundleMessage("ERR_CANNOT_REMOVE_TOPIC");
return "success";
}
}
- message = bundle.getString("SUCC_TOPIC_REMOVED");
- FacesContext.getCurrentInstance().addMessage("message",
- new FacesMessage(FacesMessage.SEVERITY_INFO,message, "moderate"));
+ setInfoBundleMessage("SUCC_TOPIC_REMOVED");
} catch (Exception e)
{
@@ -190,9 +184,7 @@
String forum_to_id = ForumUtil.getParameter(Constants.p_forum_to_id);
if (forum_to_id==null || forum_to_id.trim().length()==0 || forum_to_id.trim().compareToIgnoreCase("-1")==0)
{
- message = bundle.getString("ERR_NO_DEST_FORUM");
- FacesContext.getCurrentInstance().addMessage("message",
- new FacesMessage(FacesMessage.SEVERITY_WARN,message,"moderate"));
+ setWarnBundleMessage("ERR_NO_DEST_FORUM");
return "success";
}
Forum forumDest=null;
@@ -200,9 +192,7 @@
forumDest = this.getForumsModule().findForumById(new Integer(forum_to_id));
} catch (Exception e)
{
- message = bundle.getString("ERR_INTERNAL");
- FacesContext.getCurrentInstance().addMessage("message",
- new FacesMessage(FacesMessage.SEVERITY_WARN,message,"moderate"));
+ setWarnBundleMessage("ERR_INTERNAL");
return "success";
}
Iterator it = checkboxes.keySet().iterator();
@@ -218,18 +208,15 @@
topic = getForumsModule().findTopicById(topicId);
} catch(Exception e)
{
- message = bundle.getString("ERR_INTERNAL");
- FacesContext.getCurrentInstance().addMessage("message",
- new FacesMessage(FacesMessage.SEVERITY_WARN,message,"moderate"));
+ setWarnBundleMessage("ERR_INTERNAL");
return "success";
}
forumDest.addTopic(topic);
getForumsModule().getHibernate().getSessionFactory().getCurrentSession().flush();
}
}
- message = bundle.getString("SUCC_TOPIC_MOVED");
- FacesContext.getCurrentInstance().addMessage("message",
- new FacesMessage(FacesMessage.SEVERITY_INFO,message, "moderate"));
+ setInfoBundleMessage("SUCC_TOPIC_MOVED");
+
} catch (Exception e)
{
JSFUtil.handleException(e);
@@ -262,15 +249,12 @@
}
} catch(Exception e)
{
- message = bundle.getString("ERR_INTERNAL");
- FacesContext.getCurrentInstance().addMessage("message",
- new FacesMessage(FacesMessage.SEVERITY_WARN,message,"moderate"));
+ setWarnBundleMessage("ERR_INTERNAL");
return "";
}
}
- message = bundle.getString("SUCC_TOPIC_LOCKED");
- FacesContext.getCurrentInstance().addMessage("message",
- new FacesMessage(FacesMessage.SEVERITY_INFO,message, "moderate"));
+ setInfoBundleMessage("SUCC_TOPIC_LOCKED");
+
} catch (Exception e)
{
JSFUtil.handleException(e);
@@ -278,9 +262,7 @@
return "";
} else
{
- String message = bundle.getString("None_selected");
- FacesContext.getCurrentInstance().addMessage("message",
- new FacesMessage(FacesMessage.SEVERITY_WARN,message,"moderate"));
+ setWarnBundleMessage("None_selected");
return "";
}
@@ -311,15 +293,12 @@
}
} catch(Exception e)
{
- message = bundle.getString("ERR_INTERNAL");
- FacesContext.getCurrentInstance().addMessage("message",
- new FacesMessage(FacesMessage.SEVERITY_WARN,message,"moderate"));
+ setWarnBundleMessage("ERR_INTERNAL");
return "";
}
}
- message = bundle.getString("SUCC_TOPIC_UNLOCKED");
- FacesContext.getCurrentInstance().addMessage("message",
- new FacesMessage(FacesMessage.SEVERITY_INFO,message, "moderate"));
+ setInfoBundleMessage("SUCC_TOPIC_UNLOCKED");
+
} catch (Exception e)
{
JSFUtil.handleException(e);
@@ -327,9 +306,7 @@
return "";
} else
{
- String message = bundle.getString("None_selected");
- FacesContext.getCurrentInstance().addMessage("message",
- new FacesMessage(FacesMessage.SEVERITY_WARN,message,"moderate"));
+ setWarnBundleMessage("None_selected");
return "";
}
}
@@ -347,9 +324,7 @@
return "confirmDelete";
} else
{
- String message = bundle.getString("None_selected");
- FacesContext.getCurrentInstance().addMessage("message",
- new FacesMessage(FacesMessage.SEVERITY_WARN,message,"moderate"));
+ setWarnBundleMessage("None_selected");
return "";
}
}
@@ -367,9 +342,7 @@
return "confirmMove";
} else
{
- String message = bundle.getString("None_selected");
- FacesContext.getCurrentInstance().addMessage("message",
- new FacesMessage(FacesMessage.SEVERITY_WARN,message,"moderate"));
+ setWarnBundleMessage("None_selected");
return "";
}
}
@@ -426,16 +399,7 @@
}
private void execute() throws Exception
- {
- if (this.bundle == null) {
- // Getting ResourceBundle with current Locale
- FacesContext ctx = FacesContext.getCurrentInstance();
- UIViewRoot uiRoot = ctx.getViewRoot();
- Locale locale = uiRoot.getLocale();
- ClassLoader ldr = Thread.currentThread().getContextClassLoader();
- this.bundle = ResourceBundle.getBundle("ResourceJSF", locale, ldr);
- }
-
+ {
int currentPage = 0;
//parse the input parameters
String pageParam = ForumUtil.getParameter(Constants.p_page);
@@ -487,9 +451,19 @@
}
}
}
-
+ private void setWarnBundleMessage(String bundleKey) {
+ String message = JSFUtil.getBundleMessage("ResourceJSF",bundleKey);
+ FacesContext.getCurrentInstance().addMessage("message",
+ new FacesMessage(FacesMessage.SEVERITY_WARN,message, "moderate"));
+ }
+ private void setInfoBundleMessage(String bundleKey) {
+ String message = JSFUtil.getBundleMessage("ResourceJSF",bundleKey);
+ FacesContext.getCurrentInstance().addMessage("message",
+ new FacesMessage(FacesMessage.SEVERITY_INFO,message, "moderate"));
+ }
+
//-------------------------------------------------------------------------------------------------------------------------------------
Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/SplitTopic.java
===================================================================
--- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/SplitTopic.java 2006-07-21 19:23:55 UTC (rev 5224)
+++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/SplitTopic.java 2006-07-21 20:16:46 UTC (rev 5225)
@@ -58,7 +58,6 @@
// Topic to split
private Topic topic;
- private ResourceBundle bundle;
// ---------- Getters And Setters for bean's attributes --------------------
@@ -301,16 +300,7 @@
* @throws Exception
*/
private void execute() throws Exception
- {
- if ( this.bundle == null ) {
- // Getting ResourceBundle with current Locale
- FacesContext ctx = FacesContext.getCurrentInstance();
- UIViewRoot uiRoot = ctx.getViewRoot();
- Locale locale = uiRoot.getLocale();
- ClassLoader ldr = Thread.currentThread().getContextClassLoader();
- this.bundle = ResourceBundle.getBundle("ResourceJSF", locale, ldr);
- }
-
+ {
//parse input data
int topicId = -1;
String t = ForumUtil.getParameter(Constants.p_topicId);
@@ -329,13 +319,13 @@
}
private void setWarnBundleMessage(String bundleKey) {
- String message = bundle.getString(bundleKey);
+ String message = JSFUtil.getBundleMessage("ResourceJSF",bundleKey);
FacesContext.getCurrentInstance().addMessage("message",
new FacesMessage(FacesMessage.SEVERITY_WARN,message, "moderate"));
}
private void setInfoBundleMessage(String bundleKey) {
- String message = bundle.getString(bundleKey);
+ String message = JSFUtil.getBundleMessage("ResourceJSF",bundleKey);
FacesContext.getCurrentInstance().addMessage("message",
new FacesMessage(FacesMessage.SEVERITY_INFO,message, "moderate"));
}
Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/TopicWatchController.java
===================================================================
--- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/TopicWatchController.java 2006-07-21 19:23:55 UTC (rev 5224)
+++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/TopicWatchController.java 2006-07-21 20:16:46 UTC (rev 5225)
@@ -59,7 +59,7 @@
String t = JSFUtil.getRequestParameter(Constants.p_topicId);
int topicId = Integer.parseInt(t);
- System.out.println("Successfully activated watch for---"+topicId);
+ //System.out.println("Successfully activated watch for---"+topicId);
return navState;
}
@@ -75,7 +75,7 @@
String t = JSFUtil.getRequestParameter(Constants.p_topicId);
int topicId = Integer.parseInt(t);
- System.out.println("Successfully deActivated watch for---"+topicId);
+ //System.out.println("Successfully deActivated watch for---"+topicId);
return navState;
}
Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/event/BeginTransactionListener.java
===================================================================
--- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/event/BeginTransactionListener.java 2006-07-21 19:23:55 UTC (rev 5224)
+++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/event/BeginTransactionListener.java 2006-07-21 20:16:46 UTC (rev 5225)
@@ -45,6 +45,8 @@
*/
private InitialContext ctx = null;
+ private static final String USER_TRANSACTION_JNDI="java:comp/UserTransaction";
+
/**
*
*/
@@ -76,7 +78,7 @@
//handle transactions in a non-portal environment
try
{
- UserTransaction tx = (UserTransaction) ctx.lookup("java:comp/UserTransaction");
+ UserTransaction tx = (UserTransaction) ctx.lookup(USER_TRANSACTION_JNDI);
tx.begin();
}
catch (Throwable t)
Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/event/EndTransactionListener.java
===================================================================
--- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/event/EndTransactionListener.java 2006-07-21 19:23:55 UTC (rev 5224)
+++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/event/EndTransactionListener.java 2006-07-21 20:16:46 UTC (rev 5225)
@@ -45,6 +45,8 @@
*/
private InitialContext ctx = null;
+ private static final String USER_TRANSACTION_JNDI="java:comp/UserTransaction";
+
/**
*
*/
@@ -85,7 +87,7 @@
{
try
{
- tx = (UserTransaction) ctx.lookup("java:comp/UserTransaction");
+ tx = (UserTransaction) ctx.lookup(USER_TRANSACTION_JNDI);
tx.setRollbackOnly();
}
catch(Throwable t)
@@ -100,7 +102,7 @@
//handle transactions in a non-portal environment
try
{
- tx = (UserTransaction) ctx.lookup("java:comp/UserTransaction");
+ tx = (UserTransaction) ctx.lookup(USER_TRANSACTION_JNDI);
//check if an error occurred and transaction should be rolled back
if(JSFUtil.isErrorOccurred())
{
Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF.properties
===================================================================
--- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF.properties 2006-07-21 19:23:55 UTC (rev 5224)
+++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/classes/ResourceJSF.properties 2006-07-21 20:16:46 UTC (rev 5225)
@@ -1573,6 +1573,9 @@
Edit_forum=Edit forum
Create_forum=Create new forum
Create_category=Create new category
+Category_created=The Category \"{0}\" was successfully created.
+Category_updated=The Category \"{0}\" was successfully updated.
+Category_deleted=The Category \"{0}\" was successfully deleted.
Remove=Remove
Action=Action
Update_order=Update Order
More information about the jboss-svn-commits
mailing list