diff --git a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/products/IFXStockDisplayerComponent.java b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/products/IFXStockDisplayerComponent.java deleted file mode 100644 index 0f9d53a3..00000000 --- a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/products/IFXStockDisplayerComponent.java +++ /dev/null @@ -1,13 +0,0 @@ -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 products); - void addListener(IStockComponentListener l); - void removeListener(IStockComponentListener l); -} diff --git a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/products/listeners/IStockComponentFirerer.java b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/products/listeners/IStockComponentFirerer.java deleted file mode 100644 index 073bfa10..00000000 --- a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/products/listeners/IStockComponentFirerer.java +++ /dev/null @@ -1,16 +0,0 @@ -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(); -} diff --git a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/products/listeners/IStockComponentListener.java b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/products/listeners/IStockComponentListener.java deleted file mode 100644 index 52a6425b..00000000 --- a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/products/listeners/IStockComponentListener.java +++ /dev/null @@ -1,14 +0,0 @@ -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(); -} diff --git a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/products/listeners/SimpleStockComponentFirerer.java b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/products/listeners/SimpleStockComponentFirerer.java deleted file mode 100644 index a3584229..00000000 --- a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/products/listeners/SimpleStockComponentFirerer.java +++ /dev/null @@ -1,51 +0,0 @@ -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); - } -} diff --git a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/sale/IFXSaleCreatorComponent.java b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/sale/IFXSaleCreatorComponent.java deleted file mode 100644 index d577fcc0..00000000 --- a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/sale/IFXSaleCreatorComponent.java +++ /dev/null @@ -1,8 +0,0 @@ -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(); -} diff --git a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/sale/IFXSaleDisplayerComponent.java b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/sale/IFXSaleDisplayerComponent.java deleted file mode 100644 index 8065fc7a..00000000 --- a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/sale/IFXSaleDisplayerComponent.java +++ /dev/null @@ -1,11 +0,0 @@ -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); -} diff --git a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/sale/listeners/ISaleComponentFirerer.java b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/sale/listeners/ISaleComponentFirerer.java deleted file mode 100644 index 12b36cf1..00000000 --- a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/sale/listeners/ISaleComponentFirerer.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.pqt.client.module.gui.ressources.components.sale.listeners; - -public interface ISaleComponentFirerer { - //TODO faire ça -} diff --git a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/sale/listeners/ISaleComponentListener.java b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/sale/listeners/ISaleComponentListener.java deleted file mode 100644 index f50b5c00..00000000 --- a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/sale/listeners/ISaleComponentListener.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.pqt.client.module.gui.ressources.components.sale.listeners; - -import java.util.EventListener; - -public interface ISaleComponentListener extends EventListener { - //TODO faire ça -} diff --git a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/sale/listeners/SimpleSaleComponentFirerer.java b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/sale/listeners/SimpleSaleComponentFirerer.java deleted file mode 100644 index b62b7be6..00000000 --- a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/sale/listeners/SimpleSaleComponentFirerer.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.pqt.client.module.gui.ressources.components.sale.listeners; - -public class SimpleSaleComponentFirerer implements ISaleComponentFirerer { - //TODO faire ça -} diff --git a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/validation/IFXValidatorComponent.java b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/validation/IFXValidatorComponent.java deleted file mode 100644 index 793d0545..00000000 --- a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/validation/IFXValidatorComponent.java +++ /dev/null @@ -1,10 +0,0 @@ -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); -} diff --git a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/IFXComponent.java b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/generics/IFXComponent.java similarity index 60% rename from Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/IFXComponent.java rename to Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/generics/IFXComponent.java index 57448371..973b1e74 100644 --- a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/IFXComponent.java +++ b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/generics/IFXComponent.java @@ -1,4 +1,4 @@ -package com.pqt.client.module.gui.ressources.components; +package com.pqt.client.module.gui.ressources.generics; import javafx.scene.layout.Pane; diff --git a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/generics/creators/IFXCreatorComponent.java b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/generics/creators/IFXCreatorComponent.java new file mode 100644 index 00000000..70b1436d --- /dev/null +++ b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/generics/creators/IFXCreatorComponent.java @@ -0,0 +1,8 @@ +package com.pqt.client.module.gui.ressources.generics.creators; + +import com.pqt.client.module.gui.ressources.generics.IFXComponent; + +public interface IFXCreatorComponent extends IFXComponent{ + T create(); + boolean isCreationPossible(); +} diff --git a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/generics/displayers/IFXDisplayerComponent.java b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/generics/displayers/IFXDisplayerComponent.java new file mode 100644 index 00000000..df7f3e95 --- /dev/null +++ b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/generics/displayers/IFXDisplayerComponent.java @@ -0,0 +1,10 @@ +package com.pqt.client.module.gui.ressources.generics.displayers; + +import com.pqt.client.module.gui.ressources.generics.IFXComponent; +import com.pqt.client.module.gui.ressources.generics.displayers.listeners.IDisplayerComponentListener; + +public interface IFXDisplayerComponent extends IFXComponent{ + void display(T content); + void addListener(U l); + void removeListener(U l); +} diff --git a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/generics/displayers/listeners/IDisplayerComponentFirerer.java b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/generics/displayers/listeners/IDisplayerComponentFirerer.java new file mode 100644 index 00000000..5df54246 --- /dev/null +++ b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/generics/displayers/listeners/IDisplayerComponentFirerer.java @@ -0,0 +1,13 @@ +package com.pqt.client.module.gui.ressources.generics.displayers.listeners; + +import javafx.event.Event; + +public interface IDisplayerComponentFirerer { + void fireRefreshContentRequestEvent(); + void fireContentClickEvent(Event event, T eventTarget); + void fireAddContentRequestEvent(); + void fireRemoveContentRequestEvent(T content); + void fireDetailContentRequestEvent(T content); + void addListener(IDisplayerComponentListener l); + void removeListener(IDisplayerComponentListener l); +} \ No newline at end of file diff --git a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/generics/displayers/listeners/IDisplayerComponentListener.java b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/generics/displayers/listeners/IDisplayerComponentListener.java new file mode 100644 index 00000000..12ce0198 --- /dev/null +++ b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/generics/displayers/listeners/IDisplayerComponentListener.java @@ -0,0 +1,13 @@ +package com.pqt.client.module.gui.ressources.generics.displayers.listeners; + +import javafx.event.Event; + +import java.util.EventListener; + +public interface IDisplayerComponentListener extends EventListener { + void onRefreshContentRequestEvent(); + void onContentClickEvent(Event event, T eventTarget); + void onAddContentRequestEvent(); + void onRemoveContentRequestEvent(T content); + void onDetailContentRequestEvent(T content); +} diff --git a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/generics/displayers/listeners/SimpleDisplayerComponentFirerer.java b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/generics/displayers/listeners/SimpleDisplayerComponentFirerer.java new file mode 100644 index 00000000..c2758529 --- /dev/null +++ b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/generics/displayers/listeners/SimpleDisplayerComponentFirerer.java @@ -0,0 +1,58 @@ +package com.pqt.client.module.gui.ressources.generics.displayers.listeners; + +import javafx.event.Event; + +import javax.swing.event.EventListenerList; +import java.util.Arrays; + +public class SimpleDisplayerComponentFirerer> implements IDisplayerComponentFirerer { + + protected EventListenerList listenerList; + protected Class clazz; + + public SimpleDisplayerComponentFirerer(Class clazz) { + listenerList = new EventListenerList(); + this.clazz = clazz; + } + + @Override + public void fireRefreshContentRequestEvent() { + Arrays.stream(listenerList.getListeners(clazz)).forEach(IDisplayerComponentListener::onRefreshContentRequestEvent); + } + + @Override + public void fireContentClickEvent(Event event, T eventTarget) { + Arrays.stream(listenerList.getListeners(clazz)).forEach(l->l.onContentClickEvent(event, eventTarget)); + } + + @Override + public void fireAddContentRequestEvent() { + Arrays.stream(listenerList.getListeners(clazz)).forEach(IDisplayerComponentListener::onAddContentRequestEvent); + } + + @Override + public void fireRemoveContentRequestEvent(T content) { + Arrays.stream(listenerList.getListeners(clazz)).forEach(l->l.onRemoveContentRequestEvent(content)); + } + + @Override + public void fireDetailContentRequestEvent(T content) { + Arrays.stream(listenerList.getListeners(clazz)).forEach(l->l.onDetailContentRequestEvent(content)); + } + + @Override + public void addListener(IDisplayerComponentListener l) throws IllegalArgumentException { + if(clazz.isInstance(l)){ + listenerList.add(clazz, clazz.cast(l)); + }else{ + throw new IllegalArgumentException("Listener must implement the following interface : "+clazz.getName()); + } + } + + @Override + public void removeListener(IDisplayerComponentListener l) { + if (clazz.isInstance(l)) { + listenerList.remove(clazz, clazz.cast(l)); + } + } +} diff --git a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/generics/validators/IFXValidatorComponent.java b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/generics/validators/IFXValidatorComponent.java new file mode 100644 index 00000000..4171c452 --- /dev/null +++ b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/generics/validators/IFXValidatorComponent.java @@ -0,0 +1,9 @@ +package com.pqt.client.module.gui.ressources.generics.validators; + +import com.pqt.client.module.gui.ressources.generics.IFXComponent; +import com.pqt.client.module.gui.ressources.generics.validators.listeners.IValidatorComponentListener; + +public interface IFXValidatorComponent extends IFXComponent{ + void addListener(IValidatorComponentListener l); + void removeListener(IValidatorComponentListener l); +} diff --git a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/validation/listeners/IValidatorComponentFirerer.java b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/generics/validators/listeners/IValidatorComponentFirerer.java similarity index 73% rename from Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/validation/listeners/IValidatorComponentFirerer.java rename to Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/generics/validators/listeners/IValidatorComponentFirerer.java index 121a5a54..ab66cdf4 100644 --- a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/validation/listeners/IValidatorComponentFirerer.java +++ b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/generics/validators/listeners/IValidatorComponentFirerer.java @@ -1,4 +1,4 @@ -package com.pqt.client.module.gui.ressources.components.validation.listeners; +package com.pqt.client.module.gui.ressources.generics.validators.listeners; public interface IValidatorComponentFirerer { void addListener(IValidatorComponentListener l); diff --git a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/validation/listeners/IValidatorComponentListener.java b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/generics/validators/listeners/IValidatorComponentListener.java similarity index 67% rename from Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/validation/listeners/IValidatorComponentListener.java rename to Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/generics/validators/listeners/IValidatorComponentListener.java index 13ec8414..57f7198f 100644 --- a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/validation/listeners/IValidatorComponentListener.java +++ b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/generics/validators/listeners/IValidatorComponentListener.java @@ -1,4 +1,4 @@ -package com.pqt.client.module.gui.ressources.components.validation.listeners; +package com.pqt.client.module.gui.ressources.generics.validators.listeners; import java.util.EventListener; diff --git a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/validation/listeners/SimpleValidatorComponentFirerer.java b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/generics/validators/listeners/SimpleValidatorComponentFirerer.java similarity index 92% rename from Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/validation/listeners/SimpleValidatorComponentFirerer.java rename to Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/generics/validators/listeners/SimpleValidatorComponentFirerer.java index 6fed05a9..a06b07e9 100644 --- a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/components/validation/listeners/SimpleValidatorComponentFirerer.java +++ b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/generics/validators/listeners/SimpleValidatorComponentFirerer.java @@ -1,4 +1,4 @@ -package com.pqt.client.module.gui.ressources.components.validation.listeners; +package com.pqt.client.module.gui.ressources.generics.validators.listeners; import javax.swing.event.EventListenerList; import java.util.Arrays; diff --git a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/specifics/account/IFXAccountsDisplayerComponent.java b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/specifics/account/IFXAccountsDisplayerComponent.java new file mode 100644 index 00000000..60b3a247 --- /dev/null +++ b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/specifics/account/IFXAccountsDisplayerComponent.java @@ -0,0 +1,11 @@ +package com.pqt.client.module.gui.ressources.specifics.account; + +import com.pqt.client.module.gui.ressources.specifics.account.listeners.IAccountComponentListener; +import com.pqt.client.module.gui.ressources.generics.displayers.IFXDisplayerComponent; +import com.pqt.core.entities.user_account.Account; + +import java.util.Collection; + +public interface IFXAccountsDisplayerComponent extends IFXDisplayerComponent, IAccountComponentListener>{ + +} diff --git a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/specifics/account/listeners/IAccountComponentListener.java b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/specifics/account/listeners/IAccountComponentListener.java new file mode 100644 index 00000000..23fbf16c --- /dev/null +++ b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/specifics/account/listeners/IAccountComponentListener.java @@ -0,0 +1,7 @@ +package com.pqt.client.module.gui.ressources.specifics.account.listeners; + +import com.pqt.client.module.gui.ressources.generics.displayers.listeners.IDisplayerComponentListener; +import com.pqt.core.entities.user_account.Account; + +public interface IAccountComponentListener extends IDisplayerComponentListener{ +} diff --git a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/specifics/account/listeners/SimpleAccountComponentFirerer.java b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/specifics/account/listeners/SimpleAccountComponentFirerer.java new file mode 100644 index 00000000..aa16640f --- /dev/null +++ b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/specifics/account/listeners/SimpleAccountComponentFirerer.java @@ -0,0 +1,10 @@ +package com.pqt.client.module.gui.ressources.specifics.account.listeners; + +import com.pqt.client.module.gui.ressources.generics.displayers.listeners.SimpleDisplayerComponentFirerer; +import com.pqt.core.entities.user_account.Account; + +public class SimpleAccountComponentFirerer extends SimpleDisplayerComponentFirerer{ + public SimpleAccountComponentFirerer() { + super(IAccountComponentListener.class); + } +} diff --git a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/specifics/products/IFXProductsDisplayerComponent.java b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/specifics/products/IFXProductsDisplayerComponent.java new file mode 100644 index 00000000..e69a6a85 --- /dev/null +++ b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/specifics/products/IFXProductsDisplayerComponent.java @@ -0,0 +1,10 @@ +package com.pqt.client.module.gui.ressources.specifics.products; + +import com.pqt.client.module.gui.ressources.specifics.products.listeners.IStockComponentListener; +import com.pqt.client.module.gui.ressources.generics.displayers.IFXDisplayerComponent; +import com.pqt.core.entities.product.Product; + +import java.util.Collection; + +public interface IFXProductsDisplayerComponent extends IFXDisplayerComponent, IStockComponentListener> { +} diff --git a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/specifics/products/listeners/IStockComponentListener.java b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/specifics/products/listeners/IStockComponentListener.java new file mode 100644 index 00000000..05a8a695 --- /dev/null +++ b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/specifics/products/listeners/IStockComponentListener.java @@ -0,0 +1,7 @@ +package com.pqt.client.module.gui.ressources.specifics.products.listeners; + +import com.pqt.client.module.gui.ressources.generics.displayers.listeners.IDisplayerComponentListener; +import com.pqt.core.entities.product.Product; + +public interface IStockComponentListener extends IDisplayerComponentListener { +} diff --git a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/specifics/products/listeners/SimpleStockComponentFirerer.java b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/specifics/products/listeners/SimpleStockComponentFirerer.java new file mode 100644 index 00000000..0f3b5933 --- /dev/null +++ b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/specifics/products/listeners/SimpleStockComponentFirerer.java @@ -0,0 +1,11 @@ +package com.pqt.client.module.gui.ressources.specifics.products.listeners; + +import com.pqt.client.module.gui.ressources.generics.displayers.listeners.SimpleDisplayerComponentFirerer; +import com.pqt.core.entities.product.Product; + +public class SimpleStockComponentFirerer extends SimpleDisplayerComponentFirerer { + + public SimpleStockComponentFirerer() { + super(IStockComponentListener.class); + } +} diff --git a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/specifics/sale/IFXSaleDisplayerComponent.java b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/specifics/sale/IFXSaleDisplayerComponent.java new file mode 100644 index 00000000..c394a2d3 --- /dev/null +++ b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/specifics/sale/IFXSaleDisplayerComponent.java @@ -0,0 +1,8 @@ +package com.pqt.client.module.gui.ressources.specifics.sale; + +import com.pqt.client.module.gui.ressources.specifics.sale.listeners.ISaleComponentListener; +import com.pqt.client.module.gui.ressources.generics.displayers.IFXDisplayerComponent; +import com.pqt.core.entities.sale.Sale; + +public interface IFXSaleDisplayerComponent extends IFXDisplayerComponent { +} diff --git a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/specifics/sale/listeners/ISaleComponentListener.java b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/specifics/sale/listeners/ISaleComponentListener.java new file mode 100644 index 00000000..bc1284af --- /dev/null +++ b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/specifics/sale/listeners/ISaleComponentListener.java @@ -0,0 +1,10 @@ +package com.pqt.client.module.gui.ressources.specifics.sale.listeners; + +import com.pqt.client.module.gui.ressources.generics.displayers.listeners.IDisplayerComponentListener; +import com.pqt.core.entities.product.Product; +import com.pqt.core.entities.sale.Sale; +import javafx.event.Event; + +public interface ISaleComponentListener extends IDisplayerComponentListener { + void onComponentClickEvent(Event event, Product product); +} diff --git a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/specifics/sale/listeners/SimpleSaleComponentFirerer.java b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/specifics/sale/listeners/SimpleSaleComponentFirerer.java new file mode 100644 index 00000000..fa746589 --- /dev/null +++ b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/specifics/sale/listeners/SimpleSaleComponentFirerer.java @@ -0,0 +1,19 @@ +package com.pqt.client.module.gui.ressources.specifics.sale.listeners; + +import com.pqt.client.module.gui.ressources.generics.displayers.listeners.SimpleDisplayerComponentFirerer; +import com.pqt.core.entities.product.Product; +import com.pqt.core.entities.sale.Sale; +import javafx.event.Event; + +import java.util.Arrays; + +public class SimpleSaleComponentFirerer extends SimpleDisplayerComponentFirerer { + + public SimpleSaleComponentFirerer() { + super(ISaleComponentListener.class); + } + + public void fireComponentClickEvent(Event event, Product product) { + Arrays.stream(listenerList.getListeners(ISaleComponentListener.class)).forEach(l->l.onComponentClickEvent(event, product)); + } +} diff --git a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/strings/GUIStringTool.java b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/strings/GUIStringTool.java new file mode 100644 index 00000000..915ffc6b --- /dev/null +++ b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/strings/GUIStringTool.java @@ -0,0 +1,40 @@ +package com.pqt.client.module.gui.ressources.strings; + +import com.pqt.core.entities.product.Product; + +//TODO faire ça un peu mieux +public class GUIStringTool { + public static String getValidationButtonLabel() { + return "Valider"; + } + + public static String getConfirmationValidationButtonLabel() { + return "Confirmer"; + } + + public static String getCancelButtonLabel() { + return "Annuler"; + } + + public static String getConfirmationCancelButtonLabel() { + return "Confirmer"; + } + + public static String getCategorytabStockDisplayerTitle() { + return "Produits"; + } + + public static IObjectStringRenderer getProductStringRenderer(){ + return product->String.format("%s - %.2f€ (%s)", product.getName(), product.getPrice(), (product.getAmountRemaining()>=30?"30+": Integer.toString(product.getAmountRemaining()))); + } + + public static String getCommandComposerTitleTitle() { + return "Commande"; + } + + public static IObjectWithQuantityStringRenderer getSaleItemStringRenderer(){ + return (product, qté)->String.format("%s - %.2f€ (%s)", product.getName(), product.getPrice(), (product.getAmountRemaining()>=30?"30+": Integer.toString(product.getAmountRemaining()))); + } +} + + diff --git a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/strings/IObjectStringRenderer.java b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/strings/IObjectStringRenderer.java new file mode 100644 index 00000000..98709239 --- /dev/null +++ b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/strings/IObjectStringRenderer.java @@ -0,0 +1,5 @@ +package com.pqt.client.module.gui.ressources.strings; + +public interface IObjectStringRenderer { + String render(T obj); +} diff --git a/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/strings/IObjectWithQuantityStringRenderer.java b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/strings/IObjectWithQuantityStringRenderer.java new file mode 100644 index 00000000..8cc2fc9c --- /dev/null +++ b/Workspace/client/src/main/java/com/pqt/client/module/gui/ressources/strings/IObjectWithQuantityStringRenderer.java @@ -0,0 +1,5 @@ +package com.pqt.client.module.gui.ressources.strings; + +public interface IObjectWithQuantityStringRenderer { + String render(T obj, int quantity); +}