Author: xlawrence
Date: Wed Jan 16 13:38:17 2008
New Revision: 19527
URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D19527&repname=
=3Djahia
Log:
Added a tag in order to be able to declare a Resource bundle without using =
scriptlets
Added:
branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/decla=
rations/DeclareResourceBundleTag.java
Modified:
branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/webapp/WEB-INF/etc/taglibs/j=
ahia-components.tld
Added: branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/de=
clarations/DeclareResourceBundleTag.java
URL: https://svndev.jahia.net/websvn/filedetails.php?path=3D/branches/JAHIA=
-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/declarations/DeclareRes=
ourceBundleTag.java&rev=3D19527&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/decla=
rations/DeclareResourceBundleTag.java (added)
+++ branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/java/org/jahia/taglibs/decla=
rations/DeclareResourceBundleTag.java Wed Jan 16 13:38:17 2008
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2002-2006 Jahia Ltd
+ *
+ * Licensed under the JAHIA COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (J=
CDDL),
+ * Version 1.0 (the "License"), or (at your option) any later version; you=
may
+ * not use this file except in compliance with the License. You should have
+ * received a copy of the License along with this program; if not, you may=
obtain
+ * a copy of the License at
+ *
+ * http://www.jahia.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jahia.taglibs.declarations;
+
+import org.jahia.exceptions.JahiaException;
+import org.jahia.registries.ServicesRegistry;
+import org.jahia.taglibs.AbstractJahiaTag;
+
+/**
+ * @author Xavier Lawrence
+ */
+public class DeclareResourceBundleTag extends AbstractJahiaTag {
+
+ private static transient final org.apache.log4j.Logger logger =3D
+ org.apache.log4j.Logger.getLogger(DeclareResourceBundleTag.cla=
ss);
+
+ private String resBundleID;
+ private String resourceBundleName;
+
+ public String getResBundleID() {
+ return resBundleID;
+ }
+
+ public void setResBundleID(final String resBundleID) {
+ this.resBundleID =3D resBundleID;
+ }
+
+ public String getResourceBundleName() {
+ return resourceBundleName;
+ }
+
+ public void setResourceBundleName(final String resourceBundleName) {
+ this.resourceBundleName =3D resourceBundleName;
+ }
+
+ public int doStartTag() {
+ try {
+ final StringBuffer resBundleDef =3D new StringBuffer("");
+ resBundleDef.append("<jahia-res-bundle id=3D");
+ resBundleDef.append(resBundleID);
+ resBundleDef.append(" resbundle=3D\"").append(resourceBundleNa=
me).append("\">");
+ ServicesRegistry.getInstance().getResourceBundleService()
+ .declareResourceBundleDefinition(resBundleID, resource=
BundleName);
+ } catch (final JahiaException e) {
+ logger.error("Unable to declare the Resource Bundle", e);
+ }
+ return SKIP_BODY;
+ }
+}
Modified: branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/webapp/WEB-INF/etc/tag=
libs/jahia-components.tld
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-INCLUD=
E-TAG-BRANCH/core/src/webapp/WEB-INF/etc/taglibs/jahia-components.tld&rev=
=3D19527&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/webapp/WEB-INF/etc/taglibs/j=
ahia-components.tld (original)
+++ branches/JAHIA-INCLUDE-TAG-BRANCH/core/src/webapp/WEB-INF/etc/taglibs/j=
ahia-components.tld Wed Jan 16 13:38:17 2008
@@ -45,7 +45,7 @@
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
- =
+
</tag>
=
<tag>
@@ -443,4 +443,20 @@
</attribute>
</tag>
=
+ <tag>
+ <name>resourceBundle</name>
+ <tagclass>org.jahia.taglibs.declarations.DeclareResourceBundleTag<=
/tagclass>
+ <info>Declares a resource bundle</info>
+ <attribute>
+ <name>resBundleID</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>resourceBundleName</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+
</taglib>
\ No newline at end of file
_______________________________________________
cvs_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/cvs_list