Skip to content

Commit

Permalink
Added component list tab
Browse files Browse the repository at this point in the history
  • Loading branch information
MauveCloud committed Nov 6, 2017
1 parent 7f8b8a8 commit 394c3ce
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Ic2ExpReactorPlanner/Bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -242,3 +242,4 @@ COMPONENT_RESIDUAL_HEAT=R%dC%d:+Had %,.2f heat left after cooldown period.
THICK\ NEUTRON\ REFLECTOR=Thick Neutron Reflector
HEAT_BUILDUP=Reactor heat buildup per tick (while all components are intact):%.2f minimum, %.2f maximum.\n
ReactorPlannerFrame.jLabel16.text=(both temps can be set to match explode temp to mimic having no temperature control)
ReactorPlannerFrame.jScrollPane3.TabConstraints.tabTitle=Component List
12 changes: 12 additions & 0 deletions src/Ic2ExpReactorPlanner/Reactor.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,18 @@ public MaterialsList getMaterials() {
return result;
}

public MaterialsList getComponentList() {
MaterialsList result = new MaterialsList();
for (int col = 0; col < grid[0].length; col++) {
for (int row = 0; row < grid.length; row++) {
if (grid[row][col] != null) {
result.add(ComponentFactory.getDisplayName(grid[row][col]));
}
}
}
return result;
}

/**
* @return the amount of heat vented this reactor tick.
*/
Expand Down
21 changes: 21 additions & 0 deletions src/Ic2ExpReactorPlanner/ReactorPlannerFrame.form
Original file line number Diff line number Diff line change
Expand Up @@ -1193,6 +1193,27 @@
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JScrollPane" name="jScrollPane3">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
<JTabbedPaneConstraints tabName="Component List">
<Property name="tabTitle" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="Ic2ExpReactorPlanner/Bundle.properties" key="ReactorPlannerFrame.jScrollPane3.TabConstraints.tabTitle" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</JTabbedPaneConstraints>
</Constraint>
</Constraints>

<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTextArea" name="componentListArea">
<Properties>
<Property name="columns" type="int" value="20"/>
<Property name="rows" type="int" value="5"/>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>
Expand Down
14 changes: 14 additions & 0 deletions src/Ic2ExpReactorPlanner/ReactorPlannerFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ public void actionPerformed(ActionEvent e) {
}
reactor.setComponentAt(finalRow, finalCol, componentToPlace);
materialsArea.setText(reactor.getMaterials().toString());
componentListArea.setText(reactor.getComponentList().toString());
maxHeatLabel.setText(String.format("/%,.0f", reactor.getMaxHeat()));
temperatureEffectsLabel.setText(String.format("Burn: %,d Evaporate: %,d Hurt: %,d Lava: %,d Explode: %,d", (int) (reactor.getMaxHeat() * 0.4), (int) (reactor.getMaxHeat() * 0.5), (int) (reactor.getMaxHeat() * 0.7), (int) (reactor.getMaxHeat() * 0.85), (int) (reactor.getMaxHeat() * 1.0)));
SpinnerModel model = heatSpinner.getModel();
Expand Down Expand Up @@ -170,6 +171,7 @@ public void mouseClicked(MouseEvent e) {
if (e.getButton() != MouseEvent.BUTTON1) {
reactor.setComponentAt(finalRow, finalCol, null);
materialsArea.setText(reactor.getMaterials().toString());
componentListArea.setText(reactor.getComponentList().toString());
maxHeatLabel.setText(String.format("/%,.0f", reactor.getMaxHeat()));
temperatureEffectsLabel.setText(String.format("Burn: %,d Evaporate: %,d Hurt: %,d Lava: %,d Explode: %,d", (int) (reactor.getMaxHeat() * 0.4), (int) (reactor.getMaxHeat() * 0.5), (int) (reactor.getMaxHeat() * 0.7), (int) (reactor.getMaxHeat() * 0.85), (int) (reactor.getMaxHeat() * 1.0)));
SpinnerModel model = heatSpinner.getModel();
Expand Down Expand Up @@ -324,6 +326,8 @@ private void initComponents() {
jLabel14 = new javax.swing.JLabel();
pauseSpinner = new javax.swing.JSpinner();
jLabel15 = new javax.swing.JLabel();
jScrollPane3 = new javax.swing.JScrollPane();
componentListArea = new javax.swing.JTextArea();

java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("Ic2ExpReactorPlanner/Bundle"); // NOI18N
fileMenu.setText(bundle.getString("ReactorPlannerFrame.fileMenu.text_1")); // NOI18N
Expand Down Expand Up @@ -890,6 +894,12 @@ public void stateChanged(javax.swing.event.ChangeEvent evt) {

outputTabs.addTab(bundle.getString("ReactorPlannerFrame.automationPanel.TabConstraints.tabTitle_1"), automationPanel); // NOI18N

componentListArea.setColumns(20);
componentListArea.setRows(5);
jScrollPane3.setViewportView(componentListArea);

outputTabs.addTab(bundle.getString("ReactorPlannerFrame.jScrollPane3.TabConstraints.tabTitle"), jScrollPane3); // NOI18N

jSplitPane1.setRightComponent(outputTabs);

gridBagConstraints = new java.awt.GridBagConstraints();
Expand Down Expand Up @@ -955,6 +965,7 @@ private void clearGridButtonActionPerformed(java.awt.event.ActionEvent evt) {//G
}
outputArea.setText(null);
materialsArea.setText(reactor.getMaterials().toString());
componentListArea.setText(reactor.getComponentList().toString());
maxHeatLabel.setText(String.format("/%,.0f", reactor.getMaxHeat()));
temperatureEffectsLabel.setText(String.format("Burn: %,d Evaporate: %,d Hurt: %,d Lava: %,d Explode: %,d", (int)(reactor.getMaxHeat() * 0.4), (int)(reactor.getMaxHeat() * 0.5), (int)(reactor.getMaxHeat() * 0.7), (int)(reactor.getMaxHeat() * 0.85), (int)(reactor.getMaxHeat() * 1.0)));
SpinnerModel model = heatSpinner.getModel();
Expand Down Expand Up @@ -1102,6 +1113,7 @@ private void updateReactorButtons() {
}
}
materialsArea.setText(reactor.getMaterials().toString());
componentListArea.setText(reactor.getComponentList().toString());
maxHeatLabel.setText(String.format("/%,.0f", reactor.getMaxHeat()));
temperatureEffectsLabel.setText(String.format("Burn: %,d Evaporate: %,d Hurt: %,d Lava: %,d Explode: %,d", (int)(reactor.getMaxHeat() * 0.4), (int)(reactor.getMaxHeat() * 0.5), (int)(reactor.getMaxHeat() * 0.7), (int)(reactor.getMaxHeat() * 0.85), (int)(reactor.getMaxHeat() * 1.0)));
SpinnerModel model = heatSpinner.getModel();
Expand Down Expand Up @@ -1135,6 +1147,7 @@ public void run() {
private javax.swing.JToggleButton componentHeatExchangerButton;
private javax.swing.JSpinner componentHeatSpinner;
private javax.swing.JToggleButton componentHeatVentButton;
private javax.swing.JTextArea componentListArea;
private javax.swing.ButtonGroup componentsGroup;
private javax.swing.JPanel componentsPanel;
private javax.swing.JToggleButton containmentReactorPlatingButton;
Expand Down Expand Up @@ -1184,6 +1197,7 @@ public void run() {
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JSplitPane jSplitPane1;
private javax.swing.JSplitPane jSplitPane2;
private javax.swing.JSplitPane jSplitPane3;
Expand Down

0 comments on commit 394c3ce

Please sign in to comment.