* flatpak file updated

* add sha generator

* fix mail

* remove mail

* Mini Toggle Switch - lugs do not get rotated when changing orientation;
rotate from the context menu doesn't work

* Added 'SVG Image' component

* Fixed the issue with Perf Board, Vero Board and TriPad Board sometimes
rendering an extra row with pads when there's no space for them

* release 4.18
This commit is contained in:
Bane Stojkovic
2021-07-11 15:05:11 +02:00
committed by GitHub
parent ad8d719eeb
commit 878d048040
26 changed files with 605 additions and 16 deletions
@@ -30,6 +30,7 @@ import javax.swing.JLabel;
import org.apache.log4j.Logger;
import org.diylc.common.PropertyWrapper;
import org.diylc.components.misc.LoadlineEntity;
import org.diylc.core.annotations.ByteArrayProperty;
import org.diylc.core.annotations.DynamicList;
import org.diylc.core.annotations.MultiLineText;
import org.diylc.core.measures.AbstractMeasure;
@@ -77,8 +78,17 @@ public class FieldEditorFactory {
MeasureArrayEditor editor = new MeasureArrayEditor(property);
return editor;
}
if (byte[].class.isAssignableFrom(property.getType())) {
ImageEditor editor = new ImageEditor(property);
if (byte[].class.isAssignableFrom(property.getType())) {
ByteArrayProperty annotation = null;
try {
property.getGetter().isAnnotationPresent(ByteArrayProperty.class);
annotation = property.getGetter().getAnnotation(ByteArrayProperty.class);
} catch (SecurityException e) {
LOG.error("Error while reading ByteArrayProperty annotation", e);
} catch (NoSuchMethodException e) {
LOG.error("Error while reading ByteArrayProperty annotation", e);
}
ImageEditor editor = new ImageEditor(property, annotation == null ? null : annotation.binaryType());
return editor;
}
if (property.getType().isEnum()) {
@@ -27,6 +27,7 @@ import javax.swing.JButton;
import org.apache.log4j.Logger;
import org.apache.poi.util.IOUtils;
import org.diylc.common.PropertyWrapper;
import org.diylc.core.annotations.BinaryType;
import org.diylc.swing.gui.DialogFactory;
import org.diylc.swing.plugins.file.FileFilterEnum;
@@ -38,16 +39,19 @@ public class ImageEditor extends JButton {
private static final String title = "Click to load image file";
public ImageEditor(final PropertyWrapper property) {
private BinaryType binaryType;
public ImageEditor(final PropertyWrapper property, BinaryType binaryType) {
super(property.isUnique() ? title : ("(multi value) " + title));
this.binaryType = binaryType;
if (property.isReadOnly())
setEnabled(false);
addActionListener(new ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
File file = DialogFactory.getInstance().showOpenDialog(FileFilterEnum.IMAGES.getFilter(),
null, FileFilterEnum.IMAGES.getExtensions()[0], null);
File file = DialogFactory.getInstance().showOpenDialog(getFileFilterEnum().getFilter(),
null, getFileFilterEnum().getExtensions()[0], null);
if (file != null) {
property.setChanged(true);
FileInputStream fis;
@@ -63,6 +67,13 @@ public class ImageEditor extends JButton {
}
});
}
private FileFilterEnum getFileFilterEnum() {
if (binaryType == BinaryType.SVG) {
return FileFilterEnum.SVG;
}
return FileFilterEnum.IMAGES;
}
// @Override
// public void setBackground(Color bg) {
@@ -30,7 +30,7 @@ public enum FileFilterEnum {
PNG("PNG Images (*.png)", "png"), PDF("PDF Files (*.pdf)", "pdf"), DIY("DIY Project Files (*.diy)", "diy"), EXCEL(
"Excel Workbooks (*.xls)", "xls"), CSV("Comma Separated Files (*.csv)", "csv"), HTML("HTML Files (*.html)",
"html"), IMAGES("Image Files (*.png, *.jpg, *.gif)", "png", "jpg", "gif"), XML("XML Files (*.xml)", "xml"),
TEST("Test Files (*.tst)", "tst"), CRV("Curve Files (*.crv)", "crv");
TEST("Test Files (*.tst)", "tst"), CRV("Curve Files (*.crv)", "crv"), SVG("SVG Files (*.svg)", "svg");
FileFilter filter;
String[] extensions;