Skip to content

Commit

Permalink
Merge pull request #1189 from specify/v6.8.03
Browse files Browse the repository at this point in the history
Update to v6.8.03
  • Loading branch information
grantfitzsimmons committed Mar 6, 2023
2 parents bd3da81 + cce5ce9 commit 945d28f
Show file tree
Hide file tree
Showing 30 changed files with 333 additions and 103 deletions.
8 changes: 4 additions & 4 deletions .install4j/i4jparams.conf
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<config install4jVersion="5.0.8" install4jBuild="5311" type="windows" archive="false">
<general applicationName="Specify" applicationVersion="6.8.02" mediaSetId="176" applicationId="5397-6897-2502-8965" status="LCOK" mediaName="Specify_windows" jreVersion="" minJavaVersion="1.6" publisherName="Biodiversity Research Center, University of Kansas" publisherURL="http://www.specifysoftware.org" jreShared="false" lzmaCompression="false" pack200Compression="false" installerType="1" addOnAppId="" suggestPreviousLocations="false" uninstallerFilename="uninstall" uninstallerDirectory="." defaultInstallationDirectory="{appdir}{/}Specify" />
<general applicationName="Specify" applicationVersion="6.8.03" mediaSetId="176" applicationId="5397-6897-2502-8965" status="LCOK" mediaName="Specify_windows" jreVersion="" minJavaVersion="1.6" publisherName="Biodiversity Research Center, University of Kansas" publisherURL="http://www.specifysoftware.org" jreShared="false" lzmaCompression="false" pack200Compression="false" installerType="1" addOnAppId="" suggestPreviousLocations="false" uninstallerFilename="uninstall" uninstallerDirectory="." defaultInstallationDirectory="{appdir}{/}Specify" />
<languages skipLanguageSelection="false" languageSelectionInPrincipalLanguage="false">
<variable id="en" name="English" messageFile="i4j_extf_0_zpmake.utf8" customLocalizationFile="i4j_extf_1_zpmake.utf8" />
<variable id="pt" name="Portuguese" messageFile="i4j_extf_2_zpmake.utf8" customLocalizationFile="i4j_extf_3_zpmake.utf8" />
</languages>
<compilerVariables>
<variable name="sys.version" value="6.8.02" />
<variable name="sys.version" value="6.8.03" />
<variable name="sys.shortName" value="Specify" />
<variable name="sys.fullName" value="Specify" />
<variable name="sys.publisher" value="Biodiversity Research Center, University of Kansas" />
Expand Down Expand Up @@ -114,7 +114,7 @@
</void>
</void>
<void property="subTitle">
<string>Specify 6.8.02 includes the following changes:</string>
<string>Specify 6.8.03 includes the following changes:</string>
</void>
<void property="title">
<string>New This Release</string>
Expand Down Expand Up @@ -207,7 +207,7 @@
<java class="java.beans.XMLDecoder">
<object class="com.install4j.runtime.beans.actions.desktop.RegisterAddRemoveAction">
<void property="itemName">
<string>Specify 6.8.02</string>
<string>Specify 6.8.03</string>
</void>
</object>
</java>
Expand Down
2 changes: 1 addition & 1 deletion packaging/readme.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<body>
<h3>Greetings from the Specify Collections Consortium Lab!
<br>
<p> <a href="https://discourse.specifysoftware.org/t/specify-6-8-02-and-schema-2-10-release-notes/830">Release Notes for Specify 6.8.02 are available here.</a></p></h3>
<p> <a href="https://discourse.specifysoftware.org/t/specify-6-8-03-release-notes/1050">Release Notes for Specify 6.8.03 are available here.</a></p></h3>
</body>
</html>
18 changes: 13 additions & 5 deletions src/edu/ku/brc/af/ui/forms/FormViewObj.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import java.beans.PropertyChangeListener;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Calendar;
Expand All @@ -57,7 +58,6 @@
import java.util.Map;
import java.util.Set;
import java.util.Vector;

import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.BorderFactory;
Expand Down Expand Up @@ -88,8 +88,6 @@
import javax.swing.SwingUtilities;

import edu.ku.brc.specify.datamodel.CollectionObject;
import edu.ku.brc.specify.datamodel.Determination;
import edu.ku.brc.specify.datamodel.Taxon;
import edu.ku.brc.ui.*;
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.lang.StringUtils;
Expand Down Expand Up @@ -5297,7 +5295,7 @@ protected void setDataIntoUI(final boolean doResetAfterFill,
}

Object[] values = UIHelper.getFieldValues(cellField.getFieldNames(), dataObj, dg);

setDataIntoUIComp(comp, DataObjFieldFormatMgr.getInstance().format(values[0], dataObjFormatName), defaultValue);

} else
Expand Down Expand Up @@ -5839,7 +5837,17 @@ public static void setDataIntoUIComp(final Component comp, final Object data, fi
} else if (comp instanceof JTextField)
{
JTextField tf = (JTextField)comp;
tf.setText(data == null ? "" : data.toString());
tf.setText(
data == null
? ""
// If the BigDecimal is an integer and not zero, format it to #.0
// otherwise, strip the zeros
: data instanceof BigDecimal
? ((((BigDecimal)data).stripTrailingZeros().scale() <= 0 && ((BigDecimal)data).signum() != 0)
? ((BigDecimal)data).stripTrailingZeros().setScale(1).toPlainString()
: ((BigDecimal)data).stripTrailingZeros().toPlainString())
: data.toString()
);
tf.setCaretPosition(0);

} else if (comp instanceof JTextArea)
Expand Down
8 changes: 8 additions & 0 deletions src/edu/ku/brc/af/ui/forms/ViewFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
import edu.ku.brc.af.ui.forms.validation.ValidatedJPanel;
import edu.ku.brc.af.ui.weblink.WebLinkButton;
import edu.ku.brc.exceptions.ConfigurationException;
import edu.ku.brc.specify.plugins.LocalityWorldWindPlugin;
import edu.ku.brc.specify.plugins.SeriesProcCatNumPlugin;
import edu.ku.brc.ui.ColorChooser;
import edu.ku.brc.ui.ColorWrapper;
Expand Down Expand Up @@ -1096,6 +1097,13 @@ protected static UIPluginable createPlugin(final MultiView parent,
}
}
}
} else if (uiPlugin instanceof LocalityWorldWindPlugin)
{
if (UIHelper.getOSType().equals(UIHelper.OSTYPE.MacOSX))
{
log.error("The WorldWind plugin has been deprecated on MACOS and was hidden on the form");
return null;
}
}

// This needs to be done before the initialize.
Expand Down
22 changes: 15 additions & 7 deletions src/edu/ku/brc/af/ui/forms/formatters/UIFieldFormatter.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import edu.ku.brc.af.core.db.AutoNumberIFace;
import edu.ku.brc.af.prefs.AppPrefsCache;
import edu.ku.brc.af.ui.forms.formatters.UIFieldFormatterField.FieldType;
import edu.ku.brc.ui.DateWrapper;
import edu.ku.brc.ui.UIRegistry;
import edu.ku.brc.util.Pair;
Expand Down Expand Up @@ -458,7 +459,7 @@ public Number getMinValue()
{
if (minValue == null && dataClass == BigDecimal.class)
{
minValue = Double.MIN_VALUE;
minValue = -Double.MAX_VALUE;
}
return minValue;
}
Expand Down Expand Up @@ -615,7 +616,7 @@ public String toPattern()
StringBuilder str = new StringBuilder();
for (UIFieldFormatterField field : fields)
{
str.append(field.getValue());
str.append(field.getValue());
}
return str.toString();
}
Expand Down Expand Up @@ -765,13 +766,20 @@ public Object formatToUI(Object...datas)
//fmt = "%" + (size-2) + ".2f";

/*
* using doubleValue() eliminates trailing zeroes but
* that leads to conflict with the way big decimals are
* displayed in view mode on forms and in query results
* This was originally being cast to a double and then converted to string.
* This may cause unwanted issues when displaying certain values.
* (See https://stackoverflow.com/questions/16098046/how-do-i-print-a-double-value-without-scientific-notation-using-java)
* To avoid these issues, the BigDecimal is first stripped of it's trailing zeros and then directly converted to string.
*/
//return String.valueOf(((Number )data).doubleValue());
BigDecimal strippedDecimal = ((BigDecimal) data).stripTrailingZeros();

return String.valueOf(data);
// If the BigDecimal is an integer and not zero
if (strippedDecimal.scale() <= 0 && strippedDecimal.signum() != 0)
{
// Add a decimal place so the format is #.0
strippedDecimal = strippedDecimal.setScale(1);
}
return strippedDecimal.toPlainString();
} else
{
//fmt = "%d";
Expand Down
10 changes: 5 additions & 5 deletions src/edu/ku/brc/af/ui/forms/formatters/UIFieldFormatterField.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ public UIFieldFormatterField(final FieldType type,
this.minSize = minSize;
this.value = value;
if (type.equals(FieldType.regex)) {
this.regex = value;
this.value = pattern;
this.regex = value;
this.value = pattern;
}
this.incrementer = incrementer;
this.byYear = byYear;
Expand Down Expand Up @@ -299,7 +299,7 @@ public String getSample()
{
return value.substring(0, value.length());
}

if (sample.length() == 0)
{
return "";
Expand Down Expand Up @@ -354,7 +354,7 @@ public String getRegExpGrp(int idx) {
}
return result;
}

public boolean isOptional() {
return isOptional;
}
Expand Down Expand Up @@ -458,7 +458,7 @@ public void setByYear(boolean byYear)
{
this.byYear = byYear;
}

public boolean isCurrentYear()
{
return ((type == FieldType.year) && (value.equals("YEAR")));
Expand Down
15 changes: 10 additions & 5 deletions src/edu/ku/brc/af/ui/forms/formatters/UIFormatterEditorDlg.java
Original file line number Diff line number Diff line change
Expand Up @@ -500,8 +500,8 @@ private void typeChanged()
FieldType fieldType = (FieldType)fieldTypeCbx.getSelectedItem();
switch (fieldType)
{
case alphanumeric :
case alpha :
case alphanumeric : break;
case alpha : break;
case anychar :
cardKey = "size";
break;
Expand All @@ -522,6 +522,8 @@ private void typeChanged()
case year :
cardKey = "none";
break;

default: break;
}
}
cardLayout.show(cardPanel, cardKey);
Expand Down Expand Up @@ -805,7 +807,8 @@ protected void updateEnabledState()
// save Btn
if (currentField != null)
{
fieldsPanel.getEditBtn().setEnabled(fieldHasChanged && (currentField.getType() == FieldType.constant ? !fieldTxt.getText().isEmpty() : true));
fieldsPanel.getEditBtn().setEnabled(fieldHasChanged && (currentField.getType() == FieldType.constant ?
!fieldTxt.getText().isEmpty() : true));
}

orderUpBtn.setEnabled(inx > 0);
Expand Down Expand Up @@ -849,7 +852,8 @@ protected void getDataFromUI()
if (fields.size() == 1 && fields.get(0).getType() == FieldType.numeric)
{
//selectedFormat.setType(UIFieldFormatterIFace.FormatterType.numeric);
} else
}
else
{
selectedFormat.setType(UIFieldFormatterIFace.FormatterType.generic);
}
Expand Down Expand Up @@ -972,7 +976,7 @@ protected void changed(DocumentEvent e)
}

/**
* @param txtFld
* @param currLen
* @param maxLen
* @return
*/
Expand Down Expand Up @@ -1086,6 +1090,7 @@ protected void updateUIEnabled()
case year :
totalLen += 4;
break;

}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@

/**
* A Multiple JTextFields (wrapped inside a JPanel) that provides for "formatted" input. The format "mask" is define in XML
* via the UIFieldFormatterMgr class. This is idea for text fields that have a standard size and a specific format (i.e. Dates)
* via the UIFieldFormatterMgr class. This is ideal for text fields that have a standard size and a specific format (i.e. Dates)
* The mask enables the "fields" and separators to be specifically defined.
*
* NOTE: This impl has multiple Text Field, one for each part of the format.
Expand Down Expand Up @@ -1186,9 +1186,10 @@ public String getFmtVal(final String strValue, final Object value) {
}
needsUpdating = (StringUtils.isEmpty(strValue) || strValue.length() != formatter.getLength() || strValue.contains("#"))
&& formatter.getAutoNumber() != null && formatter.isIncrementer();

fmtVal = (String)formatter.formatToUI(strValue);


} else {
if (value == null) {
needsUpdating = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ protected UIValidatable.ErrorType validateNumeric(final String value)
try {
if (cls == BigDecimal.class) {
if (bdValidator == null) {
bdValidator = CurrencyValidator.getInstance();
bdValidator = BigDecimalValidator.getInstance();
}

Number maxVal = formatter.getMaxValue();
Expand Down

0 comments on commit 945d28f

Please sign in to comment.