Skip to content

Commit

Permalink
Move Plugin Details to Client
Browse files Browse the repository at this point in the history
  • Loading branch information
GedMarc committed Mar 2, 2024
1 parent 6289613 commit d56364e
Show file tree
Hide file tree
Showing 27 changed files with 1,354 additions and 1,795 deletions.
134 changes: 64 additions & 70 deletions src/main/java/com/jwebmp/core/events/activate/ActivateAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@
package com.jwebmp.core.events.activate;


import com.guicedee.client.*;
import com.guicedee.client.IGuiceContext;
import com.jwebmp.core.Event;
import com.jwebmp.core.base.ajax.AjaxCall;
import com.jwebmp.core.base.ajax.AjaxResponse;
import com.jwebmp.core.base.html.interfaces.GlobalFeatures;
import com.jwebmp.core.base.html.interfaces.events.GlobalEvents;
import com.jwebmp.core.events.services.IOnActivateService;
import com.jwebmp.core.htmlbuilder.javascript.events.enumerations.EventTypes;
import com.jwebmp.core.plugins.ComponentInformation;
import lombok.extern.java.Log;

import java.util.ServiceLoader;
Expand All @@ -37,82 +36,77 @@
*
* @author GedMarc
*/
@ComponentInformation(name = "Activate Event",
description = "Server Side Event for Active Adapter.")
@Log
public abstract class ActivateAdapter<J extends ActivateAdapter<J>>
extends Event<GlobalFeatures, J>
implements GlobalEvents<J>
extends Event<GlobalFeatures, J>
implements GlobalEvents<J>
{

/**
* Performs a click
*
* @param component
* The component this click is going to be acting on
*/
public ActivateAdapter(com.jwebmp.core.base.interfaces.IComponentHierarchyBase<?,?> component)
{
super(EventTypes.activate, component);
}
/**
* Performs a click
*
* @param component The component this click is going to be acting on
*/
public ActivateAdapter(com.jwebmp.core.base.interfaces.IComponentHierarchyBase<?, ?> component)
{
super(EventTypes.activate, component);
}

@Override
public void fireEvent(AjaxCall<?> call, AjaxResponse<?> response)
{
try
{
onActivate(call, response);
onCall();
}
catch (Exception e)
{
ActivateAdapter.log.log(Level.WARNING, "Error In Firing Event", e);
}
}
@Override
public void fireEvent(AjaxCall<?> call, AjaxResponse<?> response)
{
try
{
onActivate(call, response);
onCall();
}
catch (Exception e)
{
ActivateAdapter.log.log(Level.WARNING, "Error In Firing Event", e);
}
}

@Override
public void preConfigure()
{
if (!isConfigured())
{
onCreate();
}
super.preConfigure();
}
@Override
public void preConfigure()
{
if (!isConfigured())
{
onCreate();
}
super.preConfigure();
}

/**
* Occurs when the event is called
*/
@SuppressWarnings("unchecked")
private void onCreate()
{
@SuppressWarnings("rawtypes")
Set<IOnActivateService> services = IGuiceContext.instance()
/**
* Occurs when the event is called
*/
@SuppressWarnings("unchecked")
private void onCreate()
{
@SuppressWarnings("rawtypes")
Set<IOnActivateService> services = IGuiceContext.instance()
.getLoader(IOnActivateService.class, ServiceLoader.load(IOnActivateService.class));
services.forEach(service -> service.onCreate(this));
}
services.forEach(service -> service.onCreate(this));
}

/**
* Triggers on Click
* <p>
*
* @param call
* The physical AJAX call
* @param response
* The physical Ajax Receiver
*/
public abstract void onActivate(AjaxCall<?> call, AjaxResponse<?> response);
/**
* Triggers on Click
* <p>
*
* @param call The physical AJAX call
* @param response The physical Ajax Receiver
*/
public abstract void onActivate(AjaxCall<?> call, AjaxResponse<?> response);

/**
* Occurs when the event is called
*/
@SuppressWarnings("unchecked")
private void onCall()
{
@SuppressWarnings("rawtypes")
Set<IOnActivateService> services = IGuiceContext
.instance()
.getLoader(IOnActivateService.class, ServiceLoader.load(IOnActivateService.class));
services.forEach(service -> service.onCall(this));
}
/**
* Occurs when the event is called
*/
@SuppressWarnings("unchecked")
private void onCall()
{
@SuppressWarnings("rawtypes")
Set<IOnActivateService> services = IGuiceContext
.instance()
.getLoader(IOnActivateService.class, ServiceLoader.load(IOnActivateService.class));
services.forEach(service -> service.onCall(this));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@
package com.jwebmp.core.events.beforeactivate;


import com.guicedee.client.*;
import com.guicedee.client.IGuiceContext;
import com.jwebmp.core.Event;
import com.jwebmp.core.base.ajax.AjaxCall;
import com.jwebmp.core.base.ajax.AjaxResponse;
import com.jwebmp.core.base.html.interfaces.GlobalFeatures;
import com.jwebmp.core.base.html.interfaces.events.GlobalEvents;
import com.jwebmp.core.events.services.IOnBeforeActivateService;
import com.jwebmp.core.htmlbuilder.javascript.events.enumerations.EventTypes;
import com.jwebmp.core.plugins.ComponentInformation;
import lombok.extern.java.Log;

import java.util.ServiceLoader;
Expand All @@ -37,79 +36,74 @@
*
* @author GedMarc
*/
@ComponentInformation(name = "Before Activate Event",
description = "Server Side Event for Before Active Adapter.")
@Log
public abstract class BeforeActivateAdapter<J extends BeforeActivateAdapter<J>>
extends Event<GlobalFeatures, J>
implements GlobalEvents<J>
extends Event<GlobalFeatures, J>
implements GlobalEvents<J>
{

/**
* Performs a click
*
* @param component
* The component this click is going to be acting on
*/
public BeforeActivateAdapter(com.jwebmp.core.base.interfaces.IComponentHierarchyBase<?,?> component)
{
super(EventTypes.beforeActivate, component);
}

/**
* Performs a click
*
* @param component The component this click is going to be acting on
*/
public BeforeActivateAdapter(com.jwebmp.core.base.interfaces.IComponentHierarchyBase<?, ?> component)
{
super(EventTypes.beforeActivate, component);
}

@Override
public void fireEvent(AjaxCall<?> call, AjaxResponse<?> response)
{
try
{
onBeforeActivate(call, response);
onCall();
}
catch (Exception e)
{
BeforeActivateAdapter.log.log(Level.SEVERE, "Error In Firing Event", e);
}
}

/**
* Triggers on Click
* <p>
*
* @param call
* The physical AJAX call
* @param response
* The physical Ajax Receiver
*/
public abstract void onBeforeActivate(AjaxCall<?> call, AjaxResponse<?> response);
@Override
public void fireEvent(AjaxCall<?> call, AjaxResponse<?> response)
{
try
{
onBeforeActivate(call, response);
onCall();
}
catch (Exception e)
{
BeforeActivateAdapter.log.log(Level.SEVERE, "Error In Firing Event", e);
}
}

private void onCall()
{
Set<IOnBeforeActivateService> services = IGuiceContext.instance()
/**
* Triggers on Click
* <p>
*
* @param call The physical AJAX call
* @param response The physical Ajax Receiver
*/
public abstract void onBeforeActivate(AjaxCall<?> call, AjaxResponse<?> response);

private void onCall()
{
Set<IOnBeforeActivateService> services = IGuiceContext.instance()
.getLoader(IOnBeforeActivateService.class, ServiceLoader.load(IOnBeforeActivateService.class));
services.forEach(service -> service.onCall(this));
}
services.forEach(service -> service.onCall(this));
}


@Override
public void preConfigure()
{
if (!isConfigured())
{
onCreate();
}
super.preConfigure();
}
@Override
public void preConfigure()
{
if (!isConfigured())
{
onCreate();
}
super.preConfigure();
}

/**
* Occurs when the event is called
*/
@SuppressWarnings("unchecked")
private void onCreate()
{
Set<IOnBeforeActivateService> services = IGuiceContext
.instance()
.getLoader(IOnBeforeActivateService.class, ServiceLoader.load(IOnBeforeActivateService.class));
services.forEach(service -> service.onCreate(this));
}
/**
* Occurs when the event is called
*/
@SuppressWarnings("unchecked")
private void onCreate()
{
Set<IOnBeforeActivateService> services = IGuiceContext
.instance()
.getLoader(IOnBeforeActivateService.class, ServiceLoader.load(IOnBeforeActivateService.class));
services.forEach(service -> service.onCreate(this));
}

}
Loading

0 comments on commit d56364e

Please sign in to comment.