|
@@ -16,6 +16,7 @@ import javax.swing.JButton;
|
|
import javax.swing.JFrame;
|
|
import javax.swing.JFrame;
|
|
import javax.swing.JLabel;
|
|
import javax.swing.JLabel;
|
|
import javax.swing.JPanel;
|
|
import javax.swing.JPanel;
|
|
|
|
+import javax.swing.JScrollPane;
|
|
import javax.swing.JSeparator;
|
|
import javax.swing.JSeparator;
|
|
import javax.swing.JTextField;
|
|
import javax.swing.JTextField;
|
|
import javax.swing.SpringLayout;
|
|
import javax.swing.SpringLayout;
|
|
@@ -29,12 +30,13 @@ import ui.controller.FlexManager.FlexWrapper;
|
|
import ui.model.DecoratedGroupNode;
|
|
import ui.model.DecoratedGroupNode;
|
|
import ui.model.DecoratedHolonObject.HolonObjectState;
|
|
import ui.model.DecoratedHolonObject.HolonObjectState;
|
|
import ui.model.DecoratedState;
|
|
import ui.model.DecoratedState;
|
|
|
|
+import ui.model.VisualRepresentationalState;
|
|
|
|
|
|
public class InformationPanel implements AddOn {
|
|
public class InformationPanel implements AddOn {
|
|
Control control;
|
|
Control control;
|
|
|
|
|
|
private JPanel content = new JPanel();
|
|
private JPanel content = new JPanel();
|
|
-
|
|
|
|
|
|
+ private JScrollPane scrollPane;
|
|
|
|
|
|
|
|
|
|
//Fields
|
|
//Fields
|
|
@@ -64,10 +66,10 @@ public class InformationPanel implements AddOn {
|
|
private int amountConsumingFlexibilities;
|
|
private int amountConsumingFlexibilities;
|
|
private int amountProducingFlexibilities;
|
|
private int amountProducingFlexibilities;
|
|
private int amountPassiv;
|
|
private int amountPassiv;
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+
|
|
private int amountHolons;
|
|
private int amountHolons;
|
|
|
|
+ private float averageConsumption;
|
|
|
|
+ private float averageProduction;
|
|
|
|
|
|
List<Entry> entryList = new ArrayList<Entry>();
|
|
List<Entry> entryList = new ArrayList<Entry>();
|
|
|
|
|
|
@@ -78,11 +80,17 @@ public class InformationPanel implements AddOn {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
public InformationPanel(){
|
|
public InformationPanel(){
|
|
content.setLayout(new BorderLayout());
|
|
content.setLayout(new BorderLayout());
|
|
- content.add(createMiddlePanel(), BorderLayout.CENTER);
|
|
|
|
|
|
+ scrollPane = new JScrollPane(createMiddlePanel(), JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
|
|
|
|
+ JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
|
|
|
|
+ int size = 75;
|
|
|
|
+ scrollPane.setPreferredSize(new Dimension(16*size, 9*size));
|
|
|
|
+ content.add(scrollPane, BorderLayout.CENTER);
|
|
JButton button = new JButton("calculate");
|
|
JButton button = new JButton("calculate");
|
|
button.addActionListener(action -> updateEntrys());
|
|
button.addActionListener(action -> updateEntrys());
|
|
content.add(button, BorderLayout.SOUTH);
|
|
content.add(button, BorderLayout.SOUTH);
|
|
@@ -103,8 +111,7 @@ public class InformationPanel implements AddOn {
|
|
JPanel middle = new JPanel();
|
|
JPanel middle = new JPanel();
|
|
middle.setLayout(new GridBagLayout());
|
|
middle.setLayout(new GridBagLayout());
|
|
|
|
|
|
- int size = 75;
|
|
|
|
- middle.setPreferredSize(new Dimension(16*size, 9*size));
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
entryList.add(new Entry(() -> Integer.toString(amountHolonObjects), "amountHolonObjects", middle));
|
|
entryList.add(new Entry(() -> Integer.toString(amountHolonObjects), "amountHolonObjects", middle));
|
|
@@ -140,6 +147,9 @@ public class InformationPanel implements AddOn {
|
|
entryList.add(new Entry(() -> Integer.toString(amountActiveEssential) + addPercentage(amountActiveEssential, amountActiveFlexibilities), "\tamountActiveEssential", middle));
|
|
entryList.add(new Entry(() -> Integer.toString(amountActiveEssential) + addPercentage(amountActiveEssential, amountActiveFlexibilities), "\tamountActiveEssential", middle));
|
|
addSeperator(middle);
|
|
addSeperator(middle);
|
|
entryList.add(new Entry(() -> Integer.toString(amountHolons), "amountHolons", middle));
|
|
entryList.add(new Entry(() -> Integer.toString(amountHolons), "amountHolons", middle));
|
|
|
|
+ addSeperator(middle);
|
|
|
|
+ entryList.add(new Entry(() -> String.format (Locale.US, "%.2f", averageConsumption), "averageConsumption", middle));
|
|
|
|
+ entryList.add(new Entry(() -> String.format (Locale.US, "%.2f", averageProduction), "averageProduction", middle));
|
|
|
|
|
|
return middle;
|
|
return middle;
|
|
}
|
|
}
|
|
@@ -223,10 +233,10 @@ public class InformationPanel implements AddOn {
|
|
amountActiveMedium = (int)flexActiveList.stream().filter(flex -> flex.getElement().getPriority() == Priority.Medium).count();
|
|
amountActiveMedium = (int)flexActiveList.stream().filter(flex -> flex.getElement().getPriority() == Priority.Medium).count();
|
|
amountActiveLow = (int)flexActiveList.stream().filter(flex -> flex.getElement().getPriority() == Priority.Low).count();
|
|
amountActiveLow = (int)flexActiveList.stream().filter(flex -> flex.getElement().getPriority() == Priority.Low).count();
|
|
this.amountActiveFlexibilities = amountActiveEssential + amountActiveHigh + amountActiveMedium + amountActiveLow;
|
|
this.amountActiveFlexibilities = amountActiveEssential + amountActiveHigh + amountActiveMedium + amountActiveLow;
|
|
-
|
|
|
|
- amountHolons = control.getSimManager().getActualVisualRepresentationalState().getAmountOfHolons();
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ VisualRepresentationalState visualState =control.getSimManager().getActualVisualRepresentationalState();
|
|
|
|
+ amountHolons = visualState.getAmountOfHolons();
|
|
|
|
+ averageConsumption = visualState.getAverageConsumption();
|
|
|
|
+ averageProduction = visualState.getAverageProduction();
|
|
int cost = 0;
|
|
int cost = 0;
|
|
int consumingFlex = 0;
|
|
int consumingFlex = 0;
|
|
float consumingFlexEnergy = 0.0f;
|
|
float consumingFlexEnergy = 0.0f;
|