Example usage for com.google.gwt.core.client ScriptInjector fromString

List of usage examples for com.google.gwt.core.client ScriptInjector fromString

Introduction

In this page you can find the example usage for com.google.gwt.core.client ScriptInjector fromString.

Prototype

public static FromString fromString(String scriptBody) 

Source Link

Document

Build an injection call for directly setting the script text in the DOM.

Usage

From source file:org.gwtbootstrap3.extras.datepicker.client.ui.base.DatePickerBase.java

License:Apache License

/** {@inheritDoc} */
@Override/*w  ww . j  a  v  a 2  s .  c o m*/
public void setLanguage(final DatePickerLanguage language) {
    this.language = language;

    // Inject the JS for the language
    if (language.getJs() != null) {
        ScriptInjector.fromString(language.getJs().getText()).setWindow(ScriptInjector.TOP_WINDOW).inject();
    }
}

From source file:org.gwtbootstrap3.extras.datetimepicker.client.DateTimePickerEntryPoint.java

License:Apache License

@Override
public void onModuleLoad() {
    ScriptInjector.fromString(DateTimePickerClientBundle.INSTANCE.dateTimePicker().getText())
            .setWindow(ScriptInjector.TOP_WINDOW).inject();
}

From source file:org.gwtbootstrap3.extras.datetimepicker.client.ui.base.DateTimePickerBase.java

License:Apache License

/** {@inheritDoc} */
@Override/*from  w  w w .jav  a  2 s  . com*/
public void setLanguage(final DateTimePickerLanguage language) {
    this.language = language;

    // Inject the JS for the language
    if (language.getJs() != null) {
        ScriptInjector.fromString(language.getJs().getText()).setWindow(ScriptInjector.TOP_WINDOW).inject();
    }
}

From source file:org.gwtbootstrap3.extras.fullcalendar.client.FullCalendarEntryPoint.java

License:Apache License

@Override
public void onModuleLoad() {
    StyleInjector.injectAtEnd(FullCalendarClientBundle.INSTANCE.fullCalendarCss().getText());
    StyleInjector.injectAtEnd(//  www . ja v a2 s. c  o m
            "@media print {" + FullCalendarClientBundle.INSTANCE.fullCalendarPrintCss().getText() + "}");

    if (!isMomentPresent()) {
        ScriptInjector.fromString(FullCalendarClientBundle.INSTANCE.getMomentJS().getText())
                .setWindow(ScriptInjector.TOP_WINDOW).inject();
    }

    if (!isCalendarPresent()) {
        ScriptInjector.fromString(FullCalendarClientBundle.INSTANCE.getFullCalendarJS().getText())
                .setWindow(ScriptInjector.TOP_WINDOW).inject();
    }

    if (!isDragAndResizePresent()) {
        ScriptInjector.fromString(FullCalendarClientBundle.INSTANCE.getCustomDragResizeJS().getText())
                .setWindow(ScriptInjector.TOP_WINDOW).inject();
    }
}

From source file:org.gwtbootstrap3.extras.fullcalendar.client.ui.EventSource.java

License:Apache License

public EventSource(final String url, final String color, final String backgroundColor, final String textColor,
        final String borderColor, final String className, final boolean isEditable,
        final boolean isStartEditable, final boolean isDurationEditable, final boolean allDayDefault,
        final boolean ignoreTimeZone, final boolean isGoogle//if true include google script file
) {//  w w w  . ja va2s.  co m
    if (isGoogle && !GCAL_ADDED) {
        GCAL_ADDED = true;
        ScriptInjector.fromString(FullCalendarClientBundle.INSTANCE.getGoogleCalJS().getText())
                .setWindow(ScriptInjector.TOP_WINDOW).inject();
    }
    newEvent(url, color, backgroundColor, textColor, borderColor, className, isEditable, isStartEditable,
            isDurationEditable, allDayDefault, ignoreTimeZone);
}

From source file:org.gwtbootstrap3.extras.fullcalendar.client.ui.FullCalendar.java

License:Apache License

private void ensureInjected(final Language language) {
    if (!languageScripts.isEmpty()) {
        for (final JavaScriptObject script : languageScripts.values()) {
            try {
                final Element ele = (Element) script;
                ele.removeFromParent();// ww  w  .ja  v a 2 s .c  o  m
            } catch (final Exception e) {
                // TODO: handle exception
            }
        }
    }
    final JavaScriptObject scriptElement = ScriptInjector.fromString(language.getResource().getText())
            .setWindow(ScriptInjector.TOP_WINDOW).inject();
    languageScripts.put(language.getCode(), scriptElement);
}

From source file:org.gwtbootstrap3.extras.gallery.client.GalleryEntryPoint.java

License:Apache License

private void inject(TextResource resource) {
    ScriptInjector.fromString(resource.getText()).setWindow(ScriptInjector.TOP_WINDOW).inject();
}

From source file:org.gwtbootstrap3.extras.growl.client.GrowlEntryPoint.java

License:Apache License

@Override
public void onModuleLoad() {
    if (!isGrowlPresent()) {
        ScriptInjector.fromString(GrowlClientBundle.INSTANCE.growlJS().getText())
                .setWindow(ScriptInjector.TOP_WINDOW).inject();
    }/*w w w .j av a 2 s  .c  om*/
}

From source file:org.gwtbootstrap3.extras.notify.client.NotifyEntryPoint.java

License:Apache License

@Override
public void onModuleLoad() {
    if (!isNotifyLoaded()) {
        ScriptInjector.fromString(NotifyClientBundle.INSTANCE.notifyJS().getText())
                .setWindow(ScriptInjector.TOP_WINDOW).inject();
    }//w  w  w  .  j a  v a 2  s  .com
}

From source file:org.gwtbootstrap3.extras.respond.client.RespondEntryPoint.java

License:Apache License

@Override
public void onModuleLoad() {
    if (Window.Navigator.getUserAgent().contains(MSIE) && Window.Navigator.getUserAgent().contains(EIGHT)) {
        ScriptInjector.fromString(RespondClientBundle.INSTANCE.respond().getText())
                .setWindow(ScriptInjector.TOP_WINDOW).inject();
        ScriptInjector.fromString(RespondClientBundle.INSTANCE.html5Shiv().getText())
                .setWindow(ScriptInjector.TOP_WINDOW).inject();
    }// www .  j a  v  a 2  s  .co m
}