Skip to content

Commit

Permalink
Merge pull request #40 from jazzjaikla/jazz-develop-0.8.0.0
Browse files Browse the repository at this point in the history
Jazz develop 0.8.0.0
  • Loading branch information
fabiooliveira72 authored May 10, 2024
2 parents d2a1bb0 + bee0924 commit 3c61a93
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 39 deletions.
9 changes: 8 additions & 1 deletion src/FileXModel/SimulationList.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@ public ModelXBase AddNew(String name, int newLevel, int currentLevel) {
Simulation model = SimulationControlDefaults.Get(FileX.general.FileType);
model.SetName(name);

CropModel cm = CropModelList.GetByCrop(FileX.general.crop.CropCode);
String cropCode = FileX.general.crop.CropCode;
if("".equals(cropCode) && FileX.cultivars.GetSize() > 0){
Cultivar cul = (Cultivar) FileX.cultivars.GetAt(newLevel <= FileX.cultivars.GetSize() ? newLevel : FileX.cultivars.GetSize());
cropCode = cul.CR;
}

CropModel cm = CropModelList.GetByCrop(cropCode);

if (cm != null) {
model.SMODEL = cm.ModelCode;
}
Expand Down
2 changes: 2 additions & 0 deletions src/FileXModel/TreatmentList.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public ModelXBase AddNew(String name, int newLevel, int currentLevel) {
Integer r = Utils.ParseInteger(((Treatment)FileX.treatments.GetAtIndex(FileX.treatments.GetSize() - 1)).R);
model.R = r.toString();
}

model.TNAME = name;
}
else{
model = new Treatment(name);
Expand Down
2 changes: 1 addition & 1 deletion src/ListDialog/CultivarListDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ private void AddDataToTable(Cultivar cul) {
cbCrop.setVisible(false);
jLabel1.setVisible(false);
jLabel2.setVisible(false);
cbCultivar.setInit(null, "INGENO", cul != null ? cul.INGENO : "", CultivarList.GetAt(FileX.general.crop), new XColumn[]{new XColumn("CulName", "Cultivar Name", 200)}, "CropCode");
cbCultivar.setInit(null, "INGENO", cul != null ? cul.INGENO : "", CultivarList.GetAt(FileX.general.crop), new XColumn[]{new XColumn("CulName", "Cultivar Name", 200)}, "CulCode");
this.setPreferredSize(new Dimension(this.getPreferredSize().width, 590));

EventQueue.invokeLater(() -> {
Expand Down
1 change: 1 addition & 0 deletions src/xbuild/Components/InputDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public InputDialog(java.awt.Frame parent, boolean modal, String defaultDescripti
super(parent, modal);
commonConstructor(parent, defaultDescription);
txtDescription.setDocument(new LimitDocument(maxChar));
txtDescription.setText(defaultDescription);
}

private void commonConstructor(java.awt.Frame parent, String defaultDescription){
Expand Down
2 changes: 1 addition & 1 deletion src/xbuild/CultivarsFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public void mouseClicked(java.awt.event.MouseEvent evt) {

private void jXTable1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jXTable1MouseClicked
if (evt.getClickCount() == 2) {
int nRow = jXTable1.getSelectedRow();
int nRow = jXTable1.getSelectedRow() + 1;
Cultivar culEdit = (Cultivar) FileX.cultivars.GetAt(nRow);

final CultivarListDialog dialog = new CultivarListDialog(null, culEdit, true);
Expand Down
3 changes: 0 additions & 3 deletions src/xbuild/MainForm.form
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,6 @@
<Property name="defaultCloseOperation" type="int" value="3"/>
<Property name="title" type="java.lang.String" value=" XB2 v0.8.0.0."/>
</Properties>
<AccessibilityProperties>
<Property name="AccessibleContext.accessibleName" type="java.lang.String" value=" XB2 v0.8.0.0."/>
</AccessibilityProperties>
<SyntheticProperties>
<SyntheticProperty name="menuBar" type="java.lang.String" value="jMenuBar1"/>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
Expand Down
33 changes: 24 additions & 9 deletions src/xbuild/MainForm.java
Original file line number Diff line number Diff line change
Expand Up @@ -945,8 +945,8 @@ private void ShowFrame(IXInternalFrame frame) {
javax.swing.plaf.InternalFrameUI ui = frame.getUI();
((javax.swing.plaf.basic.BasicInternalFrameUI) ui).setNorthPane(null);

desktopPane.add(frame);
try {
try{
desktopPane.add(frame);
frame.setMaximum(true);
} catch (PropertyVetoException ex) {
Logger.getLogger(MainForm.class.getName()).log(Level.SEVERE, null, ex);
Expand Down Expand Up @@ -1389,10 +1389,16 @@ private void addNewLevel(DefaultMutableTreeNode node, ManagementList modelList){
if (modelList != null && !"Cultivars".equals(node.toString())) {
String defaultName = !"Simulation Controls".equals(node.toString()) ? "UNKNOWN" : SimulationControlDefaults.Get(FileX.general.FileType).SNAME;

IXInternalFrame currentFrame = (IXInternalFrame) desktopPane.getSelectedFrame();
int currentLevel = "Treatments".equals(node.toString()) ? currentFrame.getLevel() : -1;
if(currentLevel >= 0){
defaultName = FileX.treatments.GetAt(currentLevel + 1).GetName();
}

InputDialog input = "Treatments".equals(node.toString()) ? new InputDialog(this, true, defaultName, 25) : new InputDialog(this, true, defaultName);
input.show();

input.addWindowListener(new java.awt.event.WindowAdapter() {
input.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosed(WindowEvent e) {
if(input.isOK()){
Expand All @@ -1409,8 +1415,9 @@ public void windowClosed(WindowEvent e) {
}

level++;


modelList.AddNew(nodeName, level, -1);
modelList.AddNew(nodeName, level, currentLevel);

DefaultMutableTreeNode newNode = new DefaultMutableTreeNode();

Expand Down Expand Up @@ -1506,19 +1513,27 @@ else if ("Treatments".equalsIgnoreCase(node.toString()) && !FileXValidationServi
}

currentFrameName = nodeName;
IXInternalFrame frame = XInternalFrame.newInstance(mainMenuList.get(nodeName), node.toString());

if (frame != null) {
IXInternalFrame frame;
int level = node.getParent().getIndex(node);

if("Treatments".equalsIgnoreCase(node.toString())){
frame = (IXInternalFrame) desktopPane.getSelectedFrame();
level = frame.getLevel();
}
else{
frame = XInternalFrame.newInstance(mainMenuList.get(nodeName), node.toString());

if (frame != null) {
ShowFrame(frame);
frame.addMyEventListener(this);

int level = node.getParent().getIndex(node);

frame.setSelection(level + 1);

EventQueue.invokeLater(() -> {
bnDeleteLevel.setEnabled(frame.isDeleteButtonEnabled());
});
}
}
}
}

Expand Down
20 changes: 8 additions & 12 deletions src/xbuild/TreatmentFrame.form
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@
<Column editable="true" title="&lt;html&gt;Rot.&lt;br&gt;Option&lt;/html&gt;" type="java.lang.Object"/>
<Column editable="true" title="&lt;html&gt;Crop&lt;br&gt;Comp.&lt;/html&gt;" type="java.lang.Object"/>
<Column editable="true" title="Description" type="java.lang.Object"/>
<Column editable="true" title="Cultivar" type="java.lang.Object"/>
<Column editable="false" title="Field" type="java.lang.Object"/>
<Column editable="false" title="&lt;html&gt;Initial&lt;br&gt;Conditions&lt;html&gt;" type="java.lang.Object"/>
<Column editable="false" title="&lt;html&gt;Soil&lt;br&gt;Anal.&lt;html&gt;" type="java.lang.Object"/>
<Column editable="false" title="&lt;html&gt;Init.&lt;br&gt;Cond.&lt;html&gt;" type="java.lang.Object"/>
<Column editable="false" title="Plant" type="java.lang.Object"/>
<Column editable="false" title="Irrigat." type="java.lang.Object"/>
<Column editable="false" title="Fertil." type="java.lang.Object"/>
<Column editable="false" title="Resid." type="java.lang.Object"/>
<Column editable="true" title="Cultivar" type="java.lang.Object"/>
<Column editable="false" title="Planting" type="java.lang.Object"/>
<Column editable="false" title="Irrigation" type="java.lang.Object"/>
<Column editable="false" title="Fertililizers" type="java.lang.Object"/>
<Column editable="false" title="&lt;html&gt;Organic&lt;br&gt;Amendments&lt;/html&gt;" type="java.lang.Object"/>
<Column editable="false" title="&lt;html&gt;&lt;p align=&apos;center&apos;&gt;Chem&lt;br&gt;App.&lt;/p&gt;&lt;/html&gt;" type="java.lang.Object"/>
<Column editable="false" title="Tillage" type="java.lang.Object"/>
<Column editable="false" title="&lt;html&gt;&lt;p align=&apos;center&apos;&gt;Env.&lt;br&gt;Mod&lt;/p&gt;&lt;/html&gt;" type="java.lang.Object"/>
Expand Down Expand Up @@ -115,12 +115,8 @@
</Column>
<Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true">
<Title/>
<Editor editor="org.netbeans.modules.form.ComponentChooserEditor">
<ComponentRef name="null"/>
</Editor>
<Renderer editor="org.netbeans.modules.form.ComponentChooserEditor">
<ComponentRef name="null"/>
</Renderer>
<Editor/>
<Renderer/>
</Column>
<Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true">
<Title/>
Expand Down
22 changes: 10 additions & 12 deletions src/xbuild/TreatmentFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@ private void initComponents() {

},
new String [] {
"Level", "<html>Rot.<br>Number</html>", "<html>Rot.<br>Option</html>", "<html>Crop<br>Comp.</html>", "Description", "Cultivar", "Field", "<html>Soil<br>Anal.<html>", "<html>Init.<br>Cond.<html>", "Plant", "Irrigat.", "Fertil.", "Resid.", "<html><p align='center'>Chem<br>App.</p></html>", "Tillage", "<html><p align='center'>Env.<br>Mod</p></html>", "Harvest", "<html><p align='center'>Sim.<br>Contr.</p></html>"
"Level", "<html>Rot.<br>Number</html>", "<html>Rot.<br>Option</html>", "<html>Crop<br>Comp.</html>", "Description", "Field", "<html>Initial<br>Conditions<html>", "<html>Soil<br>Anal.<html>", "Cultivar", "Planting", "Irrigation", "Fertililizers", "<html>Organic<br>Amendments</html>", "<html><p align='center'>Chem<br>App.</p></html>", "Tillage", "<html><p align='center'>Env.<br>Mod</p></html>", "Harvest", "<html><p align='center'>Sim.<br>Contr.</p></html>"
}
) {
Class[] types = new Class [] {
java.lang.Integer.class, java.lang.String.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class
};
boolean[] canEdit = new boolean [] {
true, true, true, true, true, true, false, false, false, false, false, false, false, false, false, false, false, false
true, true, true, true, true, false, false, false, true, false, false, false, false, false, false, false, false, false
};

public Class getColumnClass(int columnIndex) {
Expand All @@ -122,8 +122,6 @@ public boolean isCellEditable(int rowIndex, int columnIndex) {
if (jXTable1.getColumnModel().getColumnCount() > 0) {
jXTable1.getColumnModel().getColumn(0).setPreferredWidth(50);
jXTable1.getColumnModel().getColumn(1).setPreferredWidth(70);
jXTable1.getColumnModel().getColumn(5).setCellEditor(null);
jXTable1.getColumnModel().getColumn(5).setCellRenderer(null);
}

lblLevel1.setText("Treatments");
Expand Down Expand Up @@ -221,12 +219,12 @@ private void LoadTreament() {
row[4] = "";
}
try {
row[5] = treatment.CU;
row[5] = treatment.FL;
} catch (Exception e) {
row[5] = "";
}
try {
row[6] = treatment.FL;
row[6] = treatment.IC;
} catch (Exception e) {
row[6] = "";
}
Expand All @@ -236,7 +234,7 @@ private void LoadTreament() {
row[7] = "";
}
try {
row[8] = treatment.IC;
row[8] = treatment.CU;
} catch (Exception e) {
row[8] = "";
}
Expand Down Expand Up @@ -301,10 +299,10 @@ private void LoadTreament() {
((Treatment)FileX.treatments.GetAtIndex(row)).C = (String) tbModel1.getValueAt(row, 3);
}

((Treatment)FileX.treatments.GetAtIndex(row)).CU = Utils.ParseInteger(tbModel1.getValueAt(row, 5));
((Treatment)FileX.treatments.GetAtIndex(row)).IC = Utils.ParseInteger(tbModel1.getValueAt(row, 5));
((Treatment)FileX.treatments.GetAtIndex(row)).FL = Utils.ParseInteger(tbModel1.getValueAt(row, 6));
((Treatment)FileX.treatments.GetAtIndex(row)).SA = Utils.ParseInteger(tbModel1.getValueAt(row, 7));
((Treatment)FileX.treatments.GetAtIndex(row)).IC = Utils.ParseInteger(tbModel1.getValueAt(row, 8));
((Treatment)FileX.treatments.GetAtIndex(row)).CU = Utils.ParseInteger(tbModel1.getValueAt(row, 8));
((Treatment)FileX.treatments.GetAtIndex(row)).MP = Utils.ParseInteger(tbModel1.getValueAt(row, 9));
((Treatment)FileX.treatments.GetAtIndex(row)).MI = Utils.ParseInteger(tbModel1.getValueAt(row, 10));
((Treatment)FileX.treatments.GetAtIndex(row)).MF = Utils.ParseInteger(tbModel1.getValueAt(row, 11));
Expand All @@ -323,10 +321,10 @@ private void LoadTreament() {

jXTable1.getColumnModel().getColumn(4).setCellEditor(new DescriptionTableCellEditor());

jXTable1.getColumnModel().getColumn(5).setCellEditor(new CultivarTableCellEditor());
jXTable1.getColumnModel().getColumn(6).setCellEditor(new TreatmentTableCellEditor(FileX.fieldList));
jXTable1.getColumnModel().getColumn(5).setCellEditor(new TreatmentTableCellEditor(FileX.fieldList));
jXTable1.getColumnModel().getColumn(6).setCellEditor(new TreatmentTableCellEditor(FileX.initialList));
jXTable1.getColumnModel().getColumn(7).setCellEditor(new TreatmentTableCellEditor(FileX.soilAnalysis));
jXTable1.getColumnModel().getColumn(8).setCellEditor(new TreatmentTableCellEditor(FileX.initialList));
jXTable1.getColumnModel().getColumn(8).setCellEditor(new CultivarTableCellEditor());
jXTable1.getColumnModel().getColumn(9).setCellEditor(new TreatmentTableCellEditor(FileX.plantings));
jXTable1.getColumnModel().getColumn(10).setCellEditor(new TreatmentTableCellEditor(FileX.irrigations));
jXTable1.getColumnModel().getColumn(11).setCellEditor(new TreatmentTableCellEditor(FileX.fertilizerList));
Expand Down

0 comments on commit 3c61a93

Please sign in to comment.