You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ma...@apache.org on 2006/08/01 19:44:01 UTC
svn commit: r427657 [6/42] - in /myfaces:
core/trunk/api/src/main/java/javax/faces/component/
core/trunk/api/src/test/java/javax/faces/
core/trunk/api/src/test/java/javax/faces/application/
core/trunk/api/src/test/java/javax/faces/component/ core/trunk...
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/context/ResourceLocator.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/context/ResourceLocator.java?rev=427657&r1=427656&r2=427657&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/context/ResourceLocator.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/context/ResourceLocator.java Tue Aug 1 10:43:28 2006
@@ -1,246 +1,246 @@
-package org.apache.myfaces.tobago.context;
-
-/*
- * Copyright 2002-2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
-
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.tobago.util.XmlUtils;
-
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import java.util.Set;
-import java.util.Properties;
-import java.util.Enumeration;
-import java.util.zip.ZipInputStream;
-import java.util.zip.ZipEntry;
-import java.io.InputStream;
-import java.io.IOException;
-import java.net.URL;
-import java.net.MalformedURLException;
-
-/**
- * This class helps to locate all resources of the ResourceManager.
- * It will be called in the initializaion phase.
- *
- * @author lofwyr
- * @since 1.0.7
- */
-class ResourceLocator {
-
- private static final Log LOG = LogFactory.getLog(ResourceLocator.class);
-
- private ServletContext servletContext;
- private ResourceManagerImpl resourceManager;
- private ThemeBuilder themeBuilder;
-
- public ResourceLocator(
- ServletContext servletContext, ResourceManagerImpl resourceManager,
- ThemeBuilder tobagoConfig) {
- this.servletContext = servletContext;
- this.resourceManager = resourceManager;
- this.themeBuilder = tobagoConfig;
- }
-
- public void locate()
- throws ServletException {
- locateResourcesInWar(servletContext, resourceManager, "/");
- locateResourcesFromClasspath(resourceManager);
- }
-
- private void locateResourcesInWar(
- ServletContext servletContext, ResourceManagerImpl resources, String path)
- throws ServletException {
-
- if (path.startsWith("/WEB-INF/")) {
- return; // ignore
- }
- // fix for jetty6
- if (path.endsWith("/") && path.length() > 1) {
- path = path.substring(0, path.length() - 1);
- }
- Set<String> resourcePaths = servletContext.getResourcePaths(path);
- if (resourcePaths == null || resourcePaths.isEmpty()) {
- LOG.error("ResourcePath empty! Please check the tobago-config.xml file!"
- + " path='" + path + "'");
- return;
- }
- for (String childPath : resourcePaths) {
- if (childPath.endsWith("/")) {
- // ignore, because weblogic puts the path directory itself in the Set
- if (!childPath.equals(path)) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("childPath dir " + childPath);
- }
- locateResourcesInWar(servletContext, resources, childPath);
- }
- } else {
- //Log.debug("add resc " + childPath);
- if (childPath.endsWith(".properties")) {
- InputStream inputStream = servletContext.getResourceAsStream(childPath);
- addProperties(inputStream, resources, childPath, false);
- } else if (childPath.endsWith(".properties.xml")) {
- InputStream inputStream = servletContext.getResourceAsStream(childPath);
- addProperties(inputStream, resources, childPath, true);
- } else {
- resources.add(childPath);
- }
- }
- }
- }
-
- private void locateResourcesFromClasspath(ResourceManagerImpl resources)
- throws ServletException {
-
- ThemeParser parser = new ThemeParser();
- try {
- LOG.info("Loading tobago-theme.xml");
- ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
- Enumeration<URL> urls = classLoader.getResources("META-INF/tobago-theme.xml");
-
- while (urls.hasMoreElements()) {
- URL themeUrl = urls.nextElement();
-
- ThemeImpl theme = parser.parse(themeUrl);
- themeBuilder.addTheme(theme);
- String prefix = ensureSlash(theme.getResourcePath());
-
- String protocol = themeUrl.getProtocol();
- // tomcat uses jar
- // weblogic uses zip
- // IBM WebSphere uses wsjar
- if ("jar".equals(protocol) || "zip".equals(protocol) || "wsjar".equals(protocol)) {
- addResources(classLoader, resources, themeUrl, protocol, prefix);
- } else {
- LOG.warn("Unknown protocol '" + themeUrl + "'");
- addResources(classLoader, resources, themeUrl, protocol, prefix);
- }
- }
- } catch (Exception e) {
- String msg = "while loading ";
- if (LOG.isErrorEnabled()) {
- LOG.error(msg, e);
- }
- throw new ServletException(msg, e);
- }
- }
-
- private void addResources(ClassLoader classLoader, ResourceManagerImpl resources, URL themeUrl, String protocol,
- String prefix) throws IOException, ServletException {
- LOG.info("themeUrl = '" + themeUrl + "'");
- String fileName = themeUrl.toString().substring(
- protocol.length() + 1, themeUrl.toString().indexOf("!"));
- URL jarFile;
- try {
- jarFile = new URL(fileName);
- } catch (MalformedURLException e) {
- // workaround for weblogic on windows
- jarFile = new URL("file:" + fileName);
- }
- InputStream stream = null;
- try {
- stream = jarFile.openStream();
- ZipInputStream zip = new ZipInputStream(stream);
- while (zip.available() > 0) {
- ZipEntry nextEntry = zip.getNextEntry();
- if (nextEntry == null || nextEntry.isDirectory()) {
- continue;
- }
- String name = "/" + nextEntry.getName();
- if (name.startsWith(prefix)) {
- if (name.endsWith(".class")) {
- // ignore the class files
- } else if (name.endsWith(".properties")) {
- LOG.info("** " + name.substring(1));
- InputStream inputStream = classLoader.getResourceAsStream(name.substring(1));
- addProperties(inputStream, resources, name, false);
- } else if (name.endsWith(".properties.xml")) {
- LOG.info("** " + name.substring(1));
- InputStream inputStream = classLoader.getResourceAsStream(name.substring(1));
- LOG.info(inputStream);
- addProperties(inputStream, resources, name, true);
- } else {
- resources.add(name);
- }
- }
- }
- } finally {
- IOUtils.closeQuietly(stream);
- }
- }
-
- private String ensureSlash(String resourcePath) {
- if (!resourcePath.startsWith("/")) {
- resourcePath = '/' + resourcePath;
- }
- if (!resourcePath.endsWith("/")) {
- resourcePath = resourcePath + '/';
- }
- return resourcePath;
- }
-
- private void addProperties(
- InputStream stream, ResourceManagerImpl resources,
- String childPath, boolean xml)
- throws ServletException {
-
- String directory = childPath.substring(0, childPath.lastIndexOf('/'));
- String filename = childPath.substring(childPath.lastIndexOf('/') + 1);
-
- int end = filename.lastIndexOf('.');
- if (xml) {
- end = filename.lastIndexOf('.', end - 1);
- }
-
- String locale = filename.substring(0, end);
-
-
- Properties temp = new Properties();
- try {
- if (xml) {
- // temp.loadFromXML(stream); XXX avoid to be able to retrotranslate it
- XmlUtils.load(temp, stream);
- if (LOG.isDebugEnabled()) {
- LOG.debug(childPath);
- LOG.debug("xml properties: " + temp.size());
- }
- } else {
- temp.load(stream);
- if (LOG.isDebugEnabled()) {
- LOG.debug(childPath);
- LOG.debug(" properties: " + temp.size());
- }
- }
- } catch (IOException e) {
- String msg = "while loading " + childPath;
- if (LOG.isErrorEnabled()) {
- LOG.error(msg, e);
- }
- throw new ServletException(msg, e);
- } finally {
- IOUtils.closeQuietly(stream);
- }
-
- for (Enumeration e = temp.propertyNames(); e.hasMoreElements();) {
- String key = (String) e.nextElement();
- resources.add(directory + '/' + locale + '/' + key, temp.getProperty(key));
- if (LOG.isDebugEnabled()) {
- LOG.debug(directory + '/' + locale + '/' + key + "=" + temp.getProperty(key));
- }
- }
- }
-}
+package org.apache.myfaces.tobago.context;
+
+/*
+ * Copyright 2002-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.tobago.util.XmlUtils;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import java.util.Set;
+import java.util.Properties;
+import java.util.Enumeration;
+import java.util.zip.ZipInputStream;
+import java.util.zip.ZipEntry;
+import java.io.InputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.net.MalformedURLException;
+
+/**
+ * This class helps to locate all resources of the ResourceManager.
+ * It will be called in the initializaion phase.
+ *
+ * @author lofwyr
+ * @since 1.0.7
+ */
+class ResourceLocator {
+
+ private static final Log LOG = LogFactory.getLog(ResourceLocator.class);
+
+ private ServletContext servletContext;
+ private ResourceManagerImpl resourceManager;
+ private ThemeBuilder themeBuilder;
+
+ public ResourceLocator(
+ ServletContext servletContext, ResourceManagerImpl resourceManager,
+ ThemeBuilder tobagoConfig) {
+ this.servletContext = servletContext;
+ this.resourceManager = resourceManager;
+ this.themeBuilder = tobagoConfig;
+ }
+
+ public void locate()
+ throws ServletException {
+ locateResourcesInWar(servletContext, resourceManager, "/");
+ locateResourcesFromClasspath(resourceManager);
+ }
+
+ private void locateResourcesInWar(
+ ServletContext servletContext, ResourceManagerImpl resources, String path)
+ throws ServletException {
+
+ if (path.startsWith("/WEB-INF/")) {
+ return; // ignore
+ }
+ // fix for jetty6
+ if (path.endsWith("/") && path.length() > 1) {
+ path = path.substring(0, path.length() - 1);
+ }
+ Set<String> resourcePaths = servletContext.getResourcePaths(path);
+ if (resourcePaths == null || resourcePaths.isEmpty()) {
+ LOG.error("ResourcePath empty! Please check the tobago-config.xml file!"
+ + " path='" + path + "'");
+ return;
+ }
+ for (String childPath : resourcePaths) {
+ if (childPath.endsWith("/")) {
+ // ignore, because weblogic puts the path directory itself in the Set
+ if (!childPath.equals(path)) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("childPath dir " + childPath);
+ }
+ locateResourcesInWar(servletContext, resources, childPath);
+ }
+ } else {
+ //Log.debug("add resc " + childPath);
+ if (childPath.endsWith(".properties")) {
+ InputStream inputStream = servletContext.getResourceAsStream(childPath);
+ addProperties(inputStream, resources, childPath, false);
+ } else if (childPath.endsWith(".properties.xml")) {
+ InputStream inputStream = servletContext.getResourceAsStream(childPath);
+ addProperties(inputStream, resources, childPath, true);
+ } else {
+ resources.add(childPath);
+ }
+ }
+ }
+ }
+
+ private void locateResourcesFromClasspath(ResourceManagerImpl resources)
+ throws ServletException {
+
+ ThemeParser parser = new ThemeParser();
+ try {
+ LOG.info("Loading tobago-theme.xml");
+ ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ Enumeration<URL> urls = classLoader.getResources("META-INF/tobago-theme.xml");
+
+ while (urls.hasMoreElements()) {
+ URL themeUrl = urls.nextElement();
+
+ ThemeImpl theme = parser.parse(themeUrl);
+ themeBuilder.addTheme(theme);
+ String prefix = ensureSlash(theme.getResourcePath());
+
+ String protocol = themeUrl.getProtocol();
+ // tomcat uses jar
+ // weblogic uses zip
+ // IBM WebSphere uses wsjar
+ if ("jar".equals(protocol) || "zip".equals(protocol) || "wsjar".equals(protocol)) {
+ addResources(classLoader, resources, themeUrl, protocol, prefix);
+ } else {
+ LOG.warn("Unknown protocol '" + themeUrl + "'");
+ addResources(classLoader, resources, themeUrl, protocol, prefix);
+ }
+ }
+ } catch (Exception e) {
+ String msg = "while loading ";
+ if (LOG.isErrorEnabled()) {
+ LOG.error(msg, e);
+ }
+ throw new ServletException(msg, e);
+ }
+ }
+
+ private void addResources(ClassLoader classLoader, ResourceManagerImpl resources, URL themeUrl, String protocol,
+ String prefix) throws IOException, ServletException {
+ LOG.info("themeUrl = '" + themeUrl + "'");
+ String fileName = themeUrl.toString().substring(
+ protocol.length() + 1, themeUrl.toString().indexOf("!"));
+ URL jarFile;
+ try {
+ jarFile = new URL(fileName);
+ } catch (MalformedURLException e) {
+ // workaround for weblogic on windows
+ jarFile = new URL("file:" + fileName);
+ }
+ InputStream stream = null;
+ try {
+ stream = jarFile.openStream();
+ ZipInputStream zip = new ZipInputStream(stream);
+ while (zip.available() > 0) {
+ ZipEntry nextEntry = zip.getNextEntry();
+ if (nextEntry == null || nextEntry.isDirectory()) {
+ continue;
+ }
+ String name = "/" + nextEntry.getName();
+ if (name.startsWith(prefix)) {
+ if (name.endsWith(".class")) {
+ // ignore the class files
+ } else if (name.endsWith(".properties")) {
+ LOG.info("** " + name.substring(1));
+ InputStream inputStream = classLoader.getResourceAsStream(name.substring(1));
+ addProperties(inputStream, resources, name, false);
+ } else if (name.endsWith(".properties.xml")) {
+ LOG.info("** " + name.substring(1));
+ InputStream inputStream = classLoader.getResourceAsStream(name.substring(1));
+ LOG.info(inputStream);
+ addProperties(inputStream, resources, name, true);
+ } else {
+ resources.add(name);
+ }
+ }
+ }
+ } finally {
+ IOUtils.closeQuietly(stream);
+ }
+ }
+
+ private String ensureSlash(String resourcePath) {
+ if (!resourcePath.startsWith("/")) {
+ resourcePath = '/' + resourcePath;
+ }
+ if (!resourcePath.endsWith("/")) {
+ resourcePath = resourcePath + '/';
+ }
+ return resourcePath;
+ }
+
+ private void addProperties(
+ InputStream stream, ResourceManagerImpl resources,
+ String childPath, boolean xml)
+ throws ServletException {
+
+ String directory = childPath.substring(0, childPath.lastIndexOf('/'));
+ String filename = childPath.substring(childPath.lastIndexOf('/') + 1);
+
+ int end = filename.lastIndexOf('.');
+ if (xml) {
+ end = filename.lastIndexOf('.', end - 1);
+ }
+
+ String locale = filename.substring(0, end);
+
+
+ Properties temp = new Properties();
+ try {
+ if (xml) {
+ // temp.loadFromXML(stream); XXX avoid to be able to retrotranslate it
+ XmlUtils.load(temp, stream);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug(childPath);
+ LOG.debug("xml properties: " + temp.size());
+ }
+ } else {
+ temp.load(stream);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug(childPath);
+ LOG.debug(" properties: " + temp.size());
+ }
+ }
+ } catch (IOException e) {
+ String msg = "while loading " + childPath;
+ if (LOG.isErrorEnabled()) {
+ LOG.error(msg, e);
+ }
+ throw new ServletException(msg, e);
+ } finally {
+ IOUtils.closeQuietly(stream);
+ }
+
+ for (Enumeration e = temp.propertyNames(); e.hasMoreElements();) {
+ String key = (String) e.nextElement();
+ resources.add(directory + '/' + locale + '/' + key, temp.getProperty(key));
+ if (LOG.isDebugEnabled()) {
+ LOG.debug(directory + '/' + locale + '/' + key + "=" + temp.getProperty(key));
+ }
+ }
+ }
+}
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/context/ResourceLocator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/context/ResourceManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/context/ResourceManagerFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/context/ThemeBuilder.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/context/ThemeImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/context/ThemeParser.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/event/PageAction.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/event/PageActionEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/event/PageActionUtil.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/event/SheetStateChangeListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/event/SheetStateChangeSource.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/event/SortActionEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/event/SortActionSource.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/event/TabChangeListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/event/TabChangeSource.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/model/CalendarModel.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/model/DateModel.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/SheetRendererWorkaround.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/SheetUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/TobagoResponseStateManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/servlet/ResourceServlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/BeanTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/BoxTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ButtonTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/CalendarTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/CellTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ColumnSelectorTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ColumnTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/CommandTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/CommandTagExtraInfo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/DatePickerTag.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/DatePickerTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/DateTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/FileTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/FormTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/GridLayoutTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/HiddenTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ImageTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/InTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/InputTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/LabelTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/LinkTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuBarTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuCheckboxTag.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuCheckboxTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuCommandTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuRadioTag.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuRadioTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuSelectBooleanTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuSelectOneTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuSeparatorTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MessageTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MessagesTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ObjectTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/OutTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PageTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PanelTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ProgressTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ReloadTag.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ReloadTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/RichTextEditorTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SelectBooleanCheckboxTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SelectItemTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SelectManyCheckboxTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SelectManyListboxTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SelectManyTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SelectOneChoiceTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SelectOneListboxTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SelectOneRadioTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SelectOneTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SelectReferenceTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabGroupTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TextAreaTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TextInputTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TimeTag.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TimeTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TobagoBodyTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TobagoTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ToolBarCommandTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ToolBarSelectBooleanTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ToolBarSelectOneTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ToolBarTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TreeListboxTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TreeTagDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasLink.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasOnclick.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasSuggestMethod.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasValidator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/IsPassword.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/extension/DateExtensionTag.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/extension/FileExtensionTag.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/extension/InExtensionTag.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/extension/LabelExtensionTag.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/extension/MenuCheckboxExtensionTag.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/extension/MenuRadioExtensionTag.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/extension/SelectManyListboxExtensionTag.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/extension/SelectOneChoiceExtensionTag.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/extension/SelectOneListboxExtensionTag.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/extension/TextAreaExtensionTag.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/extension/TimeExtensionTag.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/extension/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/BeanComparator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/BundleMapWrapper.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/CommonsLoggingLogger.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ComparatorBase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/DebugPhaseListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/LocaleUtil.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/RequestUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ValueBindingComparator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/XmlUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/mock/faces/MockApplication.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/mock/faces/MockApplicationFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/mock/faces/MockApplicationMap.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/mock/faces/MockExternalContext.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/mock/faces/MockFacesContext.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/mock/faces/MockPropertyResolver.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/mock/faces/MockRenderKit.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/mock/faces/MockRenderKitFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/mock/faces/MockRequestMap.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/mock/faces/MockResponseWriter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/mock/faces/MockSessionMap.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/mock/faces/MockValueBinding.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/mock/faces/MockVariableResolver.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/mock/faces/MockViewHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/mock/faces/MockViewTag.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/mock/servlet/MockHttpServletRequest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/mock/servlet/MockHttpServletResponse.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/mock/servlet/MockHttpSession.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/mock/servlet/MockJspWriter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/mock/servlet/MockPageContext.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/mock/servlet/MockServletContext.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/mock/servlet/MockServletInputStream.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterUnitTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tobago/trunk/example/addressbook/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/Address.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/Address.java?rev=427657&r1=427656&r2=427657&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/Address.java (original)
+++ myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/Address.java Tue Aug 1 10:43:28 2006
@@ -1,269 +1,269 @@
-package org.apache.myfaces.tobago.example.addressbook;
-
-/*
- * Copyright 2002-2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
-
-/*
- * Created 29.11.2004 17:25:39.
- * $Id: Address.java,v 1.1.1.1 2004/12/15 12:51:35 lofwyr Exp $
- */
-
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.File;
-import java.util.Date;
-import java.util.Locale;
-
-public class Address {
-
- private static final Log LOG = LogFactory.getLog(Address.class);
-
- private int id;
- private String firstName;
- private String lastName;
- private String street;
- private String houseNumber;
- private String city;
- private String zipCode;
- private Locale country;
- private String phone;
- private String mobile;
- private String fax;
- private EmailAddress email;
- private String icq;
- private String homePage;
- private Date dayOfBirth;
- private String note;
-
- private String company;
- private String jobTitle;
- private String jobPhone;
- private String jobEmail;
- private String jobHomePage;
- private static final String EMPTY_PORTRAIT = "image/empty_portrait.png";
-
- public Address() {
- LOG.debug("Creating new Address");
- }
-
- public void fill(Address fromAddress) {
- id = fromAddress.getId();
- firstName = fromAddress.getFirstName();
- lastName = fromAddress.getLastName();
- street = fromAddress.getStreet();
- houseNumber = fromAddress.getHouseNumber();
- city = fromAddress.getCity();
- zipCode = fromAddress.getZipCode();
- country = fromAddress.getCountry();
- phone = fromAddress.getPhone();
- mobile = fromAddress.getMobile();
- fax = fromAddress.getFax();
- email = fromAddress.getEmail();
- dayOfBirth = fromAddress.getDayOfBirth();
- homePage = fromAddress.getHomePage();
-
- note = fromAddress.getNote();
-
- company = fromAddress.getCompany();
- jobTitle = fromAddress.getJobTitle();
- jobPhone = fromAddress.getJobPhone();
- jobEmail = fromAddress.getJobEmail();
- jobHomePage = fromAddress.getJobHomePage();
- }
-
- public int getId() {
- return id;
- }
-
- public void setId(int id) {
- this.id = id;
- }
-
- public String getFirstName() {
- return firstName;
- }
-
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
-
- public String getLastName() {
- return lastName;
- }
-
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
-
- public String getStreet() {
- return street;
- }
-
- public void setStreet(String street) {
- this.street = street;
- }
-
- public String getHouseNumber() {
- return houseNumber;
- }
-
- public void setHouseNumber(String houseNumber) {
- this.houseNumber = houseNumber;
- }
-
- public String getCity() {
- return city;
- }
-
- public void setCity(String city) {
- this.city = city;
- }
-
- public String getZipCode() {
- return zipCode;
- }
-
- public void setZipCode(String zipCode) {
- this.zipCode = zipCode;
- }
-
- public Locale getCountry() {
- return country;
- }
-
- public void setCountry(Locale country) {
- this.country = country;
- }
-
- public String getPhone() {
- return phone;
- }
-
- public void setPhone(String phone) {
- this.phone = phone;
- }
-
- public String getMobile() {
- return mobile;
- }
-
- public void setMobile(String mobile) {
- this.mobile = mobile;
- }
-
- public String getFax() {
- return fax;
- }
-
- public void setFax(String fax) {
- this.fax = fax;
- }
-
- public EmailAddress getEmail() {
- return email;
- }
-
- public void setEmail(EmailAddress email) {
- this.email = email;
- }
-
- public String getIcq() {
- return icq;
- }
-
- public void setIcq(String icq) {
- this.icq = icq;
- }
-
- public String getHomePage() {
- return homePage;
- }
-
- public void setHomePage(String homePage) {
- this.homePage = homePage;
- }
-
- public Date getDayOfBirth() {
- return dayOfBirth;
- }
-
- public void setDayOfBirth(Date dayOfBirth) {
- this.dayOfBirth = dayOfBirth;
- }
-
- public String getNote() {
- return note;
- }
-
- public void setNote(String note) {
- this.note = note;
- }
-
- public String getCompany() {
- return company;
- }
-
- public void setCompany(String company) {
- this.company = company;
- }
-
- public String getJobTitle() {
- return jobTitle;
- }
-
- public void setJobTitle(String jobTitle) {
- this.jobTitle = jobTitle;
- }
-
- public String getJobPhone() {
- return jobPhone;
- }
-
- public void setJobPhone(String jobPhone) {
- this.jobPhone = jobPhone;
- }
-
- public String getJobEmail() {
- return jobEmail;
- }
-
- public void setJobEmail(String jobEmail) {
- this.jobEmail = jobEmail;
- }
-
- public String getJobHomePage() {
- return jobHomePage;
- }
-
- public void setJobHomePage(String jobHomePage) {
- this.jobHomePage = jobHomePage;
- }
-
- public String getImageFileName() {
- String fileName = id + ".png";
- if (new File(fileName).exists()) {
- return fileName;
- } else {
- return EMPTY_PORTRAIT;
- }
- }
-
- public String toString() {
- return id + ": " + firstName + " " + lastName;
- }
-}
+package org.apache.myfaces.tobago.example.addressbook;
+
+/*
+ * Copyright 2002-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+
+/*
+ * Created 29.11.2004 17:25:39.
+ * $Id: Address.java,v 1.1.1.1 2004/12/15 12:51:35 lofwyr Exp $
+ */
+
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.File;
+import java.util.Date;
+import java.util.Locale;
+
+public class Address {
+
+ private static final Log LOG = LogFactory.getLog(Address.class);
+
+ private int id;
+ private String firstName;
+ private String lastName;
+ private String street;
+ private String houseNumber;
+ private String city;
+ private String zipCode;
+ private Locale country;
+ private String phone;
+ private String mobile;
+ private String fax;
+ private EmailAddress email;
+ private String icq;
+ private String homePage;
+ private Date dayOfBirth;
+ private String note;
+
+ private String company;
+ private String jobTitle;
+ private String jobPhone;
+ private String jobEmail;
+ private String jobHomePage;
+ private static final String EMPTY_PORTRAIT = "image/empty_portrait.png";
+
+ public Address() {
+ LOG.debug("Creating new Address");
+ }
+
+ public void fill(Address fromAddress) {
+ id = fromAddress.getId();
+ firstName = fromAddress.getFirstName();
+ lastName = fromAddress.getLastName();
+ street = fromAddress.getStreet();
+ houseNumber = fromAddress.getHouseNumber();
+ city = fromAddress.getCity();
+ zipCode = fromAddress.getZipCode();
+ country = fromAddress.getCountry();
+ phone = fromAddress.getPhone();
+ mobile = fromAddress.getMobile();
+ fax = fromAddress.getFax();
+ email = fromAddress.getEmail();
+ dayOfBirth = fromAddress.getDayOfBirth();
+ homePage = fromAddress.getHomePage();
+
+ note = fromAddress.getNote();
+
+ company = fromAddress.getCompany();
+ jobTitle = fromAddress.getJobTitle();
+ jobPhone = fromAddress.getJobPhone();
+ jobEmail = fromAddress.getJobEmail();
+ jobHomePage = fromAddress.getJobHomePage();
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ public String getStreet() {
+ return street;
+ }
+
+ public void setStreet(String street) {
+ this.street = street;
+ }
+
+ public String getHouseNumber() {
+ return houseNumber;
+ }
+
+ public void setHouseNumber(String houseNumber) {
+ this.houseNumber = houseNumber;
+ }
+
+ public String getCity() {
+ return city;
+ }
+
+ public void setCity(String city) {
+ this.city = city;
+ }
+
+ public String getZipCode() {
+ return zipCode;
+ }
+
+ public void setZipCode(String zipCode) {
+ this.zipCode = zipCode;
+ }
+
+ public Locale getCountry() {
+ return country;
+ }
+
+ public void setCountry(Locale country) {
+ this.country = country;
+ }
+
+ public String getPhone() {
+ return phone;
+ }
+
+ public void setPhone(String phone) {
+ this.phone = phone;
+ }
+
+ public String getMobile() {
+ return mobile;
+ }
+
+ public void setMobile(String mobile) {
+ this.mobile = mobile;
+ }
+
+ public String getFax() {
+ return fax;
+ }
+
+ public void setFax(String fax) {
+ this.fax = fax;
+ }
+
+ public EmailAddress getEmail() {
+ return email;
+ }
+
+ public void setEmail(EmailAddress email) {
+ this.email = email;
+ }
+
+ public String getIcq() {
+ return icq;
+ }
+
+ public void setIcq(String icq) {
+ this.icq = icq;
+ }
+
+ public String getHomePage() {
+ return homePage;
+ }
+
+ public void setHomePage(String homePage) {
+ this.homePage = homePage;
+ }
+
+ public Date getDayOfBirth() {
+ return dayOfBirth;
+ }
+
+ public void setDayOfBirth(Date dayOfBirth) {
+ this.dayOfBirth = dayOfBirth;
+ }
+
+ public String getNote() {
+ return note;
+ }
+
+ public void setNote(String note) {
+ this.note = note;
+ }
+
+ public String getCompany() {
+ return company;
+ }
+
+ public void setCompany(String company) {
+ this.company = company;
+ }
+
+ public String getJobTitle() {
+ return jobTitle;
+ }
+
+ public void setJobTitle(String jobTitle) {
+ this.jobTitle = jobTitle;
+ }
+
+ public String getJobPhone() {
+ return jobPhone;
+ }
+
+ public void setJobPhone(String jobPhone) {
+ this.jobPhone = jobPhone;
+ }
+
+ public String getJobEmail() {
+ return jobEmail;
+ }
+
+ public void setJobEmail(String jobEmail) {
+ this.jobEmail = jobEmail;
+ }
+
+ public String getJobHomePage() {
+ return jobHomePage;
+ }
+
+ public void setJobHomePage(String jobHomePage) {
+ this.jobHomePage = jobHomePage;
+ }
+
+ public String getImageFileName() {
+ String fileName = id + ".png";
+ if (new File(fileName).exists()) {
+ return fileName;
+ } else {
+ return EMPTY_PORTRAIT;
+ }
+ }
+
+ public String toString() {
+ return id + ": " + firstName + " " + lastName;
+ }
+}
Propchange: myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/Address.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/AddressConverter.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/AddressConverter.java?rev=427657&r1=427656&r2=427657&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/AddressConverter.java (original)
+++ myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/AddressConverter.java Tue Aug 1 10:43:28 2006
@@ -1,48 +1,48 @@
-package org.apache.myfaces.tobago.example.addressbook;
-
-/*
- * Copyright 2002-2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
-
-/*
- * Created 03.12.2004 00:08:01.
- * $Id: AddressConverter.java,v 1.1.1.1 2004/12/15 12:51:35 lofwyr Exp $
- */
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.convert.Converter;
-
-public class AddressConverter implements Converter {
-
- private static final Log LOG = LogFactory.getLog(AddressConverter.class);
-
- public Object getAsObject(
- FacesContext facesContext, UIComponent component, String reference) {
- if (reference == null || reference.length() == 0) {
- return null;
- }
- return new EmailAddress(reference);
- }
-
- public String getAsString(
- FacesContext facesContext, UIComponent component, Object object) {
- return object.toString();
- }
-
-}
+package org.apache.myfaces.tobago.example.addressbook;
+
+/*
+ * Copyright 2002-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+
+/*
+ * Created 03.12.2004 00:08:01.
+ * $Id: AddressConverter.java,v 1.1.1.1 2004/12/15 12:51:35 lofwyr Exp $
+ */
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+
+public class AddressConverter implements Converter {
+
+ private static final Log LOG = LogFactory.getLog(AddressConverter.class);
+
+ public Object getAsObject(
+ FacesContext facesContext, UIComponent component, String reference) {
+ if (reference == null || reference.length() == 0) {
+ return null;
+ }
+ return new EmailAddress(reference);
+ }
+
+ public String getAsString(
+ FacesContext facesContext, UIComponent component, Object object) {
+ return object.toString();
+ }
+
+}
Propchange: myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/AddressConverter.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/AddressDAO.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/AddressDAO.java?rev=427657&r1=427656&r2=427657&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/AddressDAO.java (original)
+++ myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/AddressDAO.java Tue Aug 1 10:43:28 2006
@@ -1,33 +1,33 @@
-package org.apache.myfaces.tobago.example.addressbook;
-
-/*
- * Copyright 2002-2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
-
-/*
- * Created 29.11.2004 17:36:20.
- * $Id: Controller.java,v 1.2 2005/08/10 11:57:55 lofwyr Exp $
- */
-
-import java.util.List;
-
-public interface AddressDAO {
-
- Address updateAddress(Address address) throws AddressDAOException;
-
- List<Address> findAddresses() throws AddressDAOException;
-
- void removeAddress(Address address) throws AddressDAOException;
-}
+package org.apache.myfaces.tobago.example.addressbook;
+
+/*
+ * Copyright 2002-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+
+/*
+ * Created 29.11.2004 17:36:20.
+ * $Id: Controller.java,v 1.2 2005/08/10 11:57:55 lofwyr Exp $
+ */
+
+import java.util.List;
+
+public interface AddressDAO {
+
+ Address updateAddress(Address address) throws AddressDAOException;
+
+ List<Address> findAddresses() throws AddressDAOException;
+
+ void removeAddress(Address address) throws AddressDAOException;
+}
Propchange: myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/AddressDAO.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/AddressDAOException.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/AddressDAOException.java?rev=427657&r1=427656&r2=427657&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/AddressDAOException.java (original)
+++ myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/AddressDAOException.java Tue Aug 1 10:43:28 2006
@@ -1,36 +1,36 @@
-package org.apache.myfaces.tobago.example.addressbook;
-
-/*
- * Copyright 2002-2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
-
-public class AddressDAOException extends Exception {
-
- public AddressDAOException() {
- }
-
- public AddressDAOException(String message) {
- super(message);
- }
-
- public AddressDAOException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public AddressDAOException(Throwable cause) {
- super(cause);
- }
-
-}
+package org.apache.myfaces.tobago.example.addressbook;
+
+/*
+ * Copyright 2002-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+
+public class AddressDAOException extends Exception {
+
+ public AddressDAOException() {
+ }
+
+ public AddressDAOException(String message) {
+ super(message);
+ }
+
+ public AddressDAOException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public AddressDAOException(Throwable cause) {
+ super(cause);
+ }
+
+}
Propchange: myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/AddressDAOException.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/Controller.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/Controller.java?rev=427657&r1=427656&r2=427657&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/Controller.java (original)
+++ myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/Controller.java Tue Aug 1 10:43:28 2006
@@ -1,202 +1,202 @@
-package org.apache.myfaces.tobago.example.addressbook;
-
-/*
- * Copyright 2002-2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
-
-/*
- * Created 29.11.2004 17:36:20.
- * $Id: Controller.java,v 1.2 2005/08/10 11:57:55 lofwyr Exp $
- */
-
-import org.apache.commons.fileupload.FileItem;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.tobago.model.SheetState;
-import org.springframework.context.ApplicationContext;
-import org.springframework.web.jsf.FacesContextUtils;
-
-import javax.faces.application.FacesMessage;
-import javax.faces.context.FacesContext;
-import java.util.Collections;
-import java.util.List;
-
-public class Controller {
-
- private static final Log LOG = LogFactory.getLog(Controller.class);
-
- private static final String OUTCOME_LIST = "list";
- private static final String OUTCOME_EDITOR = "editor";
-
- private List<Address> currentAddressList;
- private Address currentAddress;
- private SheetState selectedAddresses;
-
- private boolean renderPopup;
- private boolean renderFirstName = true;
- private boolean renderLastName = true;
- private boolean renderDayOfBirth = false;
-
- private AddressDAO addressDAO;
-
- private FileItem uploadedFile;
- private boolean renderFileUploadPopup;
-
- public Controller() {
- LOG.debug("Creating new Controller");
- }
-
- public void setAddressDAO(AddressDAO addressDAO) throws AddressDAOException {
- this.addressDAO = addressDAO;
- LOG.debug("AddressDAO set.");
- ApplicationContext ctx
- = FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance());
- LOG.debug("applicationContext: "+ctx);
- currentAddressList = addressDAO.findAddresses();
- currentAddress = new Address();
- }
-
- public String createAddress() {
- LOG.debug("action: createAddress");
- currentAddress = new Address();
- return OUTCOME_EDITOR;
- }
-
- public String editAddress() {
- LOG.debug("action: editAddress");
- List<Integer> selection = selectedAddresses.getSelectedRows();
- if (selection.size() != 1) {
- FacesMessage error = new FacesMessage("Please select exactly one address.");
- FacesContext.getCurrentInstance().addMessage(null, error);
- return null;
- }
- Address selectedAddress = currentAddressList.get(selection.get(0));
- currentAddress.fill(selectedAddress);
- return OUTCOME_EDITOR;
- }
-
- public String storeAddress() throws AddressDAOException {
- LOG.debug("action: storeAddress");
- currentAddress = addressDAO.updateAddress(currentAddress);
- selectedAddresses.resetSelected();
- currentAddressList = addressDAO.findAddresses();
- return OUTCOME_LIST;
- }
-
- public String deleteAddresses() throws AddressDAOException {
- LOG.debug("action: deleteAddresses");
- List<Integer> selection = selectedAddresses.getSelectedRows();
- if (selection.size() < 1) {
- FacesMessage error = new FacesMessage("Please select at least one address.");
- FacesContext.getCurrentInstance().addMessage(null, error);
- return null;
- }
- Collections.sort(selection); // why?
- for (int i = selection.size() - 1; i >= 0; i--) {
- Address address = currentAddressList.get(selection.get(i));
- addressDAO.removeAddress(address);
- }
- selectedAddresses.resetSelected();
- currentAddressList = addressDAO.findAddresses();
- return OUTCOME_LIST;
- }
-
- public List getCurrentAddressList() {
- return currentAddressList;
- }
-
- public Address getCurrentAddress() {
- return currentAddress;
- }
-
- public SheetState getSelectedAddresses() {
- return selectedAddresses;
- }
-
- public void setSelectedAddresses(SheetState selectedAddresses) {
- this.selectedAddresses = selectedAddresses;
- }
-
- public boolean isRenderFileUploadPopup() {
- return renderFileUploadPopup;
- }
-
- public void setRenderFileUploadPopup(boolean renderFileUploadPopup) {
- LOG.debug(">>> "+renderFileUploadPopup);
- this.renderFileUploadPopup = renderFileUploadPopup;
- }
-
- public String cancelFileUploadPopup() {
- setRenderFileUploadPopup(false);
- return OUTCOME_EDITOR;
- }
-
- public void setRenderPopup(boolean renderPopup) {
- this.renderPopup = renderPopup;
- }
-
- public boolean isRenderPopup() {
- return renderPopup;
- }
-
- public String selectColumns() {
- setRenderPopup(true);
- return OUTCOME_LIST;
- }
-
- public String cancelPopup() {
- setRenderPopup(false);
- return OUTCOME_LIST;
- }
-
- public boolean isRenderFirstName() {
- return renderFirstName;
- }
-
- public void setRenderFirstName(boolean renderFirstName) {
- this.renderFirstName = renderFirstName;
- }
-
- public boolean isRenderLastName() {
- return renderLastName;
- }
-
- public void setRenderLastName(boolean renderLastName) {
- this.renderLastName = renderLastName;
- }
-
- public boolean isRenderDayOfBirth() {
- return renderDayOfBirth;
- }
-
- public void setRenderDayOfBirth(boolean renderDayOfBirth) {
- this.renderDayOfBirth = renderDayOfBirth;
- }
-
- public FileItem getUploadedFile() {
- return uploadedFile;
- }
-
- public void setUploadedFile(FileItem uploadedFile) {
- this.uploadedFile = uploadedFile;
- }
-
- public String popupFileUpload() {
- LOG.error("AHHHHHHH");
- setRenderFileUploadPopup(true);
- return OUTCOME_EDITOR;
- }
-
-}
+package org.apache.myfaces.tobago.example.addressbook;
+
+/*
+ * Copyright 2002-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+
+/*
+ * Created 29.11.2004 17:36:20.
+ * $Id: Controller.java,v 1.2 2005/08/10 11:57:55 lofwyr Exp $
+ */
+
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.tobago.model.SheetState;
+import org.springframework.context.ApplicationContext;
+import org.springframework.web.jsf.FacesContextUtils;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.context.FacesContext;
+import java.util.Collections;
+import java.util.List;
+
+public class Controller {
+
+ private static final Log LOG = LogFactory.getLog(Controller.class);
+
+ private static final String OUTCOME_LIST = "list";
+ private static final String OUTCOME_EDITOR = "editor";
+
+ private List<Address> currentAddressList;
+ private Address currentAddress;
+ private SheetState selectedAddresses;
+
+ private boolean renderPopup;
+ private boolean renderFirstName = true;
+ private boolean renderLastName = true;
+ private boolean renderDayOfBirth = false;
+
+ private AddressDAO addressDAO;
+
+ private FileItem uploadedFile;
+ private boolean renderFileUploadPopup;
+
+ public Controller() {
+ LOG.debug("Creating new Controller");
+ }
+
+ public void setAddressDAO(AddressDAO addressDAO) throws AddressDAOException {
+ this.addressDAO = addressDAO;
+ LOG.debug("AddressDAO set.");
+ ApplicationContext ctx
+ = FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance());
+ LOG.debug("applicationContext: "+ctx);
+ currentAddressList = addressDAO.findAddresses();
+ currentAddress = new Address();
+ }
+
+ public String createAddress() {
+ LOG.debug("action: createAddress");
+ currentAddress = new Address();
+ return OUTCOME_EDITOR;
+ }
+
+ public String editAddress() {
+ LOG.debug("action: editAddress");
+ List<Integer> selection = selectedAddresses.getSelectedRows();
+ if (selection.size() != 1) {
+ FacesMessage error = new FacesMessage("Please select exactly one address.");
+ FacesContext.getCurrentInstance().addMessage(null, error);
+ return null;
+ }
+ Address selectedAddress = currentAddressList.get(selection.get(0));
+ currentAddress.fill(selectedAddress);
+ return OUTCOME_EDITOR;
+ }
+
+ public String storeAddress() throws AddressDAOException {
+ LOG.debug("action: storeAddress");
+ currentAddress = addressDAO.updateAddress(currentAddress);
+ selectedAddresses.resetSelected();
+ currentAddressList = addressDAO.findAddresses();
+ return OUTCOME_LIST;
+ }
+
+ public String deleteAddresses() throws AddressDAOException {
+ LOG.debug("action: deleteAddresses");
+ List<Integer> selection = selectedAddresses.getSelectedRows();
+ if (selection.size() < 1) {
+ FacesMessage error = new FacesMessage("Please select at least one address.");
+ FacesContext.getCurrentInstance().addMessage(null, error);
+ return null;
+ }
+ Collections.sort(selection); // why?
+ for (int i = selection.size() - 1; i >= 0; i--) {
+ Address address = currentAddressList.get(selection.get(i));
+ addressDAO.removeAddress(address);
+ }
+ selectedAddresses.resetSelected();
+ currentAddressList = addressDAO.findAddresses();
+ return OUTCOME_LIST;
+ }
+
+ public List getCurrentAddressList() {
+ return currentAddressList;
+ }
+
+ public Address getCurrentAddress() {
+ return currentAddress;
+ }
+
+ public SheetState getSelectedAddresses() {
+ return selectedAddresses;
+ }
+
+ public void setSelectedAddresses(SheetState selectedAddresses) {
+ this.selectedAddresses = selectedAddresses;
+ }
+
+ public boolean isRenderFileUploadPopup() {
+ return renderFileUploadPopup;
+ }
+
+ public void setRenderFileUploadPopup(boolean renderFileUploadPopup) {
+ LOG.debug(">>> "+renderFileUploadPopup);
+ this.renderFileUploadPopup = renderFileUploadPopup;
+ }
+
+ public String cancelFileUploadPopup() {
+ setRenderFileUploadPopup(false);
+ return OUTCOME_EDITOR;
+ }
+
+ public void setRenderPopup(boolean renderPopup) {
+ this.renderPopup = renderPopup;
+ }
+
+ public boolean isRenderPopup() {
+ return renderPopup;
+ }
+
+ public String selectColumns() {
+ setRenderPopup(true);
+ return OUTCOME_LIST;
+ }
+
+ public String cancelPopup() {
+ setRenderPopup(false);
+ return OUTCOME_LIST;
+ }
+
+ public boolean isRenderFirstName() {
+ return renderFirstName;
+ }
+
+ public void setRenderFirstName(boolean renderFirstName) {
+ this.renderFirstName = renderFirstName;
+ }
+
+ public boolean isRenderLastName() {
+ return renderLastName;
+ }
+
+ public void setRenderLastName(boolean renderLastName) {
+ this.renderLastName = renderLastName;
+ }
+
+ public boolean isRenderDayOfBirth() {
+ return renderDayOfBirth;
+ }
+
+ public void setRenderDayOfBirth(boolean renderDayOfBirth) {
+ this.renderDayOfBirth = renderDayOfBirth;
+ }
+
+ public FileItem getUploadedFile() {
+ return uploadedFile;
+ }
+
+ public void setUploadedFile(FileItem uploadedFile) {
+ this.uploadedFile = uploadedFile;
+ }
+
+ public String popupFileUpload() {
+ LOG.error("AHHHHHHH");
+ setRenderFileUploadPopup(true);
+ return OUTCOME_EDITOR;
+ }
+
+}
Propchange: myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/Controller.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/Countries.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/Countries.java?rev=427657&r1=427656&r2=427657&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/Countries.java (original)
+++ myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/Countries.java Tue Aug 1 10:43:28 2006
@@ -1,43 +1,43 @@
-package org.apache.myfaces.tobago.example.addressbook;
-
-/*
- * Copyright 2002-2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
-
-/*
- * Created 02.12.2004 21:42:13.
- * $Id: Countries.java,v 1.1.1.1 2004/12/15 12:51:35 lofwyr Exp $
- */
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.faces.model.SelectItem;
-import java.util.ArrayList;
-import java.util.Locale;
-
-public class Countries extends ArrayList {
-
- private static final Log LOG = LogFactory.getLog(Countries.class);
-
- public Countries() {
- LOG.debug("Creating new Countries object.");
- Locale language = Locale.US;
- add(new SelectItem(Locale.GERMANY, Locale.GERMANY.getDisplayCountry(language)));
- add(new SelectItem(Locale.UK, Locale.UK.getDisplayCountry(language)));
- add(new SelectItem(Locale.US, Locale.US.getDisplayCountry(language)));
- add(new SelectItem(Locale.CHINA, Locale.CHINA.getDisplayCountry(language)));
- }
-}
+package org.apache.myfaces.tobago.example.addressbook;
+
+/*
+ * Copyright 2002-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+
+/*
+ * Created 02.12.2004 21:42:13.
+ * $Id: Countries.java,v 1.1.1.1 2004/12/15 12:51:35 lofwyr Exp $
+ */
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.faces.model.SelectItem;
+import java.util.ArrayList;
+import java.util.Locale;
+
+public class Countries extends ArrayList {
+
+ private static final Log LOG = LogFactory.getLog(Countries.class);
+
+ public Countries() {
+ LOG.debug("Creating new Countries object.");
+ Locale language = Locale.US;
+ add(new SelectItem(Locale.GERMANY, Locale.GERMANY.getDisplayCountry(language)));
+ add(new SelectItem(Locale.UK, Locale.UK.getDisplayCountry(language)));
+ add(new SelectItem(Locale.US, Locale.US.getDisplayCountry(language)));
+ add(new SelectItem(Locale.CHINA, Locale.CHINA.getDisplayCountry(language)));
+ }
+}
Propchange: myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/Countries.java
------------------------------------------------------------------------------
svn:eol-style = native