Search in sources :

Example 1 with HtmlTagCreator

use of org.webpieces.ctx.api.extension.HtmlTagCreator in project webpieces by deanhiller.

the class HtmlTagLookup method install.

public void install(Set<HtmlTagCreator> htmlCreators) {
    for (HtmlTagCreator c : htmlCreators) {
        List<Tag> tags = c.createTags();
        addTags(c, tags);
    }
}
Also used : HtmlTagCreator(org.webpieces.ctx.api.extension.HtmlTagCreator) FormTag(org.webpieces.templating.impl.tags.FormTag) BootstrapModalTag(org.webpieces.templating.impl.tags.BootstrapModalTag) TemplateLoaderTag(org.webpieces.templating.impl.tags.TemplateLoaderTag) HtmlGetTag(org.webpieces.templating.impl.tags.HtmlGetTag) ScriptTag(org.webpieces.templating.impl.tags.ScriptTag) FieldTag(org.webpieces.templating.impl.tags.FieldTag) RenderPageArgsTag(org.webpieces.templating.impl.tags.RenderPageArgsTag) StyleSheetTag(org.webpieces.templating.impl.tags.StyleSheetTag) OptionTag(org.webpieces.templating.impl.tags.OptionTag) Tag(org.webpieces.ctx.api.extension.Tag) ExtendsTag(org.webpieces.templating.impl.tags.ExtendsTag) JsActionTag(org.webpieces.templating.impl.tags.JsActionTag) HtmlSetTag(org.webpieces.templating.impl.tags.HtmlSetTag) RenderTagArgsTag(org.webpieces.templating.impl.tags.RenderTagArgsTag)

Example 2 with HtmlTagCreator

use of org.webpieces.ctx.api.extension.HtmlTagCreator in project webpieces by deanhiller.

the class GuiceModule method configure.

// This is where you would put the guice bindings you need though generally if done
// right, you won't have much in this file.
// If you need more Guice Modules as you want to scale, just modify ServerMeta which returns
// the list of all the Guice Modules in your application
@SuppressWarnings("rawtypes")
@Override
public void configure(Binder binder) {
    log.info("running module");
    // all modules have access to adding their own Startable objects to be run on server startup
    Multibinder<Startable> uriBinder = Multibinder.newSetBinder(binder, Startable.class);
    uriBinder.addBinding().to(PopulateDatabase.class);
    Multibinder<ObjectStringConverter> conversionBinder = Multibinder.newSetBinder(binder, ObjectStringConverter.class);
    conversionBinder.addBinding().to(EducationEnum.WebConverter.class);
    conversionBinder.addBinding().to(RoleEnum.WebConverter.class);
    Multibinder<HtmlTagCreator> htmlTagCreators = Multibinder.newSetBinder(binder, HtmlTagCreator.class);
    htmlTagCreators.addBinding().to(MyHtmlTagCreator.class);
    binder.bind(SomeLibrary.class).to(SomeLibraryImpl.class);
    // Must bind a SimpleStorage for plugins to read/save data and render their html pages
    binder.bind(SimpleStorage.class).to(SimpleStorageImpl.class).asEagerSingleton();
    // Must bind a BackendLogin for the backend plugin(or remove the backend plugin)
    binder.bind(BackendLogin.class).to(BackendLoginImpl.class).asEagerSingleton();
    // since GlobalAppContext is a singleton, ApplicationContext will be to and will be the same
    binder.bind(ApplicationContext.class).to(GlobalAppContext.class).asEagerSingleton();
    binder.bind(HttpsConfig.class).toInstance(new HttpsConfig(true));
    binder.bind(ClientAssertions.class).to(ClientAssertionsImpl.class).asEagerSingleton();
}
Also used : SimpleStorageImpl(webpiecesxxxxxpackage.service.SimpleStorageImpl) BackendLoginImpl(webpiecesxxxxxpackage.web.login.BackendLoginImpl) Startable(org.webpieces.router.api.extensions.Startable) EducationEnum(webpiecesxxxxxpackage.db.EducationEnum) RoleEnum(webpiecesxxxxxpackage.db.RoleEnum) HtmlTagCreator(org.webpieces.ctx.api.extension.HtmlTagCreator) MyHtmlTagCreator(webpiecesxxxxxpackage.web.tags.MyHtmlTagCreator) HttpsConfig(org.webpieces.microsvc.client.api.HttpsConfig) ObjectStringConverter(org.webpieces.router.api.extensions.ObjectStringConverter) SomeLibrary(webpiecesxxxxxpackage.service.SomeLibrary)

Example 3 with HtmlTagCreator

use of org.webpieces.ctx.api.extension.HtmlTagCreator in project webpieces by deanhiller.

the class PluginSetup method wireInPluginPoints.

/**
 * This is where we wire in all plugin points EXCEPT the Startup one
 * we can't inject them :(
 */
@SuppressWarnings("rawtypes")
public void wireInPluginPoints(Injector appInjector) {
    Key<Set<EntityLookup>> key = Key.get(new TypeLiteral<Set<EntityLookup>>() {
    });
    Set<EntityLookup> lookupHooks = appInjector.getInstance(key);
    translator.install(lookupHooks);
    Key<Set<ObjectStringConverter>> key3 = Key.get(new TypeLiteral<Set<ObjectStringConverter>>() {
    });
    Set<ObjectStringConverter> converters = appInjector.getInstance(key3);
    translation.install(converters);
    Key<Set<BodyContentBinder>> key2 = Key.get(new TypeLiteral<Set<BodyContentBinder>>() {
    });
    Set<BodyContentBinder> bodyBinders = appInjector.getInstance(key2);
    bodyContentChecker.install(bodyBinders);
    Key<Set<HtmlTagCreator>> key4 = Key.get(new TypeLiteral<Set<HtmlTagCreator>>() {
    });
    Set<HtmlTagCreator> htmlTagCreators = appInjector.getInstance(key4);
    // Guice circular dependency we could not work around quite yet.  figure out later maybe
    TemplateApi api = templateApi.get();
    api.installCustomTags(htmlTagCreators);
}
Also used : BodyContentBinder(org.webpieces.router.api.extensions.BodyContentBinder) Set(java.util.Set) TemplateApi(org.webpieces.router.api.TemplateApi) EntityLookup(org.webpieces.router.api.extensions.EntityLookup) HtmlTagCreator(org.webpieces.ctx.api.extension.HtmlTagCreator) ObjectStringConverter(org.webpieces.router.api.extensions.ObjectStringConverter)

Aggregations

HtmlTagCreator (org.webpieces.ctx.api.extension.HtmlTagCreator)3 ObjectStringConverter (org.webpieces.router.api.extensions.ObjectStringConverter)2 Set (java.util.Set)1 Tag (org.webpieces.ctx.api.extension.Tag)1 HttpsConfig (org.webpieces.microsvc.client.api.HttpsConfig)1 TemplateApi (org.webpieces.router.api.TemplateApi)1 BodyContentBinder (org.webpieces.router.api.extensions.BodyContentBinder)1 EntityLookup (org.webpieces.router.api.extensions.EntityLookup)1 Startable (org.webpieces.router.api.extensions.Startable)1 BootstrapModalTag (org.webpieces.templating.impl.tags.BootstrapModalTag)1 ExtendsTag (org.webpieces.templating.impl.tags.ExtendsTag)1 FieldTag (org.webpieces.templating.impl.tags.FieldTag)1 FormTag (org.webpieces.templating.impl.tags.FormTag)1 HtmlGetTag (org.webpieces.templating.impl.tags.HtmlGetTag)1 HtmlSetTag (org.webpieces.templating.impl.tags.HtmlSetTag)1 JsActionTag (org.webpieces.templating.impl.tags.JsActionTag)1 OptionTag (org.webpieces.templating.impl.tags.OptionTag)1 RenderPageArgsTag (org.webpieces.templating.impl.tags.RenderPageArgsTag)1 RenderTagArgsTag (org.webpieces.templating.impl.tags.RenderTagArgsTag)1 ScriptTag (org.webpieces.templating.impl.tags.ScriptTag)1