You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2012/11/08 20:55:55 UTC
[5/5] git commit: Rename to reflect broader responsibility
Rename to reflect broader responsibility
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/dc1d9365
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/dc1d9365
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/dc1d9365
Branch: refs/heads/5.4-js-rewrite
Commit: dc1d9365086525eaa8adaf421b05367fafa0d4e2
Parents: 5fa1619
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Thu Nov 8 09:57:21 2012 -0800
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Thu Nov 8 09:57:21 2012 -0800
----------------------------------------------------------------------
.../ClientLocalizationMessageResource.java | 94 +++++++++++++++
.../messages/DecimalFormatMessageResource.java | 94 ---------------
.../apache/tapestry5/services/TapestryModule.java | 6 +-
3 files changed, 97 insertions(+), 97 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/dc1d9365/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/messages/ClientLocalizationMessageResource.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/messages/ClientLocalizationMessageResource.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/messages/ClientLocalizationMessageResource.java
new file mode 100644
index 0000000..3ba57fa
--- /dev/null
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/messages/ClientLocalizationMessageResource.java
@@ -0,0 +1,94 @@
+// Copyright 2012 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.
+
+package org.apache.tapestry5.internal.services.messages;
+
+import org.apache.tapestry5.internal.util.VirtualResource;
+import org.apache.tapestry5.ioc.Resource;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.text.DecimalFormatSymbols;
+import java.util.Locale;
+
+/**
+ * Provides a number of symbols related to client-side localization; by exposing these in the global message catalog,
+ * they are available to the client (via the "core/messages" module).
+ *
+ * @since 5.4
+ */
+public class ClientLocalizationMessageResource extends VirtualResource
+{
+ private final Locale locale;
+
+ public ClientLocalizationMessageResource()
+ {
+ this(null);
+ }
+
+ ClientLocalizationMessageResource(Locale locale)
+ {
+ this.locale = locale;
+ }
+
+ @Override
+ public Resource withExtension(String extension)
+ {
+ return this;
+ }
+
+ @Override
+ public String getPath()
+ {
+ return String.format("<Client localization symbols for locale %s>", locale == null ? "(none)" : locale);
+ }
+
+ @Override
+ public String getFile()
+ {
+ return null;
+ }
+
+ @Override
+ public URL toURL()
+ {
+ return null;
+ }
+
+ @Override
+ public Resource forLocale(Locale locale)
+ {
+ return new ClientLocalizationMessageResource(locale);
+ }
+
+ @Override
+ public InputStream openStream() throws IOException
+ {
+ DecimalFormatSymbols symbols = DecimalFormatSymbols.getInstance(locale);
+
+ StringBuilder builder = new StringBuilder(200);
+
+ write(builder, "group", symbols.getGroupingSeparator());
+ write(builder, "minus", symbols.getMinusSign());
+ write(builder, "decimal", symbols.getDecimalSeparator());
+
+ return toInputStream(builder.toString());
+ }
+
+ private void write(StringBuilder builder, String name, char value)
+ {
+ builder.append("decimal-symbols.").append(name).append("=").append(value).append("\n");
+ }
+}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/dc1d9365/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/messages/DecimalFormatMessageResource.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/messages/DecimalFormatMessageResource.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/messages/DecimalFormatMessageResource.java
deleted file mode 100644
index c977418..0000000
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/messages/DecimalFormatMessageResource.java
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright 2012 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.
-
-package org.apache.tapestry5.internal.services.messages;
-
-import org.apache.tapestry5.internal.util.VirtualResource;
-import org.apache.tapestry5.ioc.Resource;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.text.DecimalFormatSymbols;
-import java.util.Locale;
-
-/**
- * Provides a number of symbols related to formatting numbers; by exposing these in the global message catalog,
- * they are available to the client (via the "core/messages" module).
- *
- * @since 5.4
- */
-public class DecimalFormatMessageResource extends VirtualResource
-{
- private final Locale locale;
-
- public DecimalFormatMessageResource()
- {
- this(null);
- }
-
- DecimalFormatMessageResource(Locale locale)
- {
- this.locale = locale;
- }
-
- @Override
- public Resource withExtension(String extension)
- {
- return this;
- }
-
- @Override
- public String getPath()
- {
- return String.format("<Virtual DecimalFormat symbols for locale %s>", locale == null ? "(none)" : locale);
- }
-
- @Override
- public String getFile()
- {
- return null;
- }
-
- @Override
- public URL toURL()
- {
- return null;
- }
-
- @Override
- public Resource forLocale(Locale locale)
- {
- return new DecimalFormatMessageResource(locale);
- }
-
- @Override
- public InputStream openStream() throws IOException
- {
- DecimalFormatSymbols symbols = DecimalFormatSymbols.getInstance(locale);
-
- StringBuilder builder = new StringBuilder(200);
-
- write(builder, "group", symbols.getGroupingSeparator());
- write(builder, "minus", symbols.getMinusSign());
- write(builder, "decimal", symbols.getDecimalSeparator());
-
- return toInputStream(builder.toString());
- }
-
- private void write(StringBuilder builder, String name, char value)
- {
- builder.append("decimal-symbols.").append(name).append("=").append(value).append("\n");
- }
-}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/dc1d9365/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java b/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
index 813a036..7ac90be 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
@@ -45,7 +45,7 @@ import org.apache.tapestry5.internal.services.assets.ContextAssetRequestHandler;
import org.apache.tapestry5.internal.services.assets.StackAssetRequestHandler;
import org.apache.tapestry5.internal.services.linktransform.LinkTransformerImpl;
import org.apache.tapestry5.internal.services.linktransform.LinkTransformerInterceptor;
-import org.apache.tapestry5.internal.services.messages.DecimalFormatMessageResource;
+import org.apache.tapestry5.internal.services.messages.ClientLocalizationMessageResource;
import org.apache.tapestry5.internal.services.messages.PropertiesFileParserImpl;
import org.apache.tapestry5.internal.services.meta.ContentTypeExtractor;
import org.apache.tapestry5.internal.services.meta.MetaAnnotationExtractor;
@@ -2574,7 +2574,7 @@ public final class TapestryModule
/**
* Contributes:
* <dl>
- * <dt>DecimalSymbols</dt>
+ * <dt>ClientLocalization</dt>
* <dd>A virtual resource of formatting symbols for decimal numbers</dd>
* <dt>Core</dt>
* <dd>Built in messages used by Tapestry's default validators and components</dd>
@@ -2589,7 +2589,7 @@ public final class TapestryModule
@Symbol(SymbolConstants.APPLICATION_CATALOG)
Resource applicationCatalog, OrderedConfiguration<Resource> configuration)
{
- configuration.add("DecimalSymbols", new DecimalFormatMessageResource());
+ configuration.add("ClientLocalization", new ClientLocalizationMessageResource());
configuration.add("Core", assetSource.resourceForPath("org/apache/tapestry5/core.properties"));
configuration.add("AppCatalog", applicationCatalog);
}