|
|
@@ -1,5 +1,6 @@
|
|
|
package org.leumasjaffe.recipe.view.summary;
|
|
|
|
|
|
+import java.awt.Dimension;
|
|
|
import java.awt.GridBagConstraints;
|
|
|
import java.awt.GridBagLayout;
|
|
|
import java.awt.Insets;
|
|
|
@@ -20,6 +21,7 @@ import org.leumasjaffe.recipe.model.Element;
|
|
|
import org.leumasjaffe.recipe.model.RecipeCard;
|
|
|
import org.leumasjaffe.recipe.view.CollatedDurationPanel;
|
|
|
import org.leumasjaffe.recipe.view.ImagePanel;
|
|
|
+import org.leumasjaffe.recipe.view.TagInputPanel;
|
|
|
import org.leumasjaffe.recipe.viewmodel.ScaleFactor;
|
|
|
|
|
|
import lombok.AccessLevel;
|
|
|
@@ -40,6 +42,7 @@ public class SummaryPanel extends JPanel {
|
|
|
|
|
|
JTextField txtTitle;
|
|
|
JTextArea txaDescription;
|
|
|
+ TagInputPanel panelTags;
|
|
|
JSpinner spnServings;
|
|
|
JSpinner spnServingsToMake;
|
|
|
|
|
|
@@ -53,9 +56,9 @@ public class SummaryPanel extends JPanel {
|
|
|
|
|
|
GridBagLayout gridBagLayout = new GridBagLayout();
|
|
|
gridBagLayout.columnWidths = new int[]{0, 0, 0};
|
|
|
- gridBagLayout.rowHeights = new int[]{0, 0, 0, 0, 0};
|
|
|
+ gridBagLayout.rowHeights = new int[]{0, 0, 0, 0};
|
|
|
gridBagLayout.columnWeights = new double[]{1.0, 0.0, Double.MIN_VALUE};
|
|
|
- gridBagLayout.rowWeights = new double[]{0.0, 1.0, 1.0, 1.0, Double.MIN_VALUE};
|
|
|
+ gridBagLayout.rowWeights = new double[]{0.0, 1.0, 1.0, Double.MIN_VALUE};
|
|
|
setLayout(gridBagLayout);
|
|
|
|
|
|
JPanel panelHeader = new JPanel();
|
|
|
@@ -121,7 +124,7 @@ public class SummaryPanel extends JPanel {
|
|
|
|
|
|
JPanel panelIngredients = new JPanel();
|
|
|
GridBagConstraints gbc_panelIngredients = new GridBagConstraints();
|
|
|
- gbc_panelIngredients.insets = new Insets(0, 0, 5, 5);
|
|
|
+ gbc_panelIngredients.insets = new Insets(0, 0, 0, 5);
|
|
|
gbc_panelIngredients.fill = GridBagConstraints.BOTH;
|
|
|
gbc_panelIngredients.gridx = 0;
|
|
|
gbc_panelIngredients.gridy = 2;
|
|
|
@@ -131,16 +134,15 @@ public class SummaryPanel extends JPanel {
|
|
|
JPanel panel = new JPanel();
|
|
|
GridBagConstraints gbc_panel = new GridBagConstraints();
|
|
|
gbc_panel.gridheight = 2;
|
|
|
- gbc_panel.insets = new Insets(0, 0, 5, 0);
|
|
|
gbc_panel.fill = GridBagConstraints.BOTH;
|
|
|
gbc_panel.gridx = 1;
|
|
|
gbc_panel.gridy = 1;
|
|
|
add(panel, gbc_panel);
|
|
|
GridBagLayout gbl_panel = new GridBagLayout();
|
|
|
gbl_panel.columnWidths = new int[]{0, 0};
|
|
|
- gbl_panel.rowHeights = new int[]{0, 0, 0};
|
|
|
+ gbl_panel.rowHeights = new int[]{0, 0, 0, 0};
|
|
|
gbl_panel.columnWeights = new double[]{1.0, Double.MIN_VALUE};
|
|
|
- gbl_panel.rowWeights = new double[]{0.0, 1.0, Double.MIN_VALUE};
|
|
|
+ gbl_panel.rowWeights = new double[]{0.0, 0.0, 1.0, Double.MIN_VALUE};
|
|
|
panel.setLayout(gbl_panel);
|
|
|
|
|
|
JPanel panelPhoto = new ImagePanel();
|
|
|
@@ -151,14 +153,24 @@ public class SummaryPanel extends JPanel {
|
|
|
gbc_panelPhoto.gridy = 0;
|
|
|
panel.add(panelPhoto, gbc_panelPhoto);
|
|
|
|
|
|
+ JPanel wrapper = new JPanel(new VerticalLayout());
|
|
|
+ panelTags = new TagInputPanel();
|
|
|
+ panelTags.setPreferredSize(new Dimension(200, 100));
|
|
|
+ GridBagConstraints gbc_panelTags = new GridBagConstraints();
|
|
|
+ gbc_panelTags.insets = new Insets(0, 0, 5, 0);
|
|
|
+ gbc_panelTags.fill = GridBagConstraints.BOTH;
|
|
|
+ gbc_panelTags.gridx = 0;
|
|
|
+ gbc_panelTags.gridy = 1;
|
|
|
+ panel.add(wrapper, gbc_panelTags);
|
|
|
+ wrapper.add(panelTags);
|
|
|
+
|
|
|
txaDescription = new JTextArea(5, 20);
|
|
|
txaDescription.setWrapStyleWord(true);
|
|
|
txaDescription.setLineWrap(true);
|
|
|
GridBagConstraints gbc_txaDescription = new GridBagConstraints();
|
|
|
- gbc_txaDescription.insets = new Insets(0, 0, 5, 0);
|
|
|
gbc_txaDescription.fill = GridBagConstraints.BOTH;
|
|
|
gbc_txaDescription.gridx = 0;
|
|
|
- gbc_txaDescription.gridy = 1;
|
|
|
+ gbc_txaDescription.gridy = 2;
|
|
|
panel.add(txaDescription, gbc_txaDescription);
|
|
|
|
|
|
titleBinding = new TextBinding<>(txtTitle,
|
|
|
@@ -191,6 +203,7 @@ public class SummaryPanel extends JPanel {
|
|
|
}
|
|
|
|
|
|
public void setModel(final RecipeCard card) {
|
|
|
+ panelTags.setModel(card.getTags());
|
|
|
titleBinding.setModel(card);
|
|
|
servingsBinding.setModel(card);
|
|
|
descriptionBinding.setModel(card);
|