-
Notifications
You must be signed in to change notification settings - Fork 71
Expand file tree
/
Copy pathAppModule.java
More file actions
101 lines (81 loc) · 3.81 KB
/
AppModule.java
File metadata and controls
101 lines (81 loc) · 3.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
//
// Copyright 2010 GOT5 (GO Tapestry 5)
//
// 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.got5.tapestry5.jquery.services;
import org.apache.tapestry5.SymbolConstants;
import org.apache.tapestry5.ioc.Configuration;
import org.apache.tapestry5.ioc.MappedConfiguration;
import org.apache.tapestry5.ioc.annotations.Contribute;
import org.apache.tapestry5.ioc.annotations.SubModule;
import org.apache.tapestry5.ioc.services.ApplicationDefaults;
import org.apache.tapestry5.ioc.services.SymbolProvider;
import org.apache.tapestry5.json.JSONObject;
import org.apache.tapestry5.services.ApplicationStateContribution;
import org.apache.tapestry5.services.ApplicationStateCreator;
import org.apache.tapestry5.services.compatibility.Compatibility;
import org.apache.tapestry5.services.compatibility.Trait;
import org.got5.tapestry5.jquery.EffectsConstants;
import org.got5.tapestry5.jquery.JQuerySymbolConstants;
import org.got5.tapestry5.jquery.data.IDataSource;
import org.got5.tapestry5.jquery.data.MockDataSource;
@SubModule(value = JQueryModule.class)
public class AppModule
{
@Contribute(SymbolProvider.class)
@ApplicationDefaults
public static void contributeApplicationDefaults(MappedConfiguration<String, Object> configuration)
{
configuration.add(JQuerySymbolConstants.SUPPRESS_PROTOTYPE, true);
configuration.add(SymbolConstants.SUPPORTED_LOCALES, "en,fr,de,ru,ua,fr_CA,fr_CH");
configuration.add(SymbolConstants.PRODUCTION_MODE, false);
configuration.add(SymbolConstants.COMBINE_SCRIPTS, false);
configuration.add(SymbolConstants.COMPRESS_WHITESPACE, false);
configuration.add(SymbolConstants.GZIP_COMPRESSION_ENABLED, false);
configuration.add(SymbolConstants.ASSET_URL_FULL_QUALIFIED, true);
configuration.add(SymbolConstants.ASSET_PATH_PREFIX, "assets");
configuration.add("demo-src-dir", "");
configuration.add(SymbolConstants.JAVASCRIPT_INFRASTRUCTURE_PROVIDER, "jquery");
configuration.add(SymbolConstants.HMAC_PASSPHRASE, "testing, testing, 1... 2... 3...");
//configuration.add(JQuerySymbolConstants.JQUERY_UI_DEFAULT_THEME, "context:css/south-street/jquery-ui.css");
}
@Contribute(WidgetParams.class)
public void addWidgetParams(MappedConfiguration<String, JSONObject> configuration){
configuration.add("slider", new JSONObject().put("min", 5));
configuration.add("customdatepicker",
new JSONObject("prevText","Previous Month"));
}
public static void contributeClasspathAssetAliasManager(MappedConfiguration<String, String> configuration)
{
configuration.add("demo-jquery", "static/css");
}
public void contributeApplicationStateManager(
MappedConfiguration<Class, ApplicationStateContribution> configuration) {
ApplicationStateCreator<IDataSource> creator = new ApplicationStateCreator<IDataSource>() {
public IDataSource create() {
return new MockDataSource();
}
};
configuration.add(IDataSource.class, new ApplicationStateContribution(
"session", creator));
}
@Contribute(EffectsParam.class)
public void addEffectsFile(Configuration<String> configuration){
configuration.add(EffectsConstants.SHAKE);
}
@Contribute(Compatibility.class)
public static void disableBackwardsCompatibleFeatures(MappedConfiguration<Trait, Boolean> configuration){
configuration.add(Trait.INITIALIZERS, false);
}
}