mirror of
https://github.com/klmp200/PQT_Gestionnaire_vente_stock.git
synced 2024-12-23 07:51:08 +00:00
Module client, packg gui : ajout interface générales des componsants GUI (part 1/???)
This commit is contained in:
parent
2f15f382b5
commit
5183b47330
@ -0,0 +1,7 @@
|
||||
package com.pqt.client.module.gui.ressources.components;
|
||||
|
||||
import javafx.scene.layout.Pane;
|
||||
|
||||
public interface IFXComponent {
|
||||
Pane getPane();
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.pqt.client.module.gui.ressources.components.products;
|
||||
|
||||
import com.pqt.client.module.gui.ressources.components.IFXComponent;
|
||||
import com.pqt.client.module.gui.ressources.components.products.listeners.IStockComponentListener;
|
||||
import com.pqt.core.entities.product.Product;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public interface IFXStockDisplayerComponent extends IFXComponent {
|
||||
void display(Collection<Product> products);
|
||||
void addListener(IStockComponentListener l);
|
||||
void removeListener(IStockComponentListener l);
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.pqt.client.module.gui.ressources.components.products.listeners;
|
||||
|
||||
import com.pqt.core.entities.product.Product;
|
||||
import javafx.event.Event;
|
||||
|
||||
public interface IStockComponentFirerer {
|
||||
|
||||
void addListener(IStockComponentListener l);
|
||||
void removeListener(IStockComponentListener l);
|
||||
|
||||
void fireProductClickEvent(Event event, Product product);
|
||||
void fireAddProductRequestEvent();
|
||||
void fireRemoveProductRequestEvent(Product product);
|
||||
void fireDetailProductRequestEvent(Product product);
|
||||
void fireRefreshProductListRequestEvent();
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.pqt.client.module.gui.ressources.components.products.listeners;
|
||||
|
||||
import com.pqt.core.entities.product.Product;
|
||||
import javafx.event.Event;
|
||||
|
||||
import java.util.EventListener;
|
||||
|
||||
public interface IStockComponentListener extends EventListener {
|
||||
void onProductClickEvent(Event event, Product product);
|
||||
void onAddProductRequestEvent();
|
||||
void onRemoveProductRequestEvent(Product product);
|
||||
void onDetailProductRequestEvent(Product product);
|
||||
void onRefreshProductListRequestEvent();
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package com.pqt.client.module.gui.ressources.components.products.listeners;
|
||||
|
||||
import com.pqt.core.entities.product.Product;
|
||||
import javafx.event.Event;
|
||||
|
||||
import javax.swing.event.EventListenerList;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class SimpleStockComponentFirerer implements IStockComponentFirerer {
|
||||
|
||||
private EventListenerList listenerList;
|
||||
|
||||
public SimpleStockComponentFirerer() {
|
||||
listenerList = new EventListenerList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(IStockComponentListener l) {
|
||||
listenerList.add(IStockComponentListener.class, l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListener(IStockComponentListener l) {
|
||||
listenerList.remove(IStockComponentListener.class, l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireProductClickEvent(Event event, Product product) {
|
||||
Arrays.stream(listenerList.getListeners(IStockComponentListener.class)).forEach(l->l.onProductClickEvent(event, product));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireAddProductRequestEvent() {
|
||||
Arrays.stream(listenerList.getListeners(IStockComponentListener.class)).forEach(IStockComponentListener::onAddProductRequestEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireRemoveProductRequestEvent(Product product) {
|
||||
Arrays.stream(listenerList.getListeners(IStockComponentListener.class)).forEach(l->l.onRemoveProductRequestEvent(product));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireDetailProductRequestEvent(Product product) {
|
||||
Arrays.stream(listenerList.getListeners(IStockComponentListener.class)).forEach(l->l.onDetailProductRequestEvent(product));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireRefreshProductListRequestEvent() {
|
||||
Arrays.stream(listenerList.getListeners(IStockComponentListener.class)).forEach(IStockComponentListener::onRefreshProductListRequestEvent);
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package com.pqt.client.module.gui.ressources.components.sale;
|
||||
|
||||
import com.pqt.client.module.gui.ressources.components.IFXComponent;
|
||||
import com.pqt.core.entities.sale.Sale;
|
||||
|
||||
public interface IFXSaleCreatorComponent extends IFXComponent{
|
||||
Sale create();
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package com.pqt.client.module.gui.ressources.components.sale;
|
||||
|
||||
import com.pqt.client.module.gui.ressources.components.IFXComponent;
|
||||
import com.pqt.client.module.gui.ressources.components.sale.listeners.ISaleComponentListener;
|
||||
import com.pqt.core.entities.sale.Sale;
|
||||
|
||||
public interface IFXSaleDisplayerComponent extends IFXComponent {
|
||||
void display(Sale sale);
|
||||
void addListener(ISaleComponentListener l);
|
||||
void removeListener(ISaleComponentListener l);
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package com.pqt.client.module.gui.ressources.components.sale.listeners;
|
||||
|
||||
public interface ISaleComponentFirerer {
|
||||
//TODO faire ça
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package com.pqt.client.module.gui.ressources.components.sale.listeners;
|
||||
|
||||
import java.util.EventListener;
|
||||
|
||||
public interface ISaleComponentListener extends EventListener {
|
||||
//TODO faire ça
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package com.pqt.client.module.gui.ressources.components.sale.listeners;
|
||||
|
||||
public class SimpleSaleComponentFirerer implements ISaleComponentFirerer {
|
||||
//TODO faire ça
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.pqt.client.module.gui.ressources.components.validation;
|
||||
|
||||
import com.pqt.client.module.gui.ressources.components.IFXComponent;
|
||||
import com.pqt.client.module.gui.ressources.components.products.listeners.IStockComponentListener;
|
||||
import com.pqt.client.module.gui.ressources.components.validation.listeners.IValidatorComponentListener;
|
||||
|
||||
public interface IFXValidatorComponent extends IFXComponent{
|
||||
void addListener(IValidatorComponentListener l);
|
||||
void removeListener(IValidatorComponentListener l);
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.pqt.client.module.gui.ressources.components.validation.listeners;
|
||||
|
||||
public interface IValidatorComponentFirerer {
|
||||
void addListener(IValidatorComponentListener l);
|
||||
void removeListener(IValidatorComponentListener l);
|
||||
|
||||
void fireValidationEvent();
|
||||
void fireCancelEvent();
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package com.pqt.client.module.gui.ressources.components.validation.listeners;
|
||||
|
||||
import java.util.EventListener;
|
||||
|
||||
public interface IValidatorComponentListener extends EventListener {
|
||||
void onValidationEvent();
|
||||
void onCancelEvent();
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.pqt.client.module.gui.ressources.components.validation.listeners;
|
||||
|
||||
import javax.swing.event.EventListenerList;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class SimpleValidatorComponentFirerer implements IValidatorComponentFirerer {
|
||||
|
||||
private EventListenerList listenerList;
|
||||
|
||||
public SimpleValidatorComponentFirerer() {
|
||||
listenerList = new EventListenerList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(IValidatorComponentListener l) {
|
||||
listenerList.add(IValidatorComponentListener.class, l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListener(IValidatorComponentListener l) {
|
||||
listenerList.remove(IValidatorComponentListener.class, l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireValidationEvent() {
|
||||
Arrays.stream(listenerList.getListeners(IValidatorComponentListener.class)).forEach(IValidatorComponentListener::onValidationEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireCancelEvent() {
|
||||
Arrays.stream(listenerList.getListeners(IValidatorComponentListener.class)).forEach(IValidatorComponentListener::onCancelEvent);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user