本文整理汇总了Java中org.apache.wicket.request.resource.JavaScriptResourceReference类的典型用法代码示例。如果您正苦于以下问题:Java JavaScriptResourceReference类的具体用法?Java JavaScriptResourceReference怎么用?Java JavaScriptResourceReference使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JavaScriptResourceReference类属于org.apache.wicket.request.resource包,在下文中一共展示了JavaScriptResourceReference类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: internalRenderHead
import org.apache.wicket.request.resource.JavaScriptResourceReference; //导入依赖的package包/类
protected void internalRenderHead(IHeaderResponse response) {
response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forReference(Application.get().getJavaScriptLibrarySettings().getJQueryReference())));
super.renderHead(response);
final String suffix = DEVELOPMENT == getApplication().getConfigurationType() ? "" : ".min";
response.render(CssHeaderItem.forUrl(String.format("css/theme_om/jquery-ui%s.css", suffix)));
response.render(CssHeaderItem.forUrl(String.format("css/theme%s.css", suffix)));
if (isRtl()) {
response.render(CssHeaderItem.forUrl(String.format("css/theme-rtl%s.css", suffix)));
}
if (!Strings.isEmpty(getGaCode())) {
response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(BasePage.class, "om-ga.js"))));
StringBuilder script = new StringBuilder("initGA('");
script.append(getGaCode()).append("');").append(isMainPage() ? "initHash()" : "init()").append(';');
response.render(OnDomReadyHeaderItem.forScript(script));
}
}
示例2: renderHead
import org.apache.wicket.request.resource.JavaScriptResourceReference; //导入依赖的package包/类
@Override
public void renderHead(IHeaderResponse response) {
super.renderHead(response);
response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(Chat.class, "chat.js"))));
response.render(new PriorityHeaderItem(getNamedFunction("chatActivity", chatActivity, explicit(PARAM_TYPE), explicit(PARAM_ROOM_ID), explicit(PARAM_MSG_ID))));
if (showDashboardChat) {
ChatDao dao = getBean(ChatDao.class);
StringBuilder sb = new StringBuilder(getReinit());
List<ChatMessage> list = new ArrayList<>(dao.getGlobal(0, 30));
for(Long roomId : getUserRooms(getUserId())) {
Room r = getBean(RoomDao.class).get(roomId);
sb.append(addRoom(r));
}
list.addAll(dao.getUserRecent(getUserId(), Date.from(Instant.now().minus(Duration.ofHours(1L))), 0, 30));
if (!list.isEmpty()) {
sb.append("Chat.addMessage(").append(getMessage(list).toString()).append(");");
}
response.render(OnDomReadyHeaderItem.forScript(sb.toString()));
}
}
示例3: renderHead
import org.apache.wicket.request.resource.JavaScriptResourceReference; //导入依赖的package包/类
@Override
public void renderHead(IHeaderResponse response) {
// FIXME: funktioniert das wirklich? Im Forscher wird kein Link erzeugt
// TODO veit06: Ist das hier wirklich noch n�tig? Duch die Styling-Strategie wird jetzt CSS anders eingebunden
// LessCSSHelper.initBootstrapLessCSS(this.getClass(), response, getRequestCycle(), new LessCSSHelper.PathTupel(
// this.getClass(), "less/application.less", "css/application.css"));
List<CssResourceReference> cssRefs = StylingFactory.getStylingStrategy().getCssStyleFiles();
List<JavaScriptResourceReference> jsRefs = StylingFactory.getStylingStrategy().getJavascriptFiles();
if(cssRefs != null) {
// CSS Dateien f�r die aktuelle Styling Strategie einbinden
for(CssResourceReference cssRef : cssRefs) {
response.render(CssReferenceHeaderItem.forReference(cssRef));
}
}
if(jsRefs != null) {
// JS Dateien f�r die aktuelle Styling Strategie einbinden
for(JavaScriptResourceReference jsRef : jsRefs) {
response.render(JavaScriptReferenceHeaderItem.forReference(jsRef));
}
}
}
示例4: getDependencies
import org.apache.wicket.request.resource.JavaScriptResourceReference; //导入依赖的package包/类
@Override
public List<HeaderItem> getDependencies() {
List<HeaderItem> dependencies = new ArrayList<>();
dependencies.add(JavaScriptHeaderItem.forReference(Application.get().getJavaScriptLibrarySettings().getJQueryReference()));
dependencies.add(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(
AtWhoResourceReference.class, "jquery.atwho-caret.js")));
dependencies.add(CssHeaderItem.forReference(new CssResourceReference(
AtWhoResourceReference.class, "jquery.atwho.css")));
return dependencies;
}
示例5: createBundles
import org.apache.wicket.request.resource.JavaScriptResourceReference; //导入依赖的package包/类
private void createBundles(Class<?> scope, Set<ResourceReference> resourceReferences) {
/*
* Some bundled css file may contain resources relative to parent paths of the css url,
* for instance, a css may define below style:
*
* background: url(../images/clock.png)),
*
* if we use a resource name for instance "bundle" here, the generated resource
* path will be something like "http://<server>:<port>/wicket/resource/org.apache.wicket.Application/bundle-ver-1472816165384.css",
* and browser will resolve image url above as "http://<server>:<port>/wicket/resource/images/clock.png", which will cause Wicket
* resource loading not working at all. However if we use a long path here for resource name, for instance
* "a/l/o/n/g/p/a/t/h/bundle", the resolved image url will be "http://<server>:<port>/wicket/resource/org.apache.wicket.Application/a/l/o/n/g/p/a/t/clock.png",
* which will be resolved to the correct image with help of our BundleAwareResourceReferenceFactory
*/
String name = "a/l/o/n/g/p/a/t/h/bundle";
List<ResourceReference> resourceReferenceList = new ArrayList<>(resourceReferences);
resourceReferenceList.sort((o1, o2)->sorted.indexOf(o1)-sorted.indexOf(o2));
List<JavaScriptReferenceHeaderItem> javaScriptResourceReferences = new ArrayList<>();
List<CssReferenceHeaderItem> cssResourceReferences = new ArrayList<>();
for (ResourceReference resourceReference: resourceReferenceList) {
if (resourceReference instanceof JavaScriptResourceReference) {
javaScriptResourceReferences.add(JavaScriptReferenceHeaderItem.forReference(resourceReference));
} else if (resourceReference instanceof CssResourceReference) {
cssResourceReferences.add(CssReferenceHeaderItem.forReference(resourceReference));
}
}
if (!javaScriptResourceReferences.isEmpty()) {
javaScriptBundleReferences.add(new JavaScriptConcatResourceBundleReference(
scope, name + ".js", javaScriptResourceReferences));
}
if (!cssResourceReferences.isEmpty()) {
cssBundleReferences.add(new CachedDependenciesConcatResourceBundleReference<CssReferenceHeaderItem>(
scope, name + ".css", cssResourceReferences));
}
}
示例6: renderHead
import org.apache.wicket.request.resource.JavaScriptResourceReference; //导入依赖的package包/类
@Override
public void renderHead(IHeaderResponse response) {
super.renderHead(response);
response.render(JavaScriptHeaderItem.forReference(JqPlotJavascriptResourceReference.get()));
response.render(CssHeaderItem.forReference(JqPlotCssResourceReference.get()));
Chart<?> c1 = new PieChart<>(null);
c1.getChartConfiguration().setHighlighter(new Highlighter());
for (Chart<?> chart : new Chart<?>[]{c1, new BarChart<Integer>(null)}) {
for (String resource : JqPlotUtils.retriveJavaScriptResources(chart)) {
response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(JqPlotBehavior.class, removeMinified(resource))));
}
}
}
示例7: renderHead
import org.apache.wicket.request.resource.JavaScriptResourceReference; //导入依赖的package包/类
@Override
public void renderHead(IHeaderResponse response) {
super.renderHead(response);
response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(RoomPanel.class, "jquery.dialogextend.js"))));
response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(RoomPanel.class, "room.js"))));
if (interview) {
response.render(JavaScriptHeaderItem.forReference(INTERVIEWWB_JS_REFERENCE));
} else {
response.render(JavaScriptHeaderItem.forReference(WB_JS_REFERENCE));
}
if (room.isVisible()) {
response.render(OnDomReadyHeaderItem.forScript(roomEnter.getCallbackScript()));
}
}
示例8: addJavaScript
import org.apache.wicket.request.resource.JavaScriptResourceReference; //导入依赖的package包/类
public ResourcePackage addJavaScript(final String path) {
add(new IHeaderContributor() {
@Override
public void renderHead(IHeaderResponse response) {
response.renderJavaScriptReference(new JavaScriptResourceReference(scope, path));
}
});
return this;
}
示例9: getDependencies
import org.apache.wicket.request.resource.JavaScriptResourceReference; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public List<HeaderItem> getDependencies()
{
final List<HeaderItem> dependencies = new ArrayList<HeaderItem>();
dependencies.add(JavaScriptHeaderItem.forReference(
new JavaScriptResourceReference(CollapseJsReference.class, "jquery.collapse.js")));
return dependencies;
}
示例10: renderHead
import org.apache.wicket.request.resource.JavaScriptResourceReference; //导入依赖的package包/类
@Override
public void renderHead(Component component, IHeaderResponse response) {
super.renderHead(component, response);
Collection<SpecialDate> specialDates = getSpecialDates();
if(component.isEnabledInHierarchy()){
response.render(CssReferenceHeaderItem.forReference(DATE_PICKER_CSS));
response.render(JavaScriptHeaderItem.forReference(DATE_PICKER_JAVASCRIPT));
response.render(JavaScriptHeaderItem.forReference(DATE_PICKER_EXTENSION_JAVASCRIPT));
if(!component.getLocale().getLanguage().equals("en")){
response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(BootstrapDatePickerBehaviour.class, "locales/bootstrap-datepicker."+component.getLocale().getLanguage()+".js")));
}
if(null != specialDates && !specialDates.isEmpty()) {
StringBuilder sb = new StringBuilder();
sb.append("[");
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
SpecialDate[] sdArray = specialDates.toArray(new SpecialDate[20]);
for(int i = 0; i < specialDates.size(); ++i) {
SpecialDate sd = sdArray[i];
sb.append("{dt:new Date('"+df.format(sd.getDt())+"'), css:'"+sd.getCssClass()+"', tooltip:'"+ sd.getTooltip() +"'}");
if(i < specialDates.size() - 1) {
sb.append(",");
}
}
sb.append("]");
response.render(OnDomReadyHeaderItem.forScript("$(\"#"+component.getMarkupId()+"\").datepicker(null, "+sb.toString()+")"));
} else {
response.render(OnDomReadyHeaderItem.forScript("$(\"#"+component.getMarkupId()+"\").datepicker()"));
}
}
}
示例11: renderHead
import org.apache.wicket.request.resource.JavaScriptResourceReference; //导入依赖的package包/类
@Override
public void renderHead(Component component, IHeaderResponse response)
{
super.renderHead(component, response);
if(component.isEnabledInHierarchy()) {
response.render(CssReferenceHeaderItem.forReference(DATETIME_PICKER_CSS));
response.render(JavaScriptHeaderItem.forReference(MOMENT_JAVASCRIPT));
response.render(JavaScriptHeaderItem.forReference(DATETIME_PICKER_JAVASCRIPT));
if(!component.getLocale().getLanguage().equals("en")) {
response.render(JavaScriptHeaderItem.forReference(
new JavaScriptResourceReference(BootstrapDateTimePickerBehaviour.class
, "locales/" + component.getLocale().getLanguage() + ".js")));
}
/** Not supporting special dates at the moment **/
response.render(OnDomReadyHeaderItem.forScript("$(\"#" + component.getMarkupId() + "\").datetimepicker({ "
+ " format: 'DD/MM/YYYY HH:mm:ss',"
+ " icons: { "
+ " time: 'fa fa-clock-o',"
+ " date: 'fa fa-calendar',"
+ " up: 'fa fa-arrow-up',"
+ " down: 'fa fa-arrow-down',"
+ " previous: 'fa fa-arrow-left',"
+ " next: 'fa fa-arrow-right'"
+ "}"
+ "});"
));
}
}
示例12: getJavaScriptResourceReferences
import org.apache.wicket.request.resource.JavaScriptResourceReference; //导入依赖的package包/类
/**
* Get a list of JavaScript resources to include on the default page.
* @return the list of JavaScript resources
*/
public JavaScriptResourceReference[] getJavaScriptResourceReferences() {
final List<JavaScriptResourceReference> resources = new ArrayList<JavaScriptResourceReference>();
for (final String resource : jsResources) {
if (!resource.startsWith("//") && resource.startsWith("http")) {
resources.add(new JavaScriptResourceReference(getResourcesRootClass(), resource));
}
}
return resources.toArray(new JavaScriptResourceReference[resources.size()]);
}
示例13: renderHead
import org.apache.wicket.request.resource.JavaScriptResourceReference; //导入依赖的package包/类
@Override
public void renderHead(Component component, IHeaderResponse response) {
JQueryHelper.initJQuery(response);
response.render(JavaScriptHeaderItem.forReference(
new JavaScriptResourceReference(DefaultButtonBehavior.class, JS_SCRIPT)));
response.render(OnLoadHeaderItem.forScript(INIT_SCRIPT));
super.renderHead(component, response);
}
示例14: renderHead
import org.apache.wicket.request.resource.JavaScriptResourceReference; //导入依赖的package包/类
/**
* RenderHead adds the blocker javascript file to the page.
*
* @param component the component
* @param response the response
* @see org.apache.wicket.behavior.Behavior#renderHead(Component, IHeaderResponse)
*/
@Override
public void renderHead(Component component, IHeaderResponse response) {
response.render(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(
DMDOnClickIndicatorAttributeModifier.class,
BLOCKER_JS)));
super.renderHead(component, response);
}
示例15: testGetLocalJavascriptResourceReferenceIfSet
import org.apache.wicket.request.resource.JavaScriptResourceReference; //导入依赖的package包/类
@Test
public void testGetLocalJavascriptResourceReferenceIfSet() {
JavaScriptResourceReference expected = new JavaScriptResourceReference(getClass(), "leaflet.js");
ResourceReference reference = new DefaultLeafletSettings.Builder()
.setJavascriptReference(expected)
.build().getJavascriptReference();
assertThat(reference).isEqualTo(expected);
}