|
@@ -3,9 +3,8 @@ package org.leumasjaffe.recipe.view;
|
|
|
import javax.swing.JPanel;
|
|
import javax.swing.JPanel;
|
|
|
import javax.swing.JScrollPane;
|
|
import javax.swing.JScrollPane;
|
|
|
|
|
|
|
|
|
|
+import org.leumasjaffe.recipe.model.Card;
|
|
|
import org.leumasjaffe.recipe.model.Product;
|
|
import org.leumasjaffe.recipe.model.Product;
|
|
|
-import org.leumasjaffe.recipe.model.RecipeComponent;
|
|
|
|
|
-import org.leumasjaffe.recipe.model.Rest;
|
|
|
|
|
import org.jdesktop.swingx.VerticalLayout;
|
|
import org.jdesktop.swingx.VerticalLayout;
|
|
|
|
|
|
|
|
import javax.swing.JButton;
|
|
import javax.swing.JButton;
|
|
@@ -18,30 +17,16 @@ public class ProductPanel extends JScrollPane {
|
|
|
JPanel panelColumnHeader = new JPanel();
|
|
JPanel panelColumnHeader = new JPanel();
|
|
|
setColumnHeaderView(panelColumnHeader);
|
|
setColumnHeaderView(panelColumnHeader);
|
|
|
|
|
|
|
|
- JButton btnAddStep = new JButton("Add Step");
|
|
|
|
|
|
|
+ JButton btnAddStep = new JButton("Add Card");
|
|
|
panelColumnHeader.add(btnAddStep);
|
|
panelColumnHeader.add(btnAddStep);
|
|
|
|
|
|
|
|
panelViewPort = new JPanel();
|
|
panelViewPort = new JPanel();
|
|
|
setViewportView(panelViewPort);
|
|
setViewportView(panelViewPort);
|
|
|
panelViewPort.setLayout(new VerticalLayout(5));
|
|
panelViewPort.setLayout(new VerticalLayout(5));
|
|
|
|
|
|
|
|
- for (RecipeComponent comp : product.getComponents()) {
|
|
|
|
|
- if (comp instanceof Rest) {
|
|
|
|
|
- addRest((Rest) comp);
|
|
|
|
|
- } else if (comp instanceof Product.Phase) {
|
|
|
|
|
- addPhase((Product.Phase) comp);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ for (final Card card : product.getCards()) {
|
|
|
|
|
+ panelViewPort.add(new CardPanel(card));
|
|
|
|
|
+ panelViewPort.add(new JSeparator());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- void addPhase(final Product.Phase phase) {
|
|
|
|
|
- panelViewPort.add(new PhasePanel(phase));
|
|
|
|
|
- panelViewPort.add(new JSeparator());
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- void addRest(final Rest rest) {
|
|
|
|
|
- panelViewPort.add(new RestPanel(rest));
|
|
|
|
|
- panelViewPort.add(new JSeparator());
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|