|
|
@@ -14,14 +14,23 @@ import org.leumasjaffe.observer.ObservableListener;
|
|
|
import org.leumasjaffe.observer.ObserverDispatch;
|
|
|
import org.leumasjaffe.recipe.model.Ingredient;
|
|
|
|
|
|
+import lombok.AccessLevel;
|
|
|
+import lombok.Getter;
|
|
|
+import lombok.experimental.FieldDefaults;
|
|
|
+
|
|
|
import javax.swing.JFormattedTextField;
|
|
|
import java.awt.Font;
|
|
|
import javax.swing.JLabel;
|
|
|
|
|
|
@SuppressWarnings("serial")
|
|
|
+@FieldDefaults(level=AccessLevel.PRIVATE, makeFinal=true)
|
|
|
public class IngredientPreparationPanel extends JPanel {
|
|
|
|
|
|
- private ObservableListener<IngredientPreparationPanel, Ingredient> listener;
|
|
|
+ ObservableListener<IngredientPreparationPanel, Ingredient> listener;
|
|
|
+ @Getter(AccessLevel.PACKAGE) JTextField txtName;
|
|
|
+ @Getter(AccessLevel.PACKAGE) JFormattedTextField txtAmount;
|
|
|
+ @Getter(AccessLevel.PACKAGE) JTextField txtUnit;
|
|
|
+ @Getter(AccessLevel.PACKAGE) JTextField txtPreparation;
|
|
|
|
|
|
public IngredientPreparationPanel(final Ingredient ingredient) {
|
|
|
GridBagLayout gridBagLayout = new GridBagLayout();
|
|
|
@@ -39,7 +48,7 @@ public class IngredientPreparationPanel extends JPanel {
|
|
|
gbc_label.gridy = 0;
|
|
|
add(label, gbc_label);
|
|
|
|
|
|
- JTextField txtName = new JTextField(ingredient.getName());
|
|
|
+ txtName = new JTextField(ingredient.getName());
|
|
|
txtName.setEditable(false);
|
|
|
txtName.setFont(new Font("Source Code Pro", Font.PLAIN, 10));
|
|
|
GridBagConstraints gbc_txtName = new GridBagConstraints();
|
|
|
@@ -53,7 +62,7 @@ public class IngredientPreparationPanel extends JPanel {
|
|
|
NumberFormatter fmtDone = new NumberFormatter(NumberFormat.getNumberInstance(Locale.getDefault()));
|
|
|
fmtDone.setMinimum(0.0);
|
|
|
fmtDone.setCommitsOnValidEdit(true);
|
|
|
- JFormattedTextField txtAmount = new JFormattedTextField(fmtDone);
|
|
|
+ txtAmount = new JFormattedTextField(fmtDone);
|
|
|
txtAmount.setEditable(false);
|
|
|
txtAmount.setValue(ingredient.getAmount().getValue());
|
|
|
txtAmount.setFont(new Font("Source Code Pro", Font.PLAIN, 10));
|
|
|
@@ -65,7 +74,7 @@ public class IngredientPreparationPanel extends JPanel {
|
|
|
add(txtAmount, gbc_txtAmount);
|
|
|
txtAmount.setColumns(4);
|
|
|
|
|
|
- JTextField txtUnit = new JTextField(ingredient.getAmount().unitName());
|
|
|
+ txtUnit = new JTextField(ingredient.getAmount().unitName());
|
|
|
txtUnit.setEditable(false);
|
|
|
txtUnit.setFont(new Font("Source Code Pro", Font.PLAIN, 10));
|
|
|
GridBagConstraints gbc_txtUnit = new GridBagConstraints();
|
|
|
@@ -77,7 +86,7 @@ public class IngredientPreparationPanel extends JPanel {
|
|
|
add(txtUnit, gbc_txtUnit);
|
|
|
txtUnit.setColumns(6);
|
|
|
|
|
|
- JTextField txtPreparation = new JTextField(ingredient.getPreparation());
|
|
|
+ txtPreparation = new JTextField(ingredient.getPreparation());
|
|
|
txtPreparation.setEditable(false);
|
|
|
txtPreparation.setFont(new Font("Source Code Pro", Font.PLAIN, 10));
|
|
|
GridBagConstraints gbc_txtPreparation = new GridBagConstraints();
|