Author: nbelaevski
Date: 2009-05-04 10:49:24 -0400 (Mon, 04 May 2009)
New Revision: 14005
Added:
trunk/framework/api/src/main/java/org/richfaces/skin/ThemeNotFoundException.java
Modified:
trunk/framework/api/src/main/java/org/ajax4jsf/Messages.java
trunk/framework/impl/src/main/java/org/richfaces/skin/SkinFactoryImpl.java
trunk/framework/impl/src/main/resources/org/ajax4jsf/messages.properties
Log:
https://jira.jboss.org/jira/browse/RF-6939
Modified: trunk/framework/api/src/main/java/org/ajax4jsf/Messages.java
===================================================================
--- trunk/framework/api/src/main/java/org/ajax4jsf/Messages.java 2009-05-04 13:39:21 UTC
(rev 14004)
+++ trunk/framework/api/src/main/java/org/ajax4jsf/Messages.java 2009-05-04 14:49:24 UTC
(rev 14005)
@@ -288,6 +288,7 @@
public static final String DEFAULT_PROPERTIES_NOT_FOUND_ERROR =
"DEFAULT_PROPERTIES_NOT_FOUND_ERROR";
public static final String SKIN_PROPERTIES_IO_ERROR =
"SKIN_PROPERTIES_IO_ERROR";
public static final String SKIN_NOT_FOUND_ERROR = "SKIN_NOT_FOUND_ERROR";
+ public static final String THEME_NOT_FOUND_ERROR = "THEME_NOT_FOUND_ERROR";
public static final String ACESSING_SKIN_PROPERTY_AS_ARRAY_ERROR =
"ACESSING_SKIN_PROPERTY_AS_ARRAY_ERROR";
public static final String ACESSING_SKIN_PROPERTY_ERROR =
"ACESSING_SKIN_PROPERTY_ERROR";
public static final String SKIN_PROPERTIES_READ_ONLY_ERROR =
"SKIN_PROPERTIES_READ_ONLY_ERROR";
@@ -364,7 +365,7 @@
public static final String DATASCROLLER_PAGE_MISSING =
"DATASCROLLER_PAGE_MISSING";
public static final String DATASCROLLER_PAGES_DIFFERENT =
"DATASCROLLER_PAGES_DIFFERENT";
public static final String COMPONENT_CONVERSION_ERROR =
"COMPONENT_CONVERSION_ERROR";
-
+
public static void main(String[] args) {
String m = getMessage(INVALID_ATTRIBUTE_VALUE, "A", "B");
System.out.println(m);
Added: trunk/framework/api/src/main/java/org/richfaces/skin/ThemeNotFoundException.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/skin/ThemeNotFoundException.java
(rev 0)
+++
trunk/framework/api/src/main/java/org/richfaces/skin/ThemeNotFoundException.java 2009-05-04
14:49:24 UTC (rev 14005)
@@ -0,0 +1,49 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.skin;
+
+import javax.faces.FacesException;
+
+public class ThemeNotFoundException extends FacesException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 2245209384496054860L;
+
+ public ThemeNotFoundException() {
+ super();
+ }
+
+ public ThemeNotFoundException(String arg0) {
+ super(arg0);
+ }
+
+ public ThemeNotFoundException(Throwable arg0) {
+ super(arg0);
+ }
+
+ public ThemeNotFoundException(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+ }
+
+}
Modified: trunk/framework/impl/src/main/java/org/richfaces/skin/SkinFactoryImpl.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/skin/SkinFactoryImpl.java 2009-05-04
13:39:21 UTC (rev 14004)
+++ trunk/framework/impl/src/main/java/org/richfaces/skin/SkinFactoryImpl.java 2009-05-04
14:49:24 UTC (rev 14005)
@@ -24,7 +24,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
-import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
@@ -370,7 +369,13 @@
public Theme getTheme(FacesContext facesContext, String name) {
Theme theme = themes.get(name);
if(null == theme){
- Properties properties = loadProperties(name, THEME_PATHS);
+ Properties properties;
+ try {
+ properties = loadProperties(name, THEME_PATHS);
+ } catch (SkinNotFoundException e) {
+ throw new ThemeNotFoundException(Messages.getMessage(
+ Messages.THEME_NOT_FOUND_ERROR, name), e.getCause());
+ }
processProperties(facesContext, properties);
theme = new ThemeImpl(properties);
themes.put(name, theme);
Modified: trunk/framework/impl/src/main/resources/org/ajax4jsf/messages.properties
===================================================================
--- trunk/framework/impl/src/main/resources/org/ajax4jsf/messages.properties 2009-05-04
13:39:21 UTC (rev 14004)
+++ trunk/framework/impl/src/main/resources/org/ajax4jsf/messages.properties 2009-05-04
14:49:24 UTC (rev 14005)
@@ -180,8 +180,9 @@
NULL_SKIN_NAME_ERROR=Name for current Skin calculated as null
CREATE_SKIN_INFO=Create new Skin instance for name {0}
DEFAULT_PROPERTIES_NOT_FOUND_ERROR=Default properties for skin not found in {0}
-SKIN_PROPERTIES_IO_ERROR=Attempt to load Skin property file caused IOError
+SKIN_PROPERTIES_IO_ERROR=Attempt to load property file caused IOError
SKIN_NOT_FOUND_ERROR=Skin with name {0} not found
+THEME_NOT_FOUND_ERROR=Theme with name {0} not found
ACESSING_SKIN_PROPERTY_AS_ARRAY_ERROR=Attempt to access to skin property as array
ACESSING_SKIN_PROPERTY_ERROR=Attempt to access to skin property not as string parameter
SKIN_PROPERTIES_READ_ONLY_ERROR=Skin properties is read-only
@@ -258,4 +259,4 @@
INVALID_VALUE="Component {0} has invalid value expression {1}"
DATASCROLLER_PAGE_MISSING=Datascroller {0}: The requested page #{1} isn''t found
in the model containing {2} pages. Paging is reset to page #{3}
DATASCROLLER_PAGES_DIFFERENT=Datascroller components attached to component\: {0} have
different values of ''page'' attribute \: {1}
-COMPONENT_CONVERSION_ERROR=Component {0}: conversion error occurred for value {1}
\ No newline at end of file
+COMPONENT_CONVERSION_ERROR=Component {0}\: conversion error occurred for value {1}
\ No newline at end of file