|
|
@@ -5,7 +5,7 @@ import javax.swing.JPanel;
|
|
|
import org.jdesktop.swingx.VerticalLayout;
|
|
|
import org.leumasjaffe.observer.ObservableListener;
|
|
|
import org.leumasjaffe.observer.ObserverDispatch;
|
|
|
-import org.leumasjaffe.recipe.model.Product;
|
|
|
+import org.leumasjaffe.recipe.model.Element;
|
|
|
|
|
|
import lombok.AccessLevel;
|
|
|
import lombok.Getter;
|
|
|
@@ -19,12 +19,12 @@ import java.awt.GridBagConstraints;
|
|
|
|
|
|
@SuppressWarnings("serial")
|
|
|
@FieldDefaults(level=AccessLevel.PRIVATE, makeFinal=true)
|
|
|
-public class ProductSummaryPanel extends JPanel {
|
|
|
- ObservableListener<JPanel, Product> listener;
|
|
|
+public class ElementSummaryPanel extends JPanel {
|
|
|
+ ObservableListener<JPanel, Element> listener;
|
|
|
@Getter(AccessLevel.PACKAGE) JLabel lblProductName;
|
|
|
@Getter(AccessLevel.PACKAGE) JPanel panelIngredients;
|
|
|
|
|
|
- public ProductSummaryPanel(final Product product) {
|
|
|
+ public ElementSummaryPanel(final Element element) {
|
|
|
GridBagLayout gridBagLayout = new GridBagLayout();
|
|
|
gridBagLayout.columnWidths = new int[]{0, 0, 0};
|
|
|
gridBagLayout.rowHeights = new int[]{0, 0, 0};
|
|
|
@@ -32,7 +32,7 @@ public class ProductSummaryPanel extends JPanel {
|
|
|
gridBagLayout.rowWeights = new double[]{0.0, 1.0, Double.MIN_VALUE};
|
|
|
setLayout(gridBagLayout);
|
|
|
|
|
|
- lblProductName = new JLabel(product.getName());
|
|
|
+ lblProductName = new JLabel(element.getName());
|
|
|
GridBagConstraints gbc_lblProductName = new GridBagConstraints();
|
|
|
gbc_lblProductName.insets = new Insets(0, 0, 5, 5);
|
|
|
gbc_lblProductName.gridx = 0;
|
|
|
@@ -51,9 +51,9 @@ public class ProductSummaryPanel extends JPanel {
|
|
|
|
|
|
listener = new ObservableListener<>(panelIngredients, (c, t) -> {
|
|
|
c.removeAll();
|
|
|
- product.getIngredients().stream().map(SummaryIngredientPanel::new).forEach(c::add);
|
|
|
+ element.getIngredients().stream().map(SummaryIngredientPanel::new).forEach(c::add);
|
|
|
});
|
|
|
- listener.setObserved(product);
|
|
|
+ listener.setObserved(element);
|
|
|
}
|
|
|
|
|
|
@Override
|