diff --git a/diylc/.DS_Store b/diylc/.DS_Store
index 4d91a53e..ba7e385a 100644
Binary files a/diylc/.DS_Store and b/diylc/.DS_Store differ
diff --git a/diylc/.github/workflows/test.yml b/diylc/.github/workflows/test.yml
new file mode 100644
index 00000000..0b7d7c72
--- /dev/null
+++ b/diylc/.github/workflows/test.yml
@@ -0,0 +1,28 @@
+name: Test Build
+
+on:
+ push:
+ branches: [ "master" ]
+ pull_request:
+ branches: [ "master" ]
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ path: diy-layout-creator
+
+ - name: Set up JDK 17
+ uses: actions/setup-java@v3
+ with:
+ java-version: '17'
+ distribution: 'temurin'
+ cache: maven
+
+ - name: Build with Maven
+ run: |
+ cd diy-layout-creator/diylc
+ mvn -B test --file pom.xml
\ No newline at end of file
diff --git a/diylc/.github/workflows/tests.yml b/diylc/.github/workflows/tests.yml
new file mode 100644
index 00000000..f9d01b4d
--- /dev/null
+++ b/diylc/.github/workflows/tests.yml
@@ -0,0 +1,51 @@
+name: Java CI Tests
+
+on:
+ push:
+ branches: [ main ]
+ pull_request:
+ branches: [ main ]
+
+jobs:
+ test:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Set up JDK
+ uses: actions/setup-java@v3
+ with:
+ java-version: '11' # Adjust version as needed
+ distribution: 'temurin'
+ cache: maven
+
+ - name: Run Tests
+ run: mvn test
+
+ # Generate and report coverage without failing
+ - name: Generate Coverage Report
+ run: mvn jacoco:report
+
+ - name: Report Coverage
+ run: |
+ COVERAGE=$(mvn jacoco:report | grep -oP 'Total coverage: \K[0-9.]+' || echo "unknown")
+ echo "Current test coverage: $COVERAGE%"
+
+ - name: Upload Coverage Report
+ uses: actions/upload-artifact@v3
+ with:
+ name: coverage-report
+ path: target/site/jacoco/
+
+ # Optional: Comment test results on PR
+ - name: Add Test Results Comment
+ uses: marocchino/sticky-pull-request-comment@v2
+ if: github.event_name == 'pull_request'
+ with:
+ message: |
+ ### Test Results Summary
+ ✅ Tests completed
+ 📊 Coverage: ${{ env.COVERAGE }}%
+
+ Coverage report available in workflow artifacts
\ No newline at end of file
diff --git a/diylc/.gitignore b/diylc/.gitignore
new file mode 100644
index 00000000..60086ef9
--- /dev/null
+++ b/diylc/.gitignore
@@ -0,0 +1,149 @@
+# Reference: https://github.com/github/gitignore
+# From: https://gist.github.com/edesdan/6bb43343740bcd54ef0f56a384a2f66f
+
+######################
+###### Mac OS X ######
+######################
+
+# Folder view configuration files
+.DS_Store
+Desktop.ini
+
+# Thumbnail cache files
+._*
+Thumbs.db
+
+# Files that might appear on external disks
+.Spotlight-V100
+.Trashes
+
+######################
+###### Java ######
+######################
+
+# Compiled class file
+*.class
+
+# Log file
+*.log
+
+# BlueJ files
+*.ctxt
+
+# Mobile Tools for Java (J2ME)
+.mtj.tmp/
+
+# Package Files #
+*.jar
+*.war
+*.ear
+*.zip
+*.tar.gz
+*.rar
+
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
+
+######################
+###### Gradle ######
+######################
+
+.gradle
+build/
+
+# Ignore Gradle GUI config
+gradle-app.setting
+
+# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
+!gradle-wrapper.jar
+
+# Cache of project
+.gradletasknamecache
+
+# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
+# gradle/wrapper/gradle-wrapper.properties
+
+######################
+###### Intellij ######
+######################
+
+# Created by https://www.gitignore.io/api/intellij
+# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
+# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
+
+# User-specific stuff:
+.idea/**/workspace.xml
+.idea/**/tasks.xml
+.idea/dictionaries
+
+# Sensitive or high-churn files:
+.idea/**/dataSources/
+.idea/**/dataSources.ids
+.idea/**/dataSources.xml
+.idea/**/dataSources.local.xml
+.idea/**/sqlDataSources.xml
+.idea/**/dynamic.xml
+.idea/**/uiDesigner.xml
+
+# Gradle:
+.idea/**/gradle.xml
+.idea/**/libraries
+
+# CMake
+cmake-build-debug/
+
+# Mongo Explorer plugin:
+.idea/**/mongoSettings.xml
+
+## File-based project format:
+*.iws
+
+## Plugin-specific files:
+
+# IntelliJ
+/out/
+
+# mpeltonen/sbt-idea plugin
+.idea_modules/
+
+# JIRA plugin
+atlassian-ide-plugin.xml
+
+# Cursive Clojure plugin
+.idea/replstate.xml
+
+# Crashlytics plugin (for Android Studio and IntelliJ)
+com_crashlytics_export_strings.xml
+crashlytics.properties
+crashlytics-build.properties
+fabric.properties
+
+### Intellij Patch ###
+# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
+
+# *.iml
+# modules.xml
+# .idea/misc.xml
+# *.ipr
+
+# Sonarlint plugin
+.idea/sonarlint
+
+# End of https://www.gitignore.io/api/intellij
+
+######################
+###### Maven ######
+######################
+
+**/target/
+pom.xml.tag
+pom.xml.releaseBackup
+pom.xml.versionsBackup
+pom.xml.next
+release.properties
+dependency-reduced-pom.xml
+buildNumber.properties
+.mvn/timing.properties
+
+# Avoid ignoring Maven wrapper jar file (.jar files are usually ignored)
+!/.mvn/wrapper/maven-wrapper.jar
diff --git a/diylc/.vscode/settings.json b/diylc/.vscode/settings.json
new file mode 100644
index 00000000..e0120650
--- /dev/null
+++ b/diylc/.vscode/settings.json
@@ -0,0 +1,4 @@
+{
+ "java.compile.nullAnalysis.mode": "automatic",
+ "java.configuration.updateBuildConfiguration": "interactive"
+}
\ No newline at end of file
diff --git a/diylc/diylc-core/.settings/org.eclipse.core.resources.prefs b/diylc/diylc-core/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index b0b8e2d8..00000000
--- a/diylc/diylc-core/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-eclipse.preferences.version=1
-encoding//src/org/diylc/core/measures/Resistance.java=UTF-8
-encoding//src/org/diylc/core/measures/ResistanceUnit.java=UTF-8
diff --git a/diylc/diylc-core/.settings/org.eclipse.jdt.ui.prefs b/diylc/diylc-core/.settings/org.eclipse.jdt.ui.prefs
deleted file mode 100644
index b00bc72a..00000000
--- a/diylc/diylc-core/.settings/org.eclipse.jdt.ui.prefs
+++ /dev/null
@@ -1,4 +0,0 @@
-#Sun Nov 08 15:11:18 CET 2009
-eclipse.preferences.version=1
-org.eclipse.jdt.ui.javadoc=false
-org.eclipse.jdt.ui.text.custom_code_templates=/**\r\n * @return the ${bare_field_name}\r\n *//**\r\n * @param ${param} the ${bare_field_name} to set\r\n *//**\r\n * ${tags}\r\n *//**\r\n * \r\n *//**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n *//**\r\n * \r\n *//**\r\n * ${tags}\r\n *//**&\#13;\r\n*{@inheritDoc}&\#13;\r\n**//**\r\n * ${tags}\r\n * ${see_to_target}\r\n */${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}\r\n\r\n\r\n\r\n// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();// ${todo} Auto-generated method stub\r\n${body_statement}${body_statement}\r\n// ${todo} Auto-generated constructor stubreturn ${field};${field} \= ${param};
diff --git a/diylc/diylc-core/build.xml b/diylc/diylc-core/build.xml
index 5d0cdc81..5bafee82 100644
--- a/diylc/diylc-core/build.xml
+++ b/diylc/diylc-core/build.xml
@@ -1,5 +1,5 @@
-
+
diff --git a/diylc/diylc-core/diylc-core.iml b/diylc/diylc-core/diylc-core.iml
deleted file mode 100644
index 70816c6e..00000000
--- a/diylc/diylc-core/diylc-core.iml
+++ /dev/null
@@ -1,89 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/diylc/diylc-core/lib/AppleJavaExtensions.jar b/diylc/diylc-core/lib/AppleJavaExtensions.jar
deleted file mode 100644
index 6659a81c..00000000
Binary files a/diylc/diylc-core/lib/AppleJavaExtensions.jar and /dev/null differ
diff --git a/diylc/diylc-core/lib/app-framework.jar b/diylc/diylc-core/lib/app-framework.jar
deleted file mode 100644
index c8a1f780..00000000
Binary files a/diylc/diylc-core/lib/app-framework.jar and /dev/null differ
diff --git a/diylc/diylc-core/lib/guava-31.1-jre.jar b/diylc/diylc-core/lib/guava-31.1-jre.jar
deleted file mode 100644
index 16819229..00000000
Binary files a/diylc/diylc-core/lib/guava-31.1-jre.jar and /dev/null differ
diff --git a/diylc/diylc-core/lib/jettison-1.0.1.jar b/diylc/diylc-core/lib/jettison-1.0.1.jar
deleted file mode 100644
index fed929fd..00000000
Binary files a/diylc/diylc-core/lib/jettison-1.0.1.jar and /dev/null differ
diff --git a/diylc/diylc-core/lib/junit-4.7.jar b/diylc/diylc-core/lib/junit-4.7.jar
deleted file mode 100644
index 700ad695..00000000
Binary files a/diylc/diylc-core/lib/junit-4.7.jar and /dev/null differ
diff --git a/diylc/diylc-core/lib/log4j-1.2.15.jar b/diylc/diylc-core/lib/log4j-1.2.15.jar
deleted file mode 100644
index c930a6ab..00000000
Binary files a/diylc/diylc-core/lib/log4j-1.2.15.jar and /dev/null differ
diff --git a/diylc/diylc-core/lib/xstream-1.4.19.jar b/diylc/diylc-core/lib/xstream-1.4.19.jar
deleted file mode 100644
index 95d1c6a6..00000000
Binary files a/diylc/diylc-core/lib/xstream-1.4.19.jar and /dev/null differ
diff --git a/diylc/diylc-core/pom.xml b/diylc/diylc-core/pom.xml
new file mode 100644
index 00000000..77b60fe1
--- /dev/null
+++ b/diylc/diylc-core/pom.xml
@@ -0,0 +1,96 @@
+
+
+ 4.0.0
+
+
+ org.diylc
+ diylc-parent
+ 5.1.0
+
+
+ diylc-core
+
+
+
+ 17
+ 17
+
+
+
+
+
+ log4j
+ log4j
+
+
+ javax.jms
+ jms
+
+
+ com.sun.jdmk
+ jmxtools
+
+
+ com.sun.jmx
+ jmxri
+
+
+
+
+ com.thoughtworks.xstream
+ xstream
+
+
+ com.google.guava
+ guava
+ 33.4.0-jre
+
+
+ org.codehaus.jettison
+ jettison
+ 1.5.4
+
+
+ org.reflections
+ reflections
+ 0.10.2
+
+
+ junit
+ junit
+ test
+
+
+
+ org.mockito
+ mockito-core
+ 5.11.0
+ test
+
+
+
+
+ org.diylc.local
+ app-framework
+ 1.0
+ system
+ ${project.basedir}/../lib/app-framework-1.0.jar
+
+
+ org.diylc.local
+ gerber-writer-api-1.0.0
+ 1.0
+ system
+ ${project.basedir}/../lib/gerber-writer-api-1.0.0.jar
+
+
+ org.diylc.local
+ java-http-proxy
+ 1.0
+ system
+ ${project.basedir}/../lib/java-http-proxy.jar
+
+
+
diff --git a/diylc/diylc-core/src/org/diylc/announcements/Announcement.java b/diylc/diylc-core/src/main/java/org/diylc/announcements/Announcement.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/announcements/Announcement.java
rename to diylc/diylc-core/src/main/java/org/diylc/announcements/Announcement.java
index 45000a04..75b1b938 100644
--- a/diylc/diylc-core/src/org/diylc/announcements/Announcement.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/announcements/Announcement.java
@@ -1,24 +1,24 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.announcements;
import java.io.Serializable;
diff --git a/diylc/diylc-core/src/org/diylc/announcements/AnnouncementProvider.java b/diylc/diylc-core/src/main/java/org/diylc/announcements/AnnouncementProvider.java
similarity index 97%
rename from diylc/diylc-core/src/org/diylc/announcements/AnnouncementProvider.java
rename to diylc/diylc-core/src/main/java/org/diylc/announcements/AnnouncementProvider.java
index ff6d99b7..2ed67b64 100644
--- a/diylc/diylc-core/src/org/diylc/announcements/AnnouncementProvider.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/announcements/AnnouncementProvider.java
@@ -1,41 +1,43 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.announcements;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.List;
-import java.util.UUID;
-import org.diylc.appframework.miscutils.ConfigurationManager;
-import org.diylc.plugins.cloud.model.IServiceAPI;
-import com.diyfever.httpproxy.PhpFlatProxy;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+import java.util.UUID;
+import org.diylc.appframework.miscutils.ConfigurationManager;
+
+import com.diyfever.httpproxy.PhpFlatProxy;
import com.diyfever.httpproxy.ProxyFactory;
+import org.diylc.plugins.cloud.model.IServiceAPI;
+
public class AnnouncementProvider {
private String serviceUrl = "http://www.diy-fever.com/diylc/api/v1/announcements.html";
- private String LAST_READ_KEY = "announcement.lastReadDate";
+ private String LAST_READ_KEY = "announcement.lastReadDate";
private String USER_ID_KEY = "userId";
private IAnnouncementService service;
@@ -55,20 +57,20 @@ public class AnnouncementProvider {
ConfigurationManager.getInstance().readString(IServiceAPI.URL_KEY, "http://www.diy-fever.com/diylc/api/v1");
ProxyFactory factory = new ProxyFactory(new PhpFlatProxy());
service = factory.createProxy(IAnnouncementService.class, serviceUrl);
- }
-
- private String getUserId() {
- String userId = ConfigurationManager.getInstance().readString(USER_ID_KEY, null);
- if (userId == null) {
- userId = UUID.randomUUID().toString();
- ConfigurationManager.getInstance().writeValue(USER_ID_KEY, userId);
- }
- return userId;
+ }
+
+ private String getUserId() {
+ String userId = ConfigurationManager.getInstance().readString(USER_ID_KEY, null);
+ if (userId == null) {
+ userId = UUID.randomUUID().toString();
+ ConfigurationManager.getInstance().writeValue(USER_ID_KEY, userId);
+ }
+ return userId;
}
public String getCurrentAnnouncements(boolean forceLast) throws ParseException {
- announcements = service.getAnnouncements(getUserId());
- if (announcements == null)
+ announcements = service.getAnnouncements(getUserId());
+ if (announcements == null)
return null;
boolean hasUnread = false;
StringBuilder sb = new StringBuilder("");
diff --git a/diylc/diylc-core/src/org/diylc/announcements/IAnnouncementService.java b/diylc/diylc-core/src/main/java/org/diylc/announcements/IAnnouncementService.java
similarity index 99%
rename from diylc/diylc-core/src/org/diylc/announcements/IAnnouncementService.java
rename to diylc/diylc-core/src/main/java/org/diylc/announcements/IAnnouncementService.java
index c291a771..82663f26 100644
--- a/diylc/diylc-core/src/org/diylc/announcements/IAnnouncementService.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/announcements/IAnnouncementService.java
@@ -19,12 +19,12 @@
along with DIYLC. If not, see .
*/
-package org.diylc.announcements;
-
+package org.diylc.announcements;
+
import java.util.List;
-import com.diyfever.httpproxy.ParamName;
-
-public interface IAnnouncementService {
-
- public List getAnnouncements(@ParamName("userId")String userId);
-}
+import com.diyfever.httpproxy.ParamName;
+
+public interface IAnnouncementService {
+
+ public List getAnnouncements(@ParamName("userId")String userId);
+}
diff --git a/diylc/diylc-core/src/org/diylc/clipboard/ComponentTransferable.java b/diylc/diylc-core/src/main/java/org/diylc/clipboard/ComponentTransferable.java
similarity index 98%
rename from diylc/diylc-core/src/org/diylc/clipboard/ComponentTransferable.java
rename to diylc/diylc-core/src/main/java/org/diylc/clipboard/ComponentTransferable.java
index 30d5e9fe..6ad86357 100644
--- a/diylc/diylc-core/src/org/diylc/clipboard/ComponentTransferable.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/clipboard/ComponentTransferable.java
@@ -19,8 +19,8 @@
along with DIYLC. If not, see .
*/
-package org.diylc.clipboard;
-
+package org.diylc.clipboard;
+
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
@@ -28,55 +28,56 @@ import java.io.IOException;
import java.io.Serializable;
import java.util.List;
import java.util.Set;
-import org.diylc.core.IDIYComponent;
-
-/**
- * Represents component selection as a {@link List} of {@link IDIYComponent} objects. Implements
- * {@link Transferable}, so it is suitable for clipboard usage.
- *
- * @author Branislav Stojkovic
- */
-public class ComponentTransferable implements Transferable, Serializable {
-
- private static final long serialVersionUID = 1L;
-
+
+import org.diylc.core.IDIYComponent;
+
+/**
+ * Represents component selection as a {@link List} of {@link IDIYComponent} objects. Implements
+ * {@link Transferable}, so it is suitable for clipboard usage.
+ *
+ * @author Branislav Stojkovic
+ */
+public class ComponentTransferable implements Transferable, Serializable {
+
+ private static final long serialVersionUID = 1L;
+
public static final DataFlavor listFlavor = new DataFlavor(ComponentTransferable.class, "application/diylc");
private List> components;
- private Set>> groups;
-
- public ComponentTransferable() {
- super();
+ private Set>> groups;
+
+ public ComponentTransferable() {
+ super();
}
public ComponentTransferable(List> components) {
super();
this.components = components;
this.groups = null;
- }
-
- public ComponentTransferable(List> components, Set>> groups) {
+ }
+
+ public ComponentTransferable(List> components, Set>> groups) {
super();
this.components = components;
- this.groups = groups;
- }
-
- @Override
- public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException {
- if (flavor.equals(listFlavor)) {
- return this;
- }
- throw new UnsupportedFlavorException(flavor);
- }
-
- @Override
- public DataFlavor[] getTransferDataFlavors() {
- return new DataFlavor[] {listFlavor};
- }
-
- @Override
- public boolean isDataFlavorSupported(DataFlavor flavor) {
- return flavor.equals(listFlavor);
+ this.groups = groups;
+ }
+
+ @Override
+ public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException {
+ if (flavor.equals(listFlavor)) {
+ return this;
+ }
+ throw new UnsupportedFlavorException(flavor);
+ }
+
+ @Override
+ public DataFlavor[] getTransferDataFlavors() {
+ return new DataFlavor[] {listFlavor};
+ }
+
+ @Override
+ public boolean isDataFlavorSupported(DataFlavor flavor) {
+ return flavor.equals(listFlavor);
}
public List> getComponents() {
@@ -85,5 +86,5 @@ public class ComponentTransferable implements Transferable, Serializable {
public Set>> getGroups() {
return groups;
- }
-}
+ }
+}
diff --git a/diylc/diylc-core/src/org/diylc/clipboard/ComponentTransferableFactory.java b/diylc/diylc-core/src/main/java/org/diylc/clipboard/ComponentTransferableFactory.java
similarity index 99%
rename from diylc/diylc-core/src/org/diylc/clipboard/ComponentTransferableFactory.java
rename to diylc/diylc-core/src/main/java/org/diylc/clipboard/ComponentTransferableFactory.java
index 9aa9802a..7c13438e 100644
--- a/diylc/diylc-core/src/org/diylc/clipboard/ComponentTransferableFactory.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/clipboard/ComponentTransferableFactory.java
@@ -25,6 +25,7 @@ import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.log4j.Logger;
+
import org.diylc.core.IDIYComponent;
public class ComponentTransferableFactory {
diff --git a/diylc/diylc-core/src/org/diylc/common/BadPositionException.java b/diylc/diylc-core/src/main/java/org/diylc/common/BadPositionException.java
similarity index 99%
rename from diylc/diylc-core/src/org/diylc/common/BadPositionException.java
rename to diylc/diylc-core/src/main/java/org/diylc/common/BadPositionException.java
index 6173a8cd..c6c6e41c 100644
--- a/diylc/diylc-core/src/org/diylc/common/BadPositionException.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/common/BadPositionException.java
@@ -19,10 +19,10 @@
along with DIYLC. If not, see .
*/
-package org.diylc.common;
-
-public class BadPositionException extends Exception {
-
- private static final long serialVersionUID = 1L;
-
-}
+package org.diylc.common;
+
+public class BadPositionException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+}
diff --git a/diylc/diylc-core/src/org/diylc/common/BuildingBlock.java b/diylc/diylc-core/src/main/java/org/diylc/common/BuildingBlock.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/common/BuildingBlock.java
rename to diylc/diylc-core/src/main/java/org/diylc/common/BuildingBlock.java
index ad336d38..1d39414b 100644
--- a/diylc/diylc-core/src/org/diylc/common/BuildingBlock.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/common/BuildingBlock.java
@@ -1,27 +1,28 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.common;
-import java.util.Collection;
+import java.util.Collection;
+
import org.diylc.core.IDIYComponent;
public class BuildingBlock {
diff --git a/diylc/diylc-core/src/org/diylc/common/BuildingBlockPackage.java b/diylc/diylc-core/src/main/java/org/diylc/common/BuildingBlockPackage.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/common/BuildingBlockPackage.java
rename to diylc/diylc-core/src/main/java/org/diylc/common/BuildingBlockPackage.java
index db3fbf5b..0466025a 100644
--- a/diylc/diylc-core/src/org/diylc/common/BuildingBlockPackage.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/common/BuildingBlockPackage.java
@@ -23,6 +23,7 @@ package org.diylc.common;
import java.util.List;
import java.util.Map;
+
import org.diylc.core.IDIYComponent;
public class BuildingBlockPackage {
diff --git a/diylc/diylc-core/src/org/diylc/common/ComponentType.java b/diylc/diylc-core/src/main/java/org/diylc/common/ComponentType.java
similarity index 99%
rename from diylc/diylc-core/src/org/diylc/common/ComponentType.java
rename to diylc/diylc-core/src/main/java/org/diylc/common/ComponentType.java
index 54c44b41..6c0985ee 100644
--- a/diylc/diylc-core/src/org/diylc/common/ComponentType.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/common/ComponentType.java
@@ -20,6 +20,7 @@ package org.diylc.common;
import java.io.Serializable;
import java.util.List;
import javax.swing.Icon;
+
import org.diylc.core.CreationMethod;
import org.diylc.core.IDIYComponent;
import org.diylc.core.annotations.BomPolicy;
diff --git a/diylc/diylc-core/src/org/diylc/common/DefaultComponentTransformer.java b/diylc/diylc-core/src/main/java/org/diylc/common/DefaultComponentTransformer.java
similarity index 99%
rename from diylc/diylc-core/src/org/diylc/common/DefaultComponentTransformer.java
rename to diylc/diylc-core/src/main/java/org/diylc/common/DefaultComponentTransformer.java
index 6fb4e290..ef61e570 100644
--- a/diylc/diylc-core/src/org/diylc/common/DefaultComponentTransformer.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/common/DefaultComponentTransformer.java
@@ -5,6 +5,7 @@ import java.awt.geom.Point2D;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import org.apache.log4j.Logger;
+
import org.diylc.core.Angle;
import org.diylc.core.IDIYComponent;
import org.diylc.presenter.ComponentProcessor;
diff --git a/diylc/diylc-core/src/org/diylc/common/Display.java b/diylc/diylc-core/src/main/java/org/diylc/common/Display.java
similarity index 98%
rename from diylc/diylc-core/src/org/diylc/common/Display.java
rename to diylc/diylc-core/src/main/java/org/diylc/common/Display.java
index f39b09e4..11120a23 100644
--- a/diylc/diylc-core/src/org/diylc/common/Display.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/common/Display.java
@@ -19,14 +19,14 @@
along with DIYLC. If not, see .
*/
-package org.diylc.common;
-
-public enum Display {
-
- NAME, VALUE, NONE, BOTH;
-
- @Override
- public String toString() {
- return name().substring(0, 1) + name().substring(1).toLowerCase();
- }
-}
+package org.diylc.common;
+
+public enum Display {
+
+ NAME, VALUE, NONE, BOTH;
+
+ @Override
+ public String toString() {
+ return name().substring(0, 1) + name().substring(1).toLowerCase();
+ }
+}
diff --git a/diylc/diylc-core/src/org/diylc/common/DrawOption.java b/diylc/diylc-core/src/main/java/org/diylc/common/DrawOption.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/common/DrawOption.java
rename to diylc/diylc-core/src/main/java/org/diylc/common/DrawOption.java
index 6c0f9ee0..01182ec5 100644
--- a/diylc/diylc-core/src/org/diylc/common/DrawOption.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/common/DrawOption.java
@@ -1,24 +1,24 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.common;
import java.awt.Graphics;
@@ -56,17 +56,17 @@ public enum DrawOption {
/**
* Draw components in outline mode.
*/
- OUTLINE_MODE,
- /**
- * Include extra space around the layout.
- */
- EXTRA_SPACE,
- /**
- * Whether components should be cached or not.
- */
- ENABLE_CACHING,
- /**
- * Whether locked components should be rendered as transparent or not.
- */
+ OUTLINE_MODE,
+ /**
+ * Include extra space around the layout.
+ */
+ EXTRA_SPACE,
+ /**
+ * Whether components should be cached or not.
+ */
+ ENABLE_CACHING,
+ /**
+ * Whether locked components should be rendered as transparent or not.
+ */
LOCKED_ALPHA;
}
diff --git a/diylc/diylc-core/src/org/diylc/common/EventType.java b/diylc/diylc-core/src/main/java/org/diylc/common/EventType.java
similarity index 97%
rename from diylc/diylc-core/src/org/diylc/common/EventType.java
rename to diylc/diylc-core/src/main/java/org/diylc/common/EventType.java
index e7eb8359..0367deef 100644
--- a/diylc/diylc-core/src/org/diylc/common/EventType.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/common/EventType.java
@@ -1,28 +1,29 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.common;
-import java.awt.Rectangle;
-import java.awt.geom.Point2D;
+import java.awt.Rectangle;
+import java.awt.geom.Point2D;
+
import org.diylc.core.Project;
/**
@@ -84,7 +85,7 @@ public enum EventType {
AVAILABLE_CTRL_POINTS_CHANGED,
/**
* Called when mouse cursor is moved. Point object is passed, containing the current cursor
- * location (not taking zoom into account) in pixels and two {@link Point2D} objects with coordinates in
+ * location (not taking zoom into account) in pixels and two {@link Point2D} objects with coordinates in
* inches and mm
*/
MOUSE_MOVED,
@@ -101,9 +102,9 @@ public enum EventType {
/**
* Called to update the status message. New status message is passed as a first parameter.
*/
- STATUS_MESSAGE_CHANGED,
- /**
- * Signals the listeners to scroll to selection.
- */
+ STATUS_MESSAGE_CHANGED,
+ /**
+ * Signals the listeners to scroll to selection.
+ */
SCROLL_TO;
}
diff --git a/diylc/diylc-core/src/org/diylc/common/Favorite.java b/diylc/diylc-core/src/main/java/org/diylc/common/Favorite.java
similarity index 100%
rename from diylc/diylc-core/src/org/diylc/common/Favorite.java
rename to diylc/diylc-core/src/main/java/org/diylc/common/Favorite.java
diff --git a/diylc/diylc-core/src/org/diylc/common/GridType.java b/diylc/diylc-core/src/main/java/org/diylc/common/GridType.java
similarity index 99%
rename from diylc/diylc-core/src/org/diylc/common/GridType.java
rename to diylc/diylc-core/src/main/java/org/diylc/common/GridType.java
index 4423bf5e..617183d4 100644
--- a/diylc/diylc-core/src/org/diylc/common/GridType.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/common/GridType.java
@@ -19,9 +19,9 @@
along with DIYLC. If not, see .
*/
-package org.diylc.common;
-
-public enum GridType {
-
- LINES, CROSSHAIR, DOT, NONE;
-}
+package org.diylc.common;
+
+public enum GridType {
+
+ LINES, CROSSHAIR, DOT, NONE;
+}
diff --git a/diylc/diylc-core/src/org/diylc/common/HorizontalAlignment.java b/diylc/diylc-core/src/main/java/org/diylc/common/HorizontalAlignment.java
similarity index 99%
rename from diylc/diylc-core/src/org/diylc/common/HorizontalAlignment.java
rename to diylc/diylc-core/src/main/java/org/diylc/common/HorizontalAlignment.java
index ee2c73b1..8d70a8af 100644
--- a/diylc/diylc-core/src/org/diylc/common/HorizontalAlignment.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/common/HorizontalAlignment.java
@@ -19,12 +19,12 @@
along with DIYLC. If not, see .
*/
-package org.diylc.common;
-
-public enum HorizontalAlignment {
- LEFT, CENTER, RIGHT;
-
- public String toString() {
- return name().substring(0, 1) + name().substring(1).toLowerCase();
- }
-}
+package org.diylc.common;
+
+public enum HorizontalAlignment {
+ LEFT, CENTER, RIGHT;
+
+ public String toString() {
+ return name().substring(0, 1) + name().substring(1).toLowerCase();
+ }
+}
diff --git a/diylc/diylc-core/src/org/diylc/common/IBlockProcessor.java b/diylc/diylc-core/src/main/java/org/diylc/common/IBlockProcessor.java
similarity index 98%
rename from diylc/diylc-core/src/org/diylc/common/IBlockProcessor.java
rename to diylc/diylc-core/src/main/java/org/diylc/common/IBlockProcessor.java
index 85aa96a7..ab13fd31 100644
--- a/diylc/diylc-core/src/org/diylc/common/IBlockProcessor.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/common/IBlockProcessor.java
@@ -19,32 +19,32 @@
along with DIYLC. If not, see .
*/
-package org.diylc.common;
+package org.diylc.common;
import java.io.IOException;
-
-public interface IBlockProcessor {
-
+
+public interface IBlockProcessor {
+
public static final String BLOCKS_KEY = "buildingBlocks";
- public static final String DEFAULT_BLOCKS_IMPORTED_KEY = "defaultBlocksImported";
-
- void saveSelectionAsBlock(String blockName);
-
- void loadBlock(String blockName) throws InvalidBlockException;
-
+ public static final String DEFAULT_BLOCKS_IMPORTED_KEY = "defaultBlocksImported";
+
+ void saveSelectionAsBlock(String blockName);
+
+ void loadBlock(String blockName) throws InvalidBlockException;
+
void deleteBlock(String blockName);
- int importBlocks(String fileName) throws IOException;
-
- public class BlockAlreadyExistsException extends Exception {
-
- private static final long serialVersionUID = 1L;
-
- }
-
- public class InvalidBlockException extends Exception {
-
- private static final long serialVersionUID = 1L;
-
- }
-}
+ int importBlocks(String fileName) throws IOException;
+
+ public class BlockAlreadyExistsException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ }
+
+ public class InvalidBlockException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ }
+}
diff --git a/diylc/diylc-core/src/org/diylc/common/IComponentFilter.java b/diylc/diylc-core/src/main/java/org/diylc/common/IComponentFilter.java
similarity index 99%
rename from diylc/diylc-core/src/org/diylc/common/IComponentFilter.java
rename to diylc/diylc-core/src/main/java/org/diylc/common/IComponentFilter.java
index 798a3c2f..d049c2b0 100644
--- a/diylc/diylc-core/src/org/diylc/common/IComponentFilter.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/common/IComponentFilter.java
@@ -19,11 +19,11 @@
along with DIYLC. If not, see .
*/
-package org.diylc.common;
-
-import org.diylc.core.IDIYComponent;
-
-public interface IComponentFilter {
-
- boolean testComponent(IDIYComponent> component);
-}
+package org.diylc.common;
+
+import org.diylc.core.IDIYComponent;
+
+public interface IComponentFilter {
+
+ boolean testComponent(IDIYComponent> component);
+}
diff --git a/diylc/diylc-core/src/org/diylc/common/IComponentTransformer.java b/diylc/diylc-core/src/main/java/org/diylc/common/IComponentTransformer.java
similarity index 98%
rename from diylc/diylc-core/src/org/diylc/common/IComponentTransformer.java
rename to diylc/diylc-core/src/main/java/org/diylc/common/IComponentTransformer.java
index 847b73dc..6de83c5c 100644
--- a/diylc/diylc-core/src/org/diylc/common/IComponentTransformer.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/common/IComponentTransformer.java
@@ -19,26 +19,27 @@
along with DIYLC. If not, see .
*/
-package org.diylc.common;
-
+package org.diylc.common;
+
import java.awt.geom.Point2D;
-import org.diylc.core.IDIYComponent;
-
-public interface IComponentTransformer {
-
- public static final int CLOCKWISE = 1;
- public static final int COUNTER_CLOCKWISE = 1;
-
- public static final int HORIZONTAL = 0;
- public static final int VERTICAL = 1;
-
- boolean canRotate(IDIYComponent> component);
-
- boolean canMirror(IDIYComponent> component);
-
- boolean mirroringChangesCircuit();
-
- void rotate(IDIYComponent> component, Point2D center, int direction);
-
- void mirror(IDIYComponent> component, Point2D center, int direction);
-}
+
+import org.diylc.core.IDIYComponent;
+
+public interface IComponentTransformer {
+
+ public static final int CLOCKWISE = 1;
+ public static final int COUNTER_CLOCKWISE = 1;
+
+ public static final int HORIZONTAL = 0;
+ public static final int VERTICAL = 1;
+
+ boolean canRotate(IDIYComponent> component);
+
+ boolean canMirror(IDIYComponent> component);
+
+ boolean mirroringChangesCircuit();
+
+ void rotate(IDIYComponent> component, Point2D center, int direction);
+
+ void mirror(IDIYComponent> component, Point2D center, int direction);
+}
diff --git a/diylc/diylc-core/src/org/diylc/common/IKeyProcessor.java b/diylc/diylc-core/src/main/java/org/diylc/common/IKeyProcessor.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/common/IKeyProcessor.java
rename to diylc/diylc-core/src/main/java/org/diylc/common/IKeyProcessor.java
index 7fdff0b7..f9139411 100644
--- a/diylc/diylc-core/src/org/diylc/common/IKeyProcessor.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/common/IKeyProcessor.java
@@ -1,24 +1,24 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.common;
public interface IKeyProcessor {
diff --git a/diylc/diylc-core/src/org/diylc/common/IMouseProcessor.java b/diylc/diylc-core/src/main/java/org/diylc/common/IMouseProcessor.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/common/IMouseProcessor.java
rename to diylc/diylc-core/src/main/java/org/diylc/common/IMouseProcessor.java
index 7b82cdf4..66f3712f 100644
--- a/diylc/diylc-core/src/org/diylc/common/IMouseProcessor.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/common/IMouseProcessor.java
@@ -1,24 +1,24 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.common;
import java.awt.Point;
diff --git a/diylc/diylc-core/src/org/diylc/common/INetlistAnalyzer.java b/diylc/diylc-core/src/main/java/org/diylc/common/INetlistAnalyzer.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/common/INetlistAnalyzer.java
rename to diylc/diylc-core/src/main/java/org/diylc/common/INetlistAnalyzer.java
index e92b21e8..aa5fda5c 100644
--- a/diylc/diylc-core/src/org/diylc/common/INetlistAnalyzer.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/common/INetlistAnalyzer.java
@@ -22,6 +22,7 @@
package org.diylc.common;
import java.util.List;
+
import org.diylc.netlist.Netlist;
import org.diylc.netlist.Node;
import org.diylc.netlist.Summary;
diff --git a/diylc/diylc-core/src/org/diylc/common/INetlistProcessor.java b/diylc/diylc-core/src/main/java/org/diylc/common/INetlistProcessor.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/common/INetlistProcessor.java
rename to diylc/diylc-core/src/main/java/org/diylc/common/INetlistProcessor.java
index 3f539d0c..15f331d3 100644
--- a/diylc/diylc-core/src/org/diylc/common/INetlistProcessor.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/common/INetlistProcessor.java
@@ -22,6 +22,7 @@
package org.diylc.common;
import java.util.List;
+
import org.diylc.netlist.INetlistParser;
import org.diylc.netlist.Netlist;
import org.diylc.netlist.NetlistException;
diff --git a/diylc/diylc-core/src/org/diylc/common/IPlugIn.java b/diylc/diylc-core/src/main/java/org/diylc/common/IPlugIn.java
similarity index 98%
rename from diylc/diylc-core/src/org/diylc/common/IPlugIn.java
rename to diylc/diylc-core/src/main/java/org/diylc/common/IPlugIn.java
index 57d932d9..03994942 100644
--- a/diylc/diylc-core/src/org/diylc/common/IPlugIn.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/common/IPlugIn.java
@@ -19,22 +19,22 @@
along with DIYLC. If not, see .
*/
-package org.diylc.common;
-
-import org.diylc.appframework.simplemq.IMessageListener;
-
-/**
- * Interface for plug-ins.
- *
- * @author Branislav Stojkovic
- */
-public interface IPlugIn extends IMessageListener {
-
- /**
- * Method that connects the plug-in with {@link IPlugInPort}. Called by the application when
- * plug-in is installed.
- *
- * @param plugInPort
- */
- void connect(IPlugInPort plugInPort);
-}
+package org.diylc.common;
+
+import org.diylc.appframework.simplemq.IMessageListener;
+
+/**
+ * Interface for plug-ins.
+ *
+ * @author Branislav Stojkovic
+ */
+public interface IPlugIn extends IMessageListener {
+
+ /**
+ * Method that connects the plug-in with {@link IPlugInPort}. Called by the application when
+ * plug-in is installed.
+ *
+ * @param plugInPort
+ */
+ void connect(IPlugInPort plugInPort);
+}
diff --git a/diylc/diylc-core/src/org/diylc/common/IPlugInPort.java b/diylc/diylc-core/src/main/java/org/diylc/common/IPlugInPort.java
similarity index 95%
rename from diylc/diylc-core/src/org/diylc/common/IPlugInPort.java
rename to diylc/diylc-core/src/main/java/org/diylc/common/IPlugInPort.java
index a23779bf..9e76e511 100644
--- a/diylc/diylc-core/src/org/diylc/common/IPlugInPort.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/common/IPlugInPort.java
@@ -1,47 +1,48 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.common;
-import java.awt.Cursor;
-import java.awt.Dimension;
-import java.awt.Graphics2D;
-import java.awt.Point;
-import java.awt.geom.Area;
-import java.awt.geom.Point2D;
-import java.awt.geom.Rectangle2D;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.diylc.appframework.simplemq.IMessageListener;
-import org.diylc.appframework.simplemq.MessageDispatcher;
-import org.diylc.appframework.update.Version;
-import org.diylc.appframework.update.VersionNumber;
-import org.diylc.clipboard.ComponentTransferable;
-import org.diylc.core.IDIYComponent;
-import org.diylc.core.Project;
-import org.diylc.core.Template;
-import org.diylc.core.Theme;
-import org.diylc.core.measures.Size;
-import org.diylc.test.ITestProcessor;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.Point;
+import java.awt.geom.Area;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.diylc.appframework.simplemq.IMessageListener;
+import org.diylc.appframework.simplemq.MessageDispatcher;
+import org.diylc.appframework.update.Version;
+import org.diylc.appframework.update.VersionNumber;
+
+import org.diylc.clipboard.ComponentTransferable;
+import org.diylc.core.IDIYComponent;
+import org.diylc.core.Project;
+import org.diylc.core.Template;
+import org.diylc.core.Theme;
+import org.diylc.core.measures.Size;
+import org.diylc.test.ITestProcessor;
/**
* Interface for communication between plug-ins and the application. Plug-ins may acquire
@@ -60,10 +61,11 @@ public interface IPlugInPort extends ISelectionProcessor, IMouseProcessor, IKeyP
public static final String ANTI_ALIASING_KEY = "antiAliasing";
public static final String HI_QUALITY_RENDER_KEY = "hiQualityRender";
+ public static final String HIGH_DPI_RENDERING = "hiDpiRendering";
public static final String EXPORT_GRID_KEY = "exportGrid";
public static final String STICKY_POINTS_KEY = "stickyPoints";
public static final String METRIC_KEY = "metric";
-
+
public static final String SNAP_TO_KEY = "snapTo";
public static final String CONTINUOUS_CREATION_KEY = "continuousCreation";
public static final String AUTO_EDIT_KEY = "autoEdit";
@@ -75,27 +77,27 @@ public interface IPlugInPort extends ISelectionProcessor, IMouseProcessor, IKeyP
public static final String RECENT_COMPONENTS_KEY = "recentComponents";
public static final String RECENT_FILES_KEY = "recentFiles";
public static final String SHOW_RULERS_KEY = "showRulers";
- public static final String SHOW_GRID_KEY = "showGrid";
- public static final String HIGHLIGHT_CONTINUITY_AREA = "highlightContinuityArea";
- public static final String HARDWARE_ACCELERATION = "hardwareAcceleration";
- public static final String EXTRA_SPACE_KEY = "extraSpace";
- public static final String FAVORITES_KEY = "favorites";
- public static final String RENUMBER_ON_PASTE_KEY = "renumberOnPaste";
- public static final String RULER_IN_SUBDIVISION_KEY = "rulerInSubdivision";
- public static final String CACHING_ENABLED_KEY = "cachingEnabled";
-
- public static final String RULER_IN_SUBDIVISION_2 = "base of 2";
- public static final String RULER_IN_SUBDIVISION_10 = "base of 10";
- public static final String RULER_IN_SUBDIVISION_DEFAULT = RULER_IN_SUBDIVISION_10;
-
- public static final String SNAP_TO_NONE = "None";
- public static final String SNAP_TO_GRID = "Grid";
- public static final String SNAP_TO_COMPONENTS = "Components";
- public static final String SNAP_TO_DEFAULT = SNAP_TO_GRID;
-
- public static final String LOCKED_ALPHA = "lockedAlpha";
-
- public static final String LANGUAGE = "language";
+ public static final String SHOW_GRID_KEY = "showGrid";
+ public static final String HIGHLIGHT_CONTINUITY_AREA = "highlightContinuityArea";
+ public static final String HARDWARE_ACCELERATION = "hardwareAcceleration";
+ public static final String EXTRA_SPACE_KEY = "extraSpace";
+ public static final String FAVORITES_KEY = "favorites";
+ public static final String RENUMBER_ON_PASTE_KEY = "renumberOnPaste";
+ public static final String RULER_IN_SUBDIVISION_KEY = "rulerInSubdivision";
+ public static final String CACHING_ENABLED_KEY = "cachingEnabled";
+
+ public static final String RULER_IN_SUBDIVISION_2 = "base of 2";
+ public static final String RULER_IN_SUBDIVISION_10 = "base of 10";
+ public static final String RULER_IN_SUBDIVISION_DEFAULT = RULER_IN_SUBDIVISION_10;
+
+ public static final String SNAP_TO_NONE = "None";
+ public static final String SNAP_TO_GRID = "Grid";
+ public static final String SNAP_TO_COMPONENTS = "Components";
+ public static final String SNAP_TO_DEFAULT = SNAP_TO_GRID;
+
+ public static final String LOCKED_ALPHA = "lockedAlpha";
+
+ public static final String LANGUAGE = "language";
public static final String LANGUAGE_DEFAULT = "English";
public static final int DND_TOGGLE_STICKY = 0x1;
@@ -114,7 +116,7 @@ public interface IPlugInPort extends ISelectionProcessor, IMouseProcessor, IKeyP
* Each dimension is calculated as the product of the actual size and the number of pixels per
* unit. If useZoom is set to true, the result is scaled by zoom factor.
*
- * @param useZoom
+ * @param useZoom
* @param includeExtraSpace
*
* @return canvas dimensions
@@ -126,9 +128,9 @@ public interface IPlugInPort extends ISelectionProcessor, IMouseProcessor, IKeyP
*
* Note: point coordinates are scaled for zoom factor.
*
- * @param point
- * @param ctrlDown
- * @param shiftDown
+ * @param point
+ * @param ctrlDown
+ * @param shiftDown
* @param altDown
* @return cursor
*/
@@ -145,8 +147,8 @@ public interface IPlugInPort extends ISelectionProcessor, IMouseProcessor, IKeyP
* Loads specified {@link Project}.
*
* @param project
- * @param freshStart
- * @param optional file name when loading from a file
+ * @param freshStart
+ * @param filename file name when loading from a file
*/
void loadProject(Project project, boolean freshStart, String filename);
@@ -168,14 +170,14 @@ public interface IPlugInPort extends ISelectionProcessor, IMouseProcessor, IKeyP
* @param fileName
* @param isBackup
*/
- void saveProjectToFile(String fileName, boolean isBackup);
-
- /**
- * Exports the current project into one or more files - one per layer and potentially drill layer.
- *
- * @param fileNameBase
- * @param g2d
- */
+ void saveProjectToFile(String fileName, boolean isBackup);
+
+ /**
+ * Exports the current project into one or more files - one per layer and potentially drill layer.
+ *
+ * @param fileNameBase
+ * @param g2d
+ */
void exportToGerber(String fileNameBase, Graphics2D g2d);
/**
@@ -210,9 +212,9 @@ public interface IPlugInPort extends ISelectionProcessor, IMouseProcessor, IKeyP
*
* @param g2d
* @param drawOptions specific drawing options
- * @param filter
- * @param externalZoom
- * @param scaleFactor
+ * @param filter
+ * @param externalZoom
+ * @param scaleFactor
* @param visibleRect
*/
void draw(Graphics2D g2d, Set drawOptions, IComponentFilter filter, Double externalZoom, Double scaleFactor, Rectangle2D visibleRect);
@@ -238,20 +240,20 @@ public interface IPlugInPort extends ISelectionProcessor, IMouseProcessor, IKeyP
*
* @return
*/
- VersionNumber getCurrentVersionNumber();
-
- /**
- * Returns few most recent versions.
- *
- * @return
- */
+ VersionNumber getCurrentVersionNumber();
+
+ /**
+ * Returns few most recent versions.
+ *
+ * @return
+ */
List getRecentUpdates();
/**
* Adds a list of components to the project.
*
- * @param componentTransferable
- * @param autoGroup
+ * @param componentTransferable
+ * @param autoGroup
* @param assignNewNames
*/
void pasteComponents(ComponentTransferable componentTransferable, boolean autoGroup, boolean assignNewNames);
@@ -317,8 +319,8 @@ public interface IPlugInPort extends ISelectionProcessor, IMouseProcessor, IKeyP
* component.
*
* @param componentType
- * @param template optional
- * @param model optional datasheet model
+ * @param template optional
+ * @param model optional datasheet model
* @param forceInstatiate
*/
void setNewComponentTypeSlot(ComponentType componentType, Template template, String[] model, boolean forceInstatiate);
@@ -373,29 +375,29 @@ public interface IPlugInPort extends ISelectionProcessor, IMouseProcessor, IKeyP
*
* @param xAxisFirst
*/
- void renumberSelectedComponents(boolean xAxisFirst);
-
- /**
- * @return size of extra space around the canvas
- */
- double getExtraSpace();
-
- /**
- * Applies changes to the current project as specified by the provided {@link IProjectEditor}.
- *
- * @param editor
- */
- void applyEditor(IProjectEditor editor);
-
- /**
- * Locks or unlocks a single component.
- */
- void lockComponent(IDIYComponent> c, boolean locked);
-
- /**
- * Checks for proximity between continuity areas and creates additional components around any problematic areas to visually identify them.
- *
- * @param threshold
- */
+ void renumberSelectedComponents(boolean xAxisFirst);
+
+ /**
+ * @return size of extra space around the canvas
+ */
+ double getExtraSpace();
+
+ /**
+ * Applies changes to the current project as specified by the provided {@link IProjectEditor}.
+ *
+ * @param editor
+ */
+ void applyEditor(IProjectEditor editor);
+
+ /**
+ * Locks or unlocks a single component.
+ */
+ void lockComponent(IDIYComponent> c, boolean locked);
+
+ /**
+ * Checks for proximity between continuity areas and creates additional components around any problematic areas to visually identify them.
+ *
+ * @param threshold
+ */
List checkContinuityAreaProximity(Size threshold);
}
diff --git a/diylc/diylc-core/src/org/diylc/common/IProjectEditor.java b/diylc/diylc-core/src/main/java/org/diylc/common/IProjectEditor.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/common/IProjectEditor.java
rename to diylc/diylc-core/src/main/java/org/diylc/common/IProjectEditor.java
index 67d3b92d..45db5460 100644
--- a/diylc/diylc-core/src/org/diylc/common/IProjectEditor.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/common/IProjectEditor.java
@@ -22,6 +22,7 @@
package org.diylc.common;
import java.util.Set;
+
import org.diylc.core.IDIYComponent;
import org.diylc.core.Project;
diff --git a/diylc/diylc-core/src/org/diylc/common/ISelectionProcessor.java b/diylc/diylc-core/src/main/java/org/diylc/common/ISelectionProcessor.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/common/ISelectionProcessor.java
rename to diylc/diylc-core/src/main/java/org/diylc/common/ISelectionProcessor.java
index e0a59b95..5a35c363 100644
--- a/diylc/diylc-core/src/org/diylc/common/ISelectionProcessor.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/common/ISelectionProcessor.java
@@ -1,33 +1,34 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.common;
-import java.awt.geom.Point2D;
-import java.awt.geom.Rectangle2D;
-import java.util.Collection;
-import java.util.List;
-import org.diylc.clipboard.ComponentTransferable;
-import org.diylc.core.ExpansionMode;
-import org.diylc.core.IDIYComponent;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+import java.util.Collection;
+import java.util.List;
+
+import org.diylc.clipboard.ComponentTransferable;
+import org.diylc.core.ExpansionMode;
+import org.diylc.core.IDIYComponent;
import org.diylc.core.measures.Size;
public interface ISelectionProcessor {
@@ -37,20 +38,20 @@ public interface ISelectionProcessor {
*
* @return
*/
- Collection> getSelectedComponents();
-
- /**
- * Returns selected component types
- *
- * @return
- */
+ Collection> getSelectedComponents();
+
+ /**
+ * Returns selected component types
+ *
+ * @return
+ */
Collection getSelectedComponentTypes();
/**
* Updates the selection with the specified list of component. Also, updates control point map
* with all components that are stuck to the newly selected components.
*
- * @param newSelection
+ * @param newSelection
* @param panToSelection
*/
void setSelection(Collection> newSelection, boolean panToSelection);
@@ -59,7 +60,7 @@ public interface ISelectionProcessor {
* Finds all components at the specified location, sorted by z-index from top to bottom. Location
* depends on the current zoom level.
*
- * @param point
+ * @param point
* @param includeLocked
* @return
*/
@@ -108,8 +109,8 @@ public interface ISelectionProcessor {
/**
* Returns the minimum rectangle containing all selected components, or null if none exists.
* Rectangle is scaled by the current zoom level.
- *
- * @param applyZoom
+ *
+ * @param applyZoom
*
* @return
*/
@@ -122,36 +123,36 @@ public interface ISelectionProcessor {
* @param yOffset
* @param includeStuckComponents
*/
- void nudgeSelection(Size xOffset, Size yOffset, boolean includeStuckComponents);
-
- /**
- * Selects components that match the criteria.
- *
- * @param criteria
- */
- void selectMatching(String criteria);
-
-
- /**
- * Attempts to apply the specified model to all selected components.
- *
- * @param model
- */
- void applyModelToSelection(String[] model);
-
- /**
- * Sends each of the selected components one step back.
- */
- void sendSelectionToBack();
-
- /**
- * Brings each of the selected components one step to front.
- */
- void bringSelectionToFront();
-
- /**
- * Move selected components to z index starting from the provided value
- * @param zIndex
- */
+ void nudgeSelection(Size xOffset, Size yOffset, boolean includeStuckComponents);
+
+ /**
+ * Selects components that match the criteria.
+ *
+ * @param criteria
+ */
+ void selectMatching(String criteria);
+
+
+ /**
+ * Attempts to apply the specified model to all selected components.
+ *
+ * @param model
+ */
+ void applyModelToSelection(String[] model);
+
+ /**
+ * Sends each of the selected components one step back.
+ */
+ void sendSelectionToBack();
+
+ /**
+ * Brings each of the selected components one step to front.
+ */
+ void bringSelectionToFront();
+
+ /**
+ * Move selected components to z index starting from the provided value
+ * @param zIndex
+ */
void moveSelectionToZIndex(int zIndex);
}
diff --git a/diylc/diylc-core/src/org/diylc/common/ITask.java b/diylc/diylc-core/src/main/java/org/diylc/common/ITask.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/common/ITask.java
rename to diylc/diylc-core/src/main/java/org/diylc/common/ITask.java
index ecee4840..cce16f95 100644
--- a/diylc/diylc-core/src/org/diylc/common/ITask.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/common/ITask.java
@@ -1,24 +1,24 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.common;
/**
diff --git a/diylc/diylc-core/src/org/diylc/common/IVariantProcessor.java b/diylc/diylc-core/src/main/java/org/diylc/common/IVariantProcessor.java
similarity index 98%
rename from diylc/diylc-core/src/org/diylc/common/IVariantProcessor.java
rename to diylc/diylc-core/src/main/java/org/diylc/common/IVariantProcessor.java
index bdf3f312..900bf51d 100644
--- a/diylc/diylc-core/src/org/diylc/common/IVariantProcessor.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/common/IVariantProcessor.java
@@ -19,37 +19,38 @@
along with DIYLC. If not, see .
*/
-package org.diylc.common;
-
+package org.diylc.common;
+
import java.io.IOException;
import java.util.List;
+
import org.diylc.core.Template;
-
-public interface IVariantProcessor {
-
+
+public interface IVariantProcessor {
+
public static final String TEMPLATES_KEY = "templates";
public static final String DEFAULT_TEMPLATES_KEY = "defaultTemplates";
- public static final String DEFAULT_TEMPLATES_IMPORT_DATE_KEY = "defaultTemplatesImportDate";
-
- void saveSelectedComponentAsVariant(String variantName);
-
- List getVariantsFor(ComponentType type);
-
- List getVariantsForSelection();
-
- void applyVariantToSelection(Template variant);
-
- void deleteVariant(ComponentType type, String variantName);
-
+ public static final String DEFAULT_TEMPLATES_IMPORT_DATE_KEY = "defaultTemplatesImportDate";
+
+ void saveSelectedComponentAsVariant(String variantName);
+
+ List getVariantsFor(ComponentType type);
+
+ List getVariantsForSelection();
+
+ void applyVariantToSelection(Template variant);
+
+ void deleteVariant(ComponentType type, String variantName);
+
void setDefaultVariant(ComponentType type, String variantName);
int importVariants(String fileName) throws IOException;
- String getDefaultVariant(ComponentType type);
-
- public class VariantAlreadyExistsException extends Exception {
-
- private static final long serialVersionUID = 1L;
-
- }
-}
+ String getDefaultVariant(ComponentType type);
+
+ public class VariantAlreadyExistsException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ }
+}
diff --git a/diylc/diylc-core/src/org/diylc/common/LabelPosition.java b/diylc/diylc-core/src/main/java/org/diylc/common/LabelPosition.java
similarity index 98%
rename from diylc/diylc-core/src/org/diylc/common/LabelPosition.java
rename to diylc/diylc-core/src/main/java/org/diylc/common/LabelPosition.java
index 288a724d..04681bbb 100644
--- a/diylc/diylc-core/src/org/diylc/common/LabelPosition.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/common/LabelPosition.java
@@ -19,14 +19,14 @@
along with DIYLC. If not, see .
*/
-package org.diylc.common;
-
-public enum LabelPosition {
-
- ABOVE, BELOW;
-
- @Override
- public String toString() {
- return name().substring(0, 1) + name().substring(1).toLowerCase();
- }
-}
+package org.diylc.common;
+
+public enum LabelPosition {
+
+ ABOVE, BELOW;
+
+ @Override
+ public String toString() {
+ return name().substring(0, 1) + name().substring(1).toLowerCase();
+ }
+}
diff --git a/diylc/diylc-core/src/org/diylc/common/LineStyle.java b/diylc/diylc-core/src/main/java/org/diylc/common/LineStyle.java
similarity index 98%
rename from diylc/diylc-core/src/org/diylc/common/LineStyle.java
rename to diylc/diylc-core/src/main/java/org/diylc/common/LineStyle.java
index ae19e84e..6cbf55de 100644
--- a/diylc/diylc-core/src/org/diylc/common/LineStyle.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/common/LineStyle.java
@@ -19,14 +19,14 @@
along with DIYLC. If not, see .
*/
-package org.diylc.common;
-
-public enum LineStyle {
-
- SOLID, DASHED, DOTTED;
-
- @Override
- public String toString() {
- return name().substring(0, 1) + name().substring(1).toLowerCase();
- }
-}
+package org.diylc.common;
+
+public enum LineStyle {
+
+ SOLID, DASHED, DOTTED;
+
+ @Override
+ public String toString() {
+ return name().substring(0, 1) + name().substring(1).toLowerCase();
+ }
+}
diff --git a/diylc/diylc-core/src/org/diylc/common/ObjectCache.java b/diylc/diylc-core/src/main/java/org/diylc/common/ObjectCache.java
similarity index 100%
rename from diylc/diylc-core/src/org/diylc/common/ObjectCache.java
rename to diylc/diylc-core/src/main/java/org/diylc/common/ObjectCache.java
diff --git a/diylc/diylc-core/src/org/diylc/common/Orientation.java b/diylc/diylc-core/src/main/java/org/diylc/common/Orientation.java
similarity index 98%
rename from diylc/diylc-core/src/org/diylc/common/Orientation.java
rename to diylc/diylc-core/src/main/java/org/diylc/common/Orientation.java
index 4e61f43a..97901e06 100644
--- a/diylc/diylc-core/src/org/diylc/common/Orientation.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/common/Orientation.java
@@ -19,19 +19,19 @@
along with DIYLC. If not, see .
*/
-package org.diylc.common;
-
-public enum Orientation {
-
- DEFAULT, _90, _180, _270;
-
- @Override
- public String toString() {
- if (this == DEFAULT) {
- return "Default";
- } else {
- return name().replace("_", "") + " degrees clockwise";
- }
+package org.diylc.common;
+
+public enum Orientation {
+
+ DEFAULT, _90, _180, _270;
+
+ @Override
+ public String toString() {
+ if (this == DEFAULT) {
+ return "Default";
+ } else {
+ return name().replace("_", "") + " degrees clockwise";
+ }
}
public double toDegrees() {
@@ -52,5 +52,5 @@ public enum Orientation {
public double toRadians() {
return Math.toRadians(toDegrees());
- }
-}
+ }
+}
diff --git a/diylc/diylc-core/src/org/diylc/common/OrientationHV.java b/diylc/diylc-core/src/main/java/org/diylc/common/OrientationHV.java
similarity index 98%
rename from diylc/diylc-core/src/org/diylc/common/OrientationHV.java
rename to diylc/diylc-core/src/main/java/org/diylc/common/OrientationHV.java
index 6beba748..26f2ad93 100644
--- a/diylc/diylc-core/src/org/diylc/common/OrientationHV.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/common/OrientationHV.java
@@ -19,14 +19,14 @@
along with DIYLC. If not, see .
*/
-package org.diylc.common;
-
-public enum OrientationHV {
-
- VERTICAL, HORIZONTAL;
-
- @Override
- public String toString() {
- return name().substring(0, 1) + name().substring(1).toLowerCase();
- }
-}
+package org.diylc.common;
+
+public enum OrientationHV {
+
+ VERTICAL, HORIZONTAL;
+
+ @Override
+ public String toString() {
+ return name().substring(0, 1) + name().substring(1).toLowerCase();
+ }
+}
diff --git a/diylc/diylc-core/src/org/diylc/common/PCBLayer.java b/diylc/diylc-core/src/main/java/org/diylc/common/PCBLayer.java
similarity index 99%
rename from diylc/diylc-core/src/org/diylc/common/PCBLayer.java
rename to diylc/diylc-core/src/main/java/org/diylc/common/PCBLayer.java
index 5b58542f..56e86ce8 100644
--- a/diylc/diylc-core/src/org/diylc/common/PCBLayer.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/common/PCBLayer.java
@@ -23,18 +23,18 @@ package org.diylc.common;
import org.diylc.core.gerber.GerberLayer;
-public enum PCBLayer {
-
+public enum PCBLayer {
+
_1("Bottom"), _2("Top"), _3("Inner 1"), _4("Inner 2"), _5("Inner 3"), _6("Inner 4"), _7("Inner 5"), _8("Inner 6");
private String label;
private PCBLayer(String label) {
this.label = label;
- }
-
- public String toString() {
- return label;
+ }
+
+ public String toString() {
+ return label;
};
public int getId() {
@@ -48,5 +48,5 @@ public enum PCBLayer {
default:
throw new RuntimeException("Unsupported PCB layer: " + this);
}
- }
-}
+ }
+}
diff --git a/diylc/diylc-core/src/org/diylc/common/PropertyWrapper.java b/diylc/diylc-core/src/main/java/org/diylc/common/PropertyWrapper.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/common/PropertyWrapper.java
rename to diylc/diylc-core/src/main/java/org/diylc/common/PropertyWrapper.java
index a4344fd3..3232d432 100644
--- a/diylc/diylc-core/src/org/diylc/common/PropertyWrapper.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/common/PropertyWrapper.java
@@ -1,28 +1,29 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.common;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
import org.diylc.core.IPropertyValidator;
/**
@@ -74,19 +75,19 @@ public class PropertyWrapper implements Cloneable {
// }
public void writeTo(Object object) throws IllegalArgumentException, IllegalAccessException,
- InvocationTargetException, SecurityException, NoSuchMethodException {
- // nothing to do if no setter
- if (setter == null)
+ InvocationTargetException, SecurityException, NoSuchMethodException {
+ // nothing to do if no setter
+ if (setter == null)
return;
object.getClass().getMethod(setter, type).invoke(object, this.value);
}
public Method getGetter() throws SecurityException, NoSuchMethodException {
return getOwnerObject().getClass().getMethod(getter);
- }
-
- public boolean isReadOnly() {
- return setter == null;
+ }
+
+ public boolean isReadOnly() {
+ return setter == null;
}
public String getName() {
diff --git a/diylc/diylc-core/src/org/diylc/common/ResistorColorCode.java b/diylc/diylc-core/src/main/java/org/diylc/common/ResistorColorCode.java
similarity index 98%
rename from diylc/diylc-core/src/org/diylc/common/ResistorColorCode.java
rename to diylc/diylc-core/src/main/java/org/diylc/common/ResistorColorCode.java
index 0629e6d9..46023d3f 100644
--- a/diylc/diylc-core/src/org/diylc/common/ResistorColorCode.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/common/ResistorColorCode.java
@@ -19,17 +19,17 @@
along with DIYLC. If not, see .
*/
-package org.diylc.common;
-
-public enum ResistorColorCode {
-
- NONE, _4_BAND, _5_BAND;
-
- @Override
- public String toString() {
- if (name().startsWith("_")) {
- return name().substring(1).replace("_", " ").toLowerCase();
- }
- return name().substring(0, 1).toUpperCase() + name().substring(1).toLowerCase();
- }
-}
+package org.diylc.common;
+
+public enum ResistorColorCode {
+
+ NONE, _4_BAND, _5_BAND;
+
+ @Override
+ public String toString() {
+ if (name().startsWith("_")) {
+ return name().substring(1).replace("_", " ").toLowerCase();
+ }
+ return name().substring(0, 1).toUpperCase() + name().substring(1).toLowerCase();
+ }
+}
diff --git a/diylc/diylc-core/src/org/diylc/common/VariantPackage.java b/diylc/diylc-core/src/main/java/org/diylc/common/VariantPackage.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/common/VariantPackage.java
rename to diylc/diylc-core/src/main/java/org/diylc/common/VariantPackage.java
index 9c63936d..43dac280 100644
--- a/diylc/diylc-core/src/org/diylc/common/VariantPackage.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/common/VariantPackage.java
@@ -23,6 +23,7 @@ package org.diylc.common;
import java.util.List;
import java.util.Map;
+
import org.diylc.core.Template;
public class VariantPackage {
diff --git a/diylc/diylc-core/src/org/diylc/common/VerticalAlignment.java b/diylc/diylc-core/src/main/java/org/diylc/common/VerticalAlignment.java
similarity index 99%
rename from diylc/diylc-core/src/org/diylc/common/VerticalAlignment.java
rename to diylc/diylc-core/src/main/java/org/diylc/common/VerticalAlignment.java
index 13d06069..7c0d4924 100644
--- a/diylc/diylc-core/src/org/diylc/common/VerticalAlignment.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/common/VerticalAlignment.java
@@ -19,12 +19,12 @@
along with DIYLC. If not, see .
*/
-package org.diylc.common;
-
-public enum VerticalAlignment {
- TOP, CENTER, BOTTOM;
-
- public String toString() {
- return name().substring(0, 1) + name().substring(1).toLowerCase();
- }
-}
+package org.diylc.common;
+
+public enum VerticalAlignment {
+ TOP, CENTER, BOTTOM;
+
+ public String toString() {
+ return name().substring(0, 1) + name().substring(1).toLowerCase();
+ }
+}
diff --git a/diylc/diylc-core/src/org/diylc/common/ZoomableStroke.java b/diylc/diylc-core/src/main/java/org/diylc/common/ZoomableStroke.java
similarity index 100%
rename from diylc/diylc-core/src/org/diylc/common/ZoomableStroke.java
rename to diylc/diylc-core/src/main/java/org/diylc/common/ZoomableStroke.java
diff --git a/diylc/diylc-core/src/org/diylc/components/AbstractAngledComponent.java b/diylc/diylc-core/src/main/java/org/diylc/components/AbstractAngledComponent.java
similarity index 99%
rename from diylc/diylc-core/src/org/diylc/components/AbstractAngledComponent.java
rename to diylc/diylc-core/src/main/java/org/diylc/components/AbstractAngledComponent.java
index 3cfcc05f..f4bd1595 100644
--- a/diylc/diylc-core/src/org/diylc/components/AbstractAngledComponent.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/components/AbstractAngledComponent.java
@@ -22,6 +22,7 @@
package org.diylc.components;
import java.awt.Shape;
+
import org.diylc.common.Orientation;
import org.diylc.core.Angle;
import org.diylc.core.annotations.EditableProperty;
diff --git a/diylc/diylc-core/src/org/diylc/components/AbstractComponent.java b/diylc/diylc-core/src/main/java/org/diylc/components/AbstractComponent.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/components/AbstractComponent.java
rename to diylc/diylc-core/src/main/java/org/diylc/components/AbstractComponent.java
index c1da4523..675e1c11 100644
--- a/diylc/diylc-core/src/org/diylc/components/AbstractComponent.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/components/AbstractComponent.java
@@ -1,40 +1,41 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.components;
-import java.awt.Color;
-import java.awt.Font;
-import java.awt.Shape;
-import java.awt.geom.Point2D;
-import java.awt.geom.Rectangle2D;
-import java.lang.reflect.Array;
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.util.Arrays;
-import java.util.stream.Collectors;
-import org.diylc.core.IDIYComponent;
-import org.diylc.core.Project;
-import org.diylc.core.annotations.EditableProperty;
-import org.diylc.core.measures.Size;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.Shape;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+import java.lang.reflect.Array;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.Arrays;
+import java.util.stream.Collectors;
+
+import org.diylc.core.IDIYComponent;
+import org.diylc.core.Project;
+import org.diylc.core.annotations.EditableProperty;
+import org.diylc.core.measures.Size;
/**
* Abstract implementation of {@link IDIYComponent} that contains component name and toString.
@@ -57,14 +58,14 @@ public abstract class AbstractComponent implements IDIYComponent {
public static Color LABEL_COLOR = Color.black;
public static Color LABEL_COLOR_SELECTED = Color.red;
public static Font LABEL_FONT = new Font("Square721 BT", Font.PLAIN, 14);
- public static Color METAL_COLOR = Color.decode("#759DAF");
+ public static Color METAL_COLOR = Color.decode("#759DAF");
public static Color LIGHT_METAL_COLOR = Color.decode("#EEEEEE");
- public static Color COPPER_COLOR = Color.decode("#DA8A67");
- public static Color GOLD_COLOR = Color.decode("#F4B301");
- public static Color FR4_COLOR = Color.decode("#6B9B6B");
- public static Color FR4_LIGHT_COLOR = Color.decode("#BABE71");
- public static Color PHENOLIC_COLOR = Color.decode("#F8EBB3");
- public static Color PHENOLIC_DARK_COLOR = Color.decode("#CD8500");
+ public static Color COPPER_COLOR = Color.decode("#DA8A67");
+ public static Color GOLD_COLOR = Color.decode("#F4B301");
+ public static Color FR4_COLOR = Color.decode("#6B9B6B");
+ public static Color FR4_LIGHT_COLOR = Color.decode("#BABE71");
+ public static Color PHENOLIC_COLOR = Color.decode("#F8EBB3");
+ public static Color PHENOLIC_DARK_COLOR = Color.decode("#CD8500");
@EditableProperty(defaultable = false)
@Override
@@ -88,13 +89,13 @@ public abstract class AbstractComponent implements IDIYComponent {
}
@Override
- public String getValueForDisplay() {
- if (getValue() == null)
- return "";
-
- Object val = getValue();
- if (val.getClass().isArray()) {
- return String.join(" / ", Arrays.stream((Object[])val).map(x -> x == null ? "" : x.toString()).collect(Collectors.toList()));
+ public String getValueForDisplay() {
+ if (getValue() == null)
+ return "";
+
+ Object val = getValue();
+ if (val.getClass().isArray()) {
+ return String.join(" / ", Arrays.stream((Object[])val).map(x -> x == null ? "" : x.toString()).collect(Collectors.toList()));
}
return val.toString();
}
@@ -107,17 +108,17 @@ public abstract class AbstractComponent implements IDIYComponent {
*/
protected int getClosestOdd(double x) {
return ((int) x / 2) * 2 + 1;
- }
-
- /**
- * Returns the closest odd number, i.e. x when x is odd, or x + 1 when x is even.
- *
- * @param x
- * @return
- */
- protected int getClosestOdd(Size s) {
- double x = s.convertToPixels();
- return ((int) x / 2) * 2 + 1;
+ }
+
+ /**
+ * Returns the closest odd number, i.e. x when x is odd, or x + 1 when x is even.
+ *
+ * @param x
+ * @return
+ */
+ protected int getClosestOdd(Size s) {
+ double x = s.convertToPixels();
+ return ((int) x / 2) * 2 + 1;
}
/**
@@ -136,9 +137,9 @@ public abstract class AbstractComponent implements IDIYComponent {
* @param clip
* @return true if none of the control points lie in the clip rectangle.
*/
- protected boolean checkPointsClipped(Shape clip) {
- if (clip == null) {
- return false;
+ protected boolean checkPointsClipped(Shape clip) {
+ if (clip == null) {
+ return false;
}
for (int i = 0; i < getControlPointCount(); i++) {
if (clip.contains(getControlPoint(i))) {
@@ -171,7 +172,7 @@ public abstract class AbstractComponent implements IDIYComponent {
@SuppressWarnings("unchecked")
public IDIYComponent clone() throws CloneNotSupportedException {
try {
- // Instantiate object of the same type
+ // Instantiate object of the same type
Class> clazz = this.getClass();
AbstractComponent newInstance = (AbstractComponent) clazz.getDeclaredConstructor().newInstance();
while (AbstractComponent.class.isAssignableFrom(clazz)) {
@@ -191,7 +192,7 @@ public abstract class AbstractComponent implements IDIYComponent {
&& value.getClass().getComponentType().isAssignableFrom(Point2D.class)) {
Object newArray = Array.newInstance(value.getClass().getComponentType(), Array.getLength(value));
for (int i = 0; i < Array.getLength(value); i++) {
- Point2D p = (Point2D) Array.get(value, i);
+ Point2D p = (Point2D) Array.get(value, i);
if (p != null)
Array.set(newArray, i, new Point2D.Double(p.getX(), p.getY()));
}
@@ -199,7 +200,7 @@ public abstract class AbstractComponent implements IDIYComponent {
}
// Deep copy points.
// TODO: something nicer
- if (value != null && value instanceof Point2D) {
+ if (value != null && value instanceof Point2D) {
Point2D p = (Point2D) value;
value = new Point2D.Double(p.getX(), p.getY());
}
@@ -212,7 +213,7 @@ public abstract class AbstractComponent implements IDIYComponent {
} catch (Exception e) {
throw new CloneNotSupportedException("Could not clone the component. Reason: " + e.getMessage());
}
- }
+ }
@Override
public boolean equalsTo(IDIYComponent> other) {
@@ -229,7 +230,7 @@ public abstract class AbstractComponent implements IDIYComponent {
// in
// AbstractComponent or one of it's child classes
for (Field field : fields) {
- if (!Modifier.isStatic(field.getModifiers()) && !Modifier.isFinal(field.getModifiers()) &&
+ if (!Modifier.isStatic(field.getModifiers()) && !Modifier.isFinal(field.getModifiers()) &&
!Modifier.isTransient(field.getModifiers())) {
field.setAccessible(true);
try {
@@ -251,45 +252,45 @@ public abstract class AbstractComponent implements IDIYComponent {
return true;
if (o1 == null || o2 == null)
return false;
- if (o1.getClass().isArray()) {
- if (o1.getClass().getComponentType() == byte.class)
- return Arrays.equals((byte[]) o1, (byte[]) o2);
- if (o1.getClass().getComponentType() == double.class)
- return Arrays.equals((double[]) o1, (double[]) o2);
- if (o1.getClass().getComponentType() == int.class)
+ if (o1.getClass().isArray()) {
+ if (o1.getClass().getComponentType() == byte.class)
+ return Arrays.equals((byte[]) o1, (byte[]) o2);
+ if (o1.getClass().getComponentType() == double.class)
+ return Arrays.equals((double[]) o1, (double[]) o2);
+ if (o1.getClass().getComponentType() == int.class)
return Arrays.equals((int[]) o1, (int[]) o2);
return Arrays.equals((Object[]) o1, (Object[]) o2);
}
return o1.equals(o2);
- }
-
- @Override
- public String getControlPointNodeName(int index) {
- return Integer.toString(index + 1);
- }
-
- @Override
- public String getInternalLinkName(int index1, int index2) {
- return null;
- }
-
- @Override
- public String[] getSectionNames(int pointIndex) {
- return null;
- }
-
- @Override
- public boolean canPointMoveFreely(int pointIndex) {
- return true;
- }
-
- @Override
- public Rectangle2D getCachingBounds() {
- return null;
- }
-
- @Override
- public void createdIn(Project project) {
- // TODO Auto-generated method stub
+ }
+
+ @Override
+ public String getControlPointNodeName(int index) {
+ return Integer.toString(index + 1);
+ }
+
+ @Override
+ public String getInternalLinkName(int index1, int index2) {
+ return null;
+ }
+
+ @Override
+ public String[] getSectionNames(int pointIndex) {
+ return null;
+ }
+
+ @Override
+ public boolean canPointMoveFreely(int pointIndex) {
+ return true;
+ }
+
+ @Override
+ public Rectangle2D getCachingBounds() {
+ return null;
+ }
+
+ @Override
+ public void createdIn(Project project) {
+ // TODO Auto-generated method stub
}
}
diff --git a/diylc/diylc-core/src/org/diylc/components/AbstractCurvedComponent.java b/diylc/diylc-core/src/main/java/org/diylc/components/AbstractCurvedComponent.java
similarity index 99%
rename from diylc/diylc-core/src/org/diylc/components/AbstractCurvedComponent.java
rename to diylc/diylc-core/src/main/java/org/diylc/components/AbstractCurvedComponent.java
index 2b7cd16e..69458fa4 100644
--- a/diylc/diylc-core/src/org/diylc/components/AbstractCurvedComponent.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/components/AbstractCurvedComponent.java
@@ -30,6 +30,10 @@ import java.util.List;
import java.util.stream.Collectors;
import org.apache.log4j.Logger;
import org.diylc.appframework.miscutils.ConfigurationManager;
+
+import com.google.common.collect.Streams;
+import com.thoughtworks.xstream.annotations.XStreamOmitField;
+
import org.diylc.common.IPlugInPort;
import org.diylc.common.LineStyle;
import org.diylc.common.ObjectCache;
@@ -41,8 +45,6 @@ import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.measures.Size;
import org.diylc.core.measures.SizeUnit;
import org.diylc.utils.Constants;
-import com.google.common.collect.Streams;
-import com.thoughtworks.xstream.annotations.XStreamOmitField;
public abstract class AbstractCurvedComponent extends AbstractTransparentComponent {
diff --git a/diylc/diylc-core/src/org/diylc/components/AbstractLabeledComponent.java b/diylc/diylc-core/src/main/java/org/diylc/components/AbstractLabeledComponent.java
similarity index 99%
rename from diylc/diylc-core/src/org/diylc/components/AbstractLabeledComponent.java
rename to diylc/diylc-core/src/main/java/org/diylc/components/AbstractLabeledComponent.java
index 84c0ddc5..76176a24 100644
--- a/diylc/diylc-core/src/org/diylc/components/AbstractLabeledComponent.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/components/AbstractLabeledComponent.java
@@ -19,13 +19,13 @@
along with DIYLC. If not, see .
*/
-package org.diylc.components;
-
-import org.diylc.core.annotations.EditableProperty;
-
-public abstract class AbstractLabeledComponent extends AbstractTransparentComponent {
-
- private static final long serialVersionUID = 1L;
+package org.diylc.components;
+
+import org.diylc.core.annotations.EditableProperty;
+
+public abstract class AbstractLabeledComponent extends AbstractTransparentComponent {
+
+ private static final long serialVersionUID = 1L;
protected Integer fontSizeOverride;
@@ -36,5 +36,5 @@ public abstract class AbstractLabeledComponent extends AbstractTransparentCom
public void setFontSizeOverride(Integer fontSizeOverride) {
this.fontSizeOverride = fontSizeOverride;
- }
-}
+ }
+}
diff --git a/diylc/diylc-core/src/org/diylc/components/AbstractTransparentComponent.java b/diylc/diylc-core/src/main/java/org/diylc/components/AbstractTransparentComponent.java
similarity index 98%
rename from diylc/diylc-core/src/org/diylc/components/AbstractTransparentComponent.java
rename to diylc/diylc-core/src/main/java/org/diylc/components/AbstractTransparentComponent.java
index adfb4793..78a9615d 100644
--- a/diylc/diylc-core/src/org/diylc/components/AbstractTransparentComponent.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/components/AbstractTransparentComponent.java
@@ -19,24 +19,24 @@
along with DIYLC. If not, see .
*/
-package org.diylc.components;
-
-import org.diylc.core.annotations.EditableProperty;
-
-public abstract class AbstractTransparentComponent extends AbstractComponent {
-
- private static final long serialVersionUID = 1L;
-
- public static byte MAX_ALPHA = 127;
-
- protected byte alpha = MAX_ALPHA;
-
- @EditableProperty
- public Byte getAlpha() {
- return alpha;
- }
-
- public void setAlpha(Byte alpha) {
- this.alpha = alpha;
- }
-}
+package org.diylc.components;
+
+import org.diylc.core.annotations.EditableProperty;
+
+public abstract class AbstractTransparentComponent extends AbstractComponent {
+
+ private static final long serialVersionUID = 1L;
+
+ public static byte MAX_ALPHA = 127;
+
+ protected byte alpha = MAX_ALPHA;
+
+ @EditableProperty
+ public Byte getAlpha() {
+ return alpha;
+ }
+
+ public void setAlpha(Byte alpha) {
+ this.alpha = alpha;
+ }
+}
diff --git a/diylc/diylc-core/src/org/diylc/components/transform/DefaultTransformer.java b/diylc/diylc-core/src/main/java/org/diylc/components/transform/DefaultTransformer.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/components/transform/DefaultTransformer.java
rename to diylc/diylc-core/src/main/java/org/diylc/components/transform/DefaultTransformer.java
index 57c828c9..e9e4407b 100644
--- a/diylc/diylc-core/src/org/diylc/components/transform/DefaultTransformer.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/components/transform/DefaultTransformer.java
@@ -1,28 +1,29 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.components.transform;
-import java.awt.geom.Point2D;
-import org.diylc.common.IComponentTransformer;
+import java.awt.geom.Point2D;
+
+import org.diylc.common.IComponentTransformer;
import org.diylc.core.IDIYComponent;
public class DefaultTransformer implements IComponentTransformer {
diff --git a/diylc/diylc-core/src/org/diylc/components/transform/LeadedComponentTransformer.java b/diylc/diylc-core/src/main/java/org/diylc/components/transform/LeadedComponentTransformer.java
similarity index 97%
rename from diylc/diylc-core/src/org/diylc/components/transform/LeadedComponentTransformer.java
rename to diylc/diylc-core/src/main/java/org/diylc/components/transform/LeadedComponentTransformer.java
index 2e858493..14ed0ae6 100644
--- a/diylc/diylc-core/src/org/diylc/components/transform/LeadedComponentTransformer.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/components/transform/LeadedComponentTransformer.java
@@ -1,29 +1,30 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.components.transform;
-import java.awt.geom.AffineTransform;
-import java.awt.geom.Point2D;
-import org.diylc.common.IComponentTransformer;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Point2D;
+
+import org.diylc.common.IComponentTransformer;
import org.diylc.core.IDIYComponent;
public class LeadedComponentTransformer implements IComponentTransformer {
@@ -46,7 +47,7 @@ public class LeadedComponentTransformer implements IComponentTransformer {
@Override
public void rotate(IDIYComponent> component, Point2D center, int direction) {
AffineTransform rotate = AffineTransform.getRotateInstance(Math.PI / 2 * direction, center.getX(), center.getY());
- for (int index = 0; index < component.getControlPointCount(); index++) {
+ for (int index = 0; index < component.getControlPointCount(); index++) {
Point2D p = new Point2D.Double();
rotate.transform(component.getControlPoint(index), p);
component.setControlPoint(p, index);
diff --git a/diylc/diylc-core/src/org/diylc/components/transform/SimpleComponentTransformer.java b/diylc/diylc-core/src/main/java/org/diylc/components/transform/SimpleComponentTransformer.java
similarity index 97%
rename from diylc/diylc-core/src/org/diylc/components/transform/SimpleComponentTransformer.java
rename to diylc/diylc-core/src/main/java/org/diylc/components/transform/SimpleComponentTransformer.java
index e53ee659..3cf9fd74 100644
--- a/diylc/diylc-core/src/org/diylc/components/transform/SimpleComponentTransformer.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/components/transform/SimpleComponentTransformer.java
@@ -1,30 +1,31 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.components.transform;
-import java.awt.Point;
-import java.awt.geom.AffineTransform;
-import java.awt.geom.Point2D;
-import org.diylc.common.IComponentTransformer;
+import java.awt.Point;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Point2D;
+
+import org.diylc.common.IComponentTransformer;
import org.diylc.core.IDIYComponent;
public class SimpleComponentTransformer implements IComponentTransformer {
diff --git a/diylc/diylc-core/src/org/diylc/core/AllowAllValidator.java b/diylc/diylc-core/src/main/java/org/diylc/core/AllowAllValidator.java
similarity index 98%
rename from diylc/diylc-core/src/org/diylc/core/AllowAllValidator.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/AllowAllValidator.java
index bc060dca..f3087579 100644
--- a/diylc/diylc-core/src/org/diylc/core/AllowAllValidator.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/AllowAllValidator.java
@@ -19,15 +19,15 @@
along with DIYLC. If not, see .
*/
-package org.diylc.core;
-
-/**
- * Validator that allows all values.
- *
- * @author Branislav Stojkovic
- */
-public class AllowAllValidator implements IPropertyValidator {
-
- @Override
- public void validate(Object owner, Object value) throws ValidationException {}
-}
+package org.diylc.core;
+
+/**
+ * Validator that allows all values.
+ *
+ * @author Branislav Stojkovic
+ */
+public class AllowAllValidator implements IPropertyValidator {
+
+ @Override
+ public void validate(Object owner, Object value) throws ValidationException {}
+}
diff --git a/diylc/diylc-core/src/org/diylc/core/Angle.java b/diylc/diylc-core/src/main/java/org/diylc/core/Angle.java
similarity index 100%
rename from diylc/diylc-core/src/org/diylc/core/Angle.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/Angle.java
diff --git a/diylc/diylc-core/src/org/diylc/core/ComponentForRender.java b/diylc/diylc-core/src/main/java/org/diylc/core/ComponentForRender.java
similarity index 100%
rename from diylc/diylc-core/src/org/diylc/core/ComponentForRender.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/ComponentForRender.java
diff --git a/diylc/diylc-core/src/org/diylc/core/ComponentState.java b/diylc/diylc-core/src/main/java/org/diylc/core/ComponentState.java
similarity index 98%
rename from diylc/diylc-core/src/org/diylc/core/ComponentState.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/ComponentState.java
index 005b6b07..b245b81b 100644
--- a/diylc/diylc-core/src/org/diylc/core/ComponentState.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/ComponentState.java
@@ -19,14 +19,14 @@
along with DIYLC. If not, see .
*/
-package org.diylc.core;
-
-/**
- * Enumerates all possible states that a component can be in.
- *
- * @author Branislav Stojkovic
- */
-public enum ComponentState {
-
- NORMAL, SELECTED, LOCKED, DRAGGING
-}
+package org.diylc.core;
+
+/**
+ * Enumerates all possible states that a component can be in.
+ *
+ * @author Branislav Stojkovic
+ */
+public enum ComponentState {
+
+ NORMAL, SELECTED, LOCKED, DRAGGING
+}
diff --git a/diylc/diylc-core/src/org/diylc/core/CreationMethod.java b/diylc/diylc-core/src/main/java/org/diylc/core/CreationMethod.java
similarity index 99%
rename from diylc/diylc-core/src/org/diylc/core/CreationMethod.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/CreationMethod.java
index 09dd2661..c1479ccd 100644
--- a/diylc/diylc-core/src/org/diylc/core/CreationMethod.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/CreationMethod.java
@@ -19,9 +19,9 @@
along with DIYLC. If not, see .
*/
-package org.diylc.core;
-
-public enum CreationMethod {
-
- SINGLE_CLICK, POINT_BY_POINT;
-}
+package org.diylc.core;
+
+public enum CreationMethod {
+
+ SINGLE_CLICK, POINT_BY_POINT;
+}
diff --git a/diylc/diylc-core/src/org/diylc/core/ExpansionMode.java b/diylc/diylc-core/src/main/java/org/diylc/core/ExpansionMode.java
similarity index 99%
rename from diylc/diylc-core/src/org/diylc/core/ExpansionMode.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/ExpansionMode.java
index 8d73e4c6..31fa58c0 100644
--- a/diylc/diylc-core/src/org/diylc/core/ExpansionMode.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/ExpansionMode.java
@@ -19,9 +19,9 @@
along with DIYLC. If not, see .
*/
-package org.diylc.core;
-
-public enum ExpansionMode {
-
- ALL, SAME_TYPE, IMMEDIATE,
-}
+package org.diylc.core;
+
+public enum ExpansionMode {
+
+ ALL, SAME_TYPE, IMMEDIATE,
+}
diff --git a/diylc/diylc-core/src/org/diylc/core/ICommonNode.java b/diylc/diylc-core/src/main/java/org/diylc/core/ICommonNode.java
similarity index 100%
rename from diylc/diylc-core/src/org/diylc/core/ICommonNode.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/ICommonNode.java
diff --git a/diylc/diylc-core/src/org/diylc/core/IContinuity.java b/diylc/diylc-core/src/main/java/org/diylc/core/IContinuity.java
similarity index 100%
rename from diylc/diylc-core/src/org/diylc/core/IContinuity.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/IContinuity.java
diff --git a/diylc/diylc-core/src/org/diylc/core/IDIYComponent.java b/diylc/diylc-core/src/main/java/org/diylc/core/IDIYComponent.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/core/IDIYComponent.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/IDIYComponent.java
index ecf2c54e..3ea5b8c2 100644
--- a/diylc/diylc-core/src/org/diylc/core/IDIYComponent.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/IDIYComponent.java
@@ -1,31 +1,32 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.core;
-import java.awt.Graphics2D;
-import java.awt.geom.Point2D;
-import java.awt.geom.Rectangle2D;
-import java.io.Serializable;
-import org.diylc.core.annotations.ComponentDescriptor;
+import java.awt.Graphics2D;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+import java.io.Serializable;
+
+import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
/**
@@ -50,7 +51,7 @@ public interface IDIYComponent extends Serializable, Cloneable {
public static final int CHASSIS = 1;
public static final int BOARD = 2;
public static final int TRACE = 3;
- public static final int COMPONENT = 4;
+ public static final int COMPONENT = 4;
public static final int WIRING = 5;
public static final int TEXT = 6;
@@ -111,37 +112,37 @@ public interface IDIYComponent extends Serializable, Cloneable {
* same component. The other control point must be able to overlap too.
*/
boolean canControlPointOverlap(int index);
-
- /**
- * @param index
- * @return {@link VisibilityPolicy} of the control point.
+
+ /**
+ * @param index
+ * @return {@link VisibilityPolicy} of the control point.
+ */
+ VisibilityPolicy getControlPointVisibilityPolicy(int index);
+
+ /**
+ * @param index
+ * @return name of the control point node, if the control point represents a graph node, null otherwise.
+ */
+ String getControlPointNodeName(int index);
+
+ /**
+ * @param index1
+ * @param index2
+ * @return name of the internal linked formed by the two control points, null if they do not form an internal link
+ */
+ String getInternalLinkName(int index1, int index2);
+
+ /**
+ * @param pointIndex
+ * @return name of the internal section containing the specified point, or null if the component does not have internal sections.
+ * One point can be shared between multiple sections, in which case, the result may contain more than one element.
+ */
+ String[] getSectionNames(int pointIndex);
+
+ /**
+ * @param pointIndex
+ * @return true if the control point can move without affecting other points' position, false otherwise
*/
- VisibilityPolicy getControlPointVisibilityPolicy(int index);
-
- /**
- * @param index
- * @return name of the control point node, if the control point represents a graph node, null otherwise.
- */
- String getControlPointNodeName(int index);
-
- /**
- * @param index1
- * @param index2
- * @return name of the internal linked formed by the two control points, null if they do not form an internal link
- */
- String getInternalLinkName(int index1, int index2);
-
- /**
- * @param pointIndex
- * @return name of the internal section containing the specified point, or null if the component does not have internal sections.
- * One point can be shared between multiple sections, in which case, the result may contain more than one element.
- */
- String[] getSectionNames(int pointIndex);
-
- /**
- * @param pointIndex
- * @return true if the control point can move without affecting other points' position, false otherwise
- */
boolean canPointMoveFreely(int pointIndex);
/**
@@ -184,18 +185,18 @@ public interface IDIYComponent extends Serializable, Cloneable {
* @param other
* @return
*/
- boolean equalsTo(IDIYComponent> other);
-
- /**
- * Used only if {@link ComponentDescriptor#enableCache()} is set to true.
- * @return
- */
- Rectangle2D getCachingBounds();
-
- /**
- * Notifies the component that it's being created in the context of the specified project
- *
- * @param project
- */
+ boolean equalsTo(IDIYComponent> other);
+
+ /**
+ * Used only if {@link ComponentDescriptor#enableCache()} is set to true.
+ * @return
+ */
+ Rectangle2D getCachingBounds();
+
+ /**
+ * Notifies the component that it's being created in the context of the specified project
+ *
+ * @param project
+ */
void createdIn(Project project);
}
diff --git a/diylc/diylc-core/src/org/diylc/core/IDatasheetSupport.java b/diylc/diylc-core/src/main/java/org/diylc/core/IDatasheetSupport.java
similarity index 100%
rename from diylc/diylc-core/src/org/diylc/core/IDatasheetSupport.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/IDatasheetSupport.java
diff --git a/diylc/diylc-core/src/org/diylc/core/IDrawingObserver.java b/diylc/diylc-core/src/main/java/org/diylc/core/IDrawingObserver.java
similarity index 99%
rename from diylc/diylc-core/src/org/diylc/core/IDrawingObserver.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/IDrawingObserver.java
index c7e69562..c22df443 100644
--- a/diylc/diylc-core/src/org/diylc/core/IDrawingObserver.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/IDrawingObserver.java
@@ -21,22 +21,22 @@
*/
package org.diylc.core;
-/**
- * Interface for tracking component drawing process. Components may use it to stop or restart
- * tracking. Anything drawn while tracking is stopped will not be added to the mouse hot-spot area.
- *
- * @author Branislav Stojkovic
- */
-public interface IDrawingObserver {
+/**
+ * Interface for tracking component drawing process. Components may use it to stop or restart
+ * tracking. Anything drawn while tracking is stopped will not be added to the mouse hot-spot area.
+ *
+ * @author Branislav Stojkovic
+ */
+public interface IDrawingObserver {
/**
* Notifies the observer that it should start tracking the drawing process.
- */
- void stopTracking();
+ */
+ void stopTracking();
/**
* Notifies the observer that it should stop tracking the drawing process.
- */
+ */
void startTracking();
/**
@@ -64,5 +64,5 @@ public interface IDrawingObserver {
*
* @param marker
*/
- void setContinuityMarker(String marker);
-}
+ void setContinuityMarker(String marker);
+}
diff --git a/diylc/diylc-core/src/org/diylc/core/ILayeredComponent.java b/diylc/diylc-core/src/main/java/org/diylc/core/ILayeredComponent.java
similarity index 100%
rename from diylc/diylc-core/src/org/diylc/core/ILayeredComponent.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/ILayeredComponent.java
diff --git a/diylc/diylc-core/src/org/diylc/core/IPropertyValidator.java b/diylc/diylc-core/src/main/java/org/diylc/core/IPropertyValidator.java
similarity index 98%
rename from diylc/diylc-core/src/org/diylc/core/IPropertyValidator.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/IPropertyValidator.java
index 15b8fa91..329c19f3 100644
--- a/diylc/diylc-core/src/org/diylc/core/IPropertyValidator.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/IPropertyValidator.java
@@ -19,19 +19,19 @@
along with DIYLC. If not, see .
*/
-package org.diylc.core;
-
-/**
- * Interface for validating property value changes.
- *
- * @author Branislav Stojkovic
- */
-public interface IPropertyValidator {
-
+package org.diylc.core;
+
+/**
+ * Interface for validating property value changes.
+ *
+ * @author Branislav Stojkovic
+ */
+public interface IPropertyValidator {
+
/**
- * @param owner
- * @param value
- * @throws ValidationException if validation fails. Message will contain the reason.
- */
- void validate(Object owner, Object value) throws ValidationException;
-}
+ * @param owner
+ * @param value
+ * @throws ValidationException if validation fails. Message will contain the reason.
+ */
+ void validate(Object owner, Object value) throws ValidationException;
+}
diff --git a/diylc/diylc-core/src/org/diylc/core/ISwitch.java b/diylc/diylc-core/src/main/java/org/diylc/core/ISwitch.java
similarity index 100%
rename from diylc/diylc-core/src/org/diylc/core/ISwitch.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/ISwitch.java
diff --git a/diylc/diylc-core/src/org/diylc/core/IView.java b/diylc/diylc-core/src/main/java/org/diylc/core/IView.java
similarity index 97%
rename from diylc/diylc-core/src/org/diylc/core/IView.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/IView.java
index 17828a14..d367ac37 100644
--- a/diylc/diylc-core/src/org/diylc/core/IView.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/IView.java
@@ -1,29 +1,30 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.core;
-import java.io.File;
-import java.util.List;
-import java.util.Set;
+import java.io.File;
+import java.util.List;
+import java.util.Set;
+
import org.diylc.common.PropertyWrapper;
@@ -55,8 +56,8 @@ public interface IView {
int showConfirmDialog(String message, String title, int optionType, int messageType);
- boolean editProperties(List properties, Set defaultedProperties, String title);
-
+ boolean editProperties(List properties, Set defaultedProperties, String title);
+
String showInputDialog(String message, String title);
File promptFileSave();
diff --git a/diylc/diylc-core/src/org/diylc/core/Project.java b/diylc/diylc-core/src/main/java/org/diylc/core/Project.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/core/Project.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/Project.java
index 86ce44a8..76f4ce72 100644
--- a/diylc/diylc-core/src/org/diylc/core/Project.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/Project.java
@@ -1,41 +1,42 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.core;
-import java.awt.Font;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.diylc.appframework.update.VersionNumber;
-import org.diylc.core.annotations.EditableProperty;
-import org.diylc.core.annotations.MultiLineText;
-import org.diylc.core.annotations.PositiveMeasureValidator;
-import org.diylc.core.annotations.PositiveNonZeroMeasureValidator;
-import org.diylc.core.measures.Size;
+import java.awt.Font;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.diylc.appframework.update.VersionNumber;
+
+import org.diylc.core.annotations.EditableProperty;
+import org.diylc.core.annotations.MultiLineText;
+import org.diylc.core.annotations.PositiveMeasureValidator;
+import org.diylc.core.annotations.PositiveNonZeroMeasureValidator;
+import org.diylc.core.measures.Size;
import org.diylc.core.measures.SizeUnit;
/**
@@ -62,11 +63,11 @@ public class Project implements Serializable, Cloneable {
private String description;
private Size width;
private Size height;
- private Size gridSpacing;
+ private Size gridSpacing;
private Integer dotSpacing;
private List> components;
private Set>> groups;
- private Set lockedLayers;
+ private Set lockedLayers;
private Set> lockedComponents;
private Set hiddenLayers;
private Font font = DEFAULT_FONT;
@@ -75,7 +76,7 @@ public class Project implements Serializable, Cloneable {
components = new ArrayList>();
groups = new HashSet>>();
lockedLayers = new HashSet();
- hiddenLayers = new HashSet();
+ hiddenLayers = new HashSet();
lockedComponents = new HashSet>();
title = DEFAULT_TITLE;
author = System.getProperty("user.name");
@@ -137,17 +138,17 @@ public class Project implements Serializable, Cloneable {
public void setGridSpacing(Size gridSpacing) {
this.gridSpacing = gridSpacing;
- }
-
- @EditableProperty(name = "Dot Spacing", validatorClass = PositiveNonZeroMeasureValidator.class)
- public Integer getDotSpacing() {
- if (dotSpacing == null)
- dotSpacing = 1;
- return dotSpacing;
- }
-
- public void setDotSpacing(Integer dotSpacing) {
- this.dotSpacing = dotSpacing;
+ }
+
+ @EditableProperty(name = "Dot Spacing", validatorClass = PositiveNonZeroMeasureValidator.class)
+ public Integer getDotSpacing() {
+ if (dotSpacing == null)
+ dotSpacing = 1;
+ return dotSpacing;
+ }
+
+ public void setDotSpacing(Integer dotSpacing) {
+ this.dotSpacing = dotSpacing;
}
/**
@@ -166,12 +167,12 @@ public class Project implements Serializable, Cloneable {
*/
public Set>> getGroups() {
return groups;
- }
-
- public Set> getLockedComponents() {
- if (lockedComponents == null)
- lockedComponents = new HashSet>();
- return lockedComponents;
+ }
+
+ public Set> getLockedComponents() {
+ if (lockedComponents == null)
+ lockedComponents = new HashSet>();
+ return lockedComponents;
}
public Set getLockedLayers() {
@@ -275,36 +276,36 @@ public class Project implements Serializable, Cloneable {
if (other.width != null)
return false;
} else if (!width.equals(other.width))
- return false;
- if (gridSpacing == null) {
- if (other.gridSpacing != null)
- return false;
- } else if (!gridSpacing.equals(other.gridSpacing))
- return false;
- if (font == null) {
- if (other.font != null)
- return false;
- } else if (!font.getFamily().equals(other.font.getFamily()) || font.getSize() != other.font.getSize() || font.getStyle() != other.font.getStyle())
- return false;
- if (groups == null) {
- if (other.groups != null)
- return false;
- } else if (!groups.equals(other.groups))
- return false;
- if (lockedLayers == null) {
- if (other.lockedLayers != null)
- return false;
- } else if (!lockedLayers.equals(other.lockedLayers))
- return false;
- if (getLockedComponents() == null) {
- if (other.lockedComponents != null)
- return false;
- } else if (!getLockedComponents().equals(other.lockedComponents))
- return false;
- if (hiddenLayers == null) {
- if (other.hiddenLayers != null)
- return false;
- } else if (!hiddenLayers.equals(other.hiddenLayers))
+ return false;
+ if (gridSpacing == null) {
+ if (other.gridSpacing != null)
+ return false;
+ } else if (!gridSpacing.equals(other.gridSpacing))
+ return false;
+ if (font == null) {
+ if (other.font != null)
+ return false;
+ } else if (!font.getFamily().equals(other.font.getFamily()) || font.getSize() != other.font.getSize() || font.getStyle() != other.font.getStyle())
+ return false;
+ if (groups == null) {
+ if (other.groups != null)
+ return false;
+ } else if (!groups.equals(other.groups))
+ return false;
+ if (lockedLayers == null) {
+ if (other.lockedLayers != null)
+ return false;
+ } else if (!lockedLayers.equals(other.lockedLayers))
+ return false;
+ if (getLockedComponents() == null) {
+ if (other.lockedComponents != null)
+ return false;
+ } else if (!getLockedComponents().equals(other.lockedComponents))
+ return false;
+ if (hiddenLayers == null) {
+ if (other.hiddenLayers != null)
+ return false;
+ } else if (!hiddenLayers.equals(other.hiddenLayers))
return false;
return true;
}
@@ -340,7 +341,7 @@ public class Project implements Serializable, Cloneable {
project.setHeight(this.getHeight());
project.setWidth(this.getWidth());
project.getLockedLayers().addAll(this.getLockedLayers());
- project.getHiddenLayers().addAll(this.getHiddenLayers());
+ project.getHiddenLayers().addAll(this.getHiddenLayers());
project.setFont(this.getFont());
Map, IDIYComponent>> cloneMap = new HashMap, IDIYComponent>>();
@@ -361,10 +362,10 @@ public class Project implements Serializable, Cloneable {
cloneGroup.add(cloneMap.get(component));
}
project.groups.add(cloneGroup);
- }
-
- for (IDIYComponent> component : this.getLockedComponents()) {
- project.lockedComponents.add(cloneMap.get(component));
+ }
+
+ for (IDIYComponent> component : this.getLockedComponents()) {
+ project.lockedComponents.add(cloneMap.get(component));
}
return project;
}
diff --git a/diylc/diylc-core/src/org/diylc/core/Template.java b/diylc/diylc-core/src/main/java/org/diylc/core/Template.java
similarity index 98%
rename from diylc/diylc-core/src/org/diylc/core/Template.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/Template.java
index 798191dc..44c6b568 100644
--- a/diylc/diylc-core/src/org/diylc/core/Template.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/Template.java
@@ -19,17 +19,17 @@
along with DIYLC. If not, see .
*/
-package org.diylc.core;
+package org.diylc.core;
import java.awt.geom.Point2D;
import java.time.LocalDateTime;
import java.util.List;
-import java.util.Map;
-
-public class Template {
-
- private String name;
- private Map values;
+import java.util.Map;
+
+public class Template {
+
+ private String name;
+ private Map values;
private List points;
@SuppressWarnings("unused")
@Deprecated
@@ -41,37 +41,37 @@ public class Template {
public Template(String name, Map values, List points) {
this(name, values, points, LocalDateTime.now());
- }
-
- public Template(String name, Map values, List points, LocalDateTime createdOn) {
- this.name = name;
- this.values = values;
+ }
+
+ public Template(String name, Map values, List points, LocalDateTime createdOn) {
+ this.name = name;
+ this.values = values;
+ this.points = points;
+ this.createdOn = createdOn;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Map getValues() {
+ return values;
+ }
+
+ public void setValues(Map values) {
+ this.values = values;
+ }
+
+ public List getPoints() {
+ return points;
+ }
+
+ public void setPoints(List points) {
this.points = points;
- this.createdOn = createdOn;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Map getValues() {
- return values;
- }
-
- public void setValues(Map values) {
- this.values = values;
- }
-
- public List getPoints() {
- return points;
- }
-
- public void setPoints(List points) {
- this.points = points;
}
public LocalDateTime getCreatedOn() {
@@ -80,8 +80,8 @@ public class Template {
public void setCreatedOn(LocalDateTime createdOn) {
this.createdOn = createdOn;
- }
-
+ }
+
@Override
public int hashCode() {
final int prime = 31;
@@ -125,8 +125,8 @@ public class Template {
return true;
}
- @Override
- public String toString() {
- return name;
- }
-}
+ @Override
+ public String toString() {
+ return name;
+ }
+}
diff --git a/diylc/diylc-core/src/org/diylc/core/Theme.java b/diylc/diylc-core/src/main/java/org/diylc/core/Theme.java
similarity index 95%
rename from diylc/diylc-core/src/org/diylc/core/Theme.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/Theme.java
index 21ba7516..2902eec1 100644
--- a/diylc/diylc-core/src/org/diylc/core/Theme.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/Theme.java
@@ -1,27 +1,27 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.core;
-import java.awt.Color;
+import java.awt.Color;
import java.io.Serializable;
public class Theme implements Serializable {
@@ -31,14 +31,14 @@ public class Theme implements Serializable {
private String name;
private Color bgColor;
private Color gridColor;
- private Color outlineColor;
+ private Color outlineColor;
private Color dotColor;
public Theme(String name, Color bgColor, Color gridColor, Color dotColor, Color outlineColor) {
super();
this.name = name;
this.bgColor = bgColor;
- this.gridColor = gridColor;
+ this.gridColor = gridColor;
this.dotColor = dotColor;
this.outlineColor = outlineColor;
}
@@ -53,12 +53,12 @@ public class Theme implements Serializable {
public Color getGridColor() {
return gridColor;
- }
-
- public Color getDotColor() {
- if (dotColor == null)
- dotColor = gridColor;
- return dotColor;
+ }
+
+ public Color getDotColor() {
+ if (dotColor == null)
+ dotColor = gridColor;
+ return dotColor;
}
public Color getOutlineColor() {
diff --git a/diylc/diylc-core/src/org/diylc/core/ValidationException.java b/diylc/diylc-core/src/main/java/org/diylc/core/ValidationException.java
similarity index 98%
rename from diylc/diylc-core/src/org/diylc/core/ValidationException.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/ValidationException.java
index c4d4db7d..e64bef35 100644
--- a/diylc/diylc-core/src/org/diylc/core/ValidationException.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/ValidationException.java
@@ -19,13 +19,13 @@
along with DIYLC. If not, see .
*/
-package org.diylc.core;
-
-public class ValidationException extends Exception {
-
- private static final long serialVersionUID = 1L;
-
- public ValidationException(String message) {
- super(message);
- }
-}
+package org.diylc.core;
+
+public class ValidationException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ public ValidationException(String message) {
+ super(message);
+ }
+}
diff --git a/diylc/diylc-core/src/org/diylc/core/VisibilityPolicy.java b/diylc/diylc-core/src/main/java/org/diylc/core/VisibilityPolicy.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/core/VisibilityPolicy.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/VisibilityPolicy.java
index 036e765d..d8a54689 100644
--- a/diylc/diylc-core/src/org/diylc/core/VisibilityPolicy.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/VisibilityPolicy.java
@@ -1,24 +1,24 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.core;
/**
diff --git a/diylc/diylc-core/src/org/diylc/core/annotations/BinaryType.java b/diylc/diylc-core/src/main/java/org/diylc/core/annotations/BinaryType.java
similarity index 100%
rename from diylc/diylc-core/src/org/diylc/core/annotations/BinaryType.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/annotations/BinaryType.java
diff --git a/diylc/diylc-core/src/org/diylc/core/annotations/BomPolicy.java b/diylc/diylc-core/src/main/java/org/diylc/core/annotations/BomPolicy.java
similarity index 98%
rename from diylc/diylc-core/src/org/diylc/core/annotations/BomPolicy.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/annotations/BomPolicy.java
index a4f5882c..24d324c5 100644
--- a/diylc/diylc-core/src/org/diylc/core/annotations/BomPolicy.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/annotations/BomPolicy.java
@@ -19,15 +19,15 @@
along with DIYLC. If not, see .
*/
-package org.diylc.core.annotations;
-
-/**
- * Tells the system how to represent components in the B.O.M.
- *
- * @see ComponentDescriptor
- *
- * @author Branislav Stojkovic
- */
-public enum BomPolicy {
- SHOW_ALL_NAMES, SHOW_ONLY_TYPE_NAME, NEVER_SHOW,
-}
+package org.diylc.core.annotations;
+
+/**
+ * Tells the system how to represent components in the B.O.M.
+ *
+ * @see ComponentDescriptor
+ *
+ * @author Branislav Stojkovic
+ */
+public enum BomPolicy {
+ SHOW_ALL_NAMES, SHOW_ONLY_TYPE_NAME, NEVER_SHOW,
+}
diff --git a/diylc/diylc-core/src/org/diylc/core/annotations/ByteArrayProperty.java b/diylc/diylc-core/src/main/java/org/diylc/core/annotations/ByteArrayProperty.java
similarity index 100%
rename from diylc/diylc-core/src/org/diylc/core/annotations/ByteArrayProperty.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/annotations/ByteArrayProperty.java
diff --git a/diylc/diylc-core/src/org/diylc/core/annotations/ComponentDescriptor.java b/diylc/diylc-core/src/main/java/org/diylc/core/annotations/ComponentDescriptor.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/core/annotations/ComponentDescriptor.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/annotations/ComponentDescriptor.java
index 960c8e93..af368285 100644
--- a/diylc/diylc-core/src/org/diylc/core/annotations/ComponentDescriptor.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/annotations/ComponentDescriptor.java
@@ -1,31 +1,32 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.core.annotations;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import org.diylc.common.DefaultComponentTransformer;
-import org.diylc.common.IComponentTransformer;
-import org.diylc.core.CreationMethod;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+import org.diylc.common.DefaultComponentTransformer;
+import org.diylc.common.IComponentTransformer;
+import org.diylc.core.CreationMethod;
import org.diylc.core.IDIYComponent;
/**
@@ -109,22 +110,22 @@ public @interface ComponentDescriptor {
*
* @return
*/
- String keywordTag() default "";
-
- /**
- * @return true if the component drawing should be cached
- */
- boolean enableCache() default false;
-
- /**
- * @return true if component datasheet should be loaded from the corresponding file
- */
- boolean enableDatasheet() default false;
-
- /**
- * If datasheet is enabled, this property determines how many columns define a component, e.g. in how many steps we can instantiate a component
- *
- * @return
- */
+ String keywordTag() default "";
+
+ /**
+ * @return true if the component drawing should be cached
+ */
+ boolean enableCache() default false;
+
+ /**
+ * @return true if component datasheet should be loaded from the corresponding file
+ */
+ boolean enableDatasheet() default false;
+
+ /**
+ * If datasheet is enabled, this property determines how many columns define a component, e.g. in how many steps we can instantiate a component
+ *
+ * @return
+ */
int datasheetCreationStepCount() default 0;
}
diff --git a/diylc/diylc-core/src/org/diylc/core/annotations/DynamicList.java b/diylc/diylc-core/src/main/java/org/diylc/core/annotations/DynamicList.java
similarity index 99%
rename from diylc/diylc-core/src/org/diylc/core/annotations/DynamicList.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/annotations/DynamicList.java
index 05e5f4c1..6613c740 100644
--- a/diylc/diylc-core/src/org/diylc/core/annotations/DynamicList.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/annotations/DynamicList.java
@@ -19,13 +19,13 @@
along with DIYLC. If not, see .
*/
-package org.diylc.core.annotations;
-
+package org.diylc.core.annotations;
+
import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-@Retention(RetentionPolicy.RUNTIME)
-public @interface DynamicList {
-
- public String availableValueFunction();
-}
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface DynamicList {
+
+ public String availableValueFunction();
+}
diff --git a/diylc/diylc-core/src/org/diylc/core/annotations/EditableProperty.java b/diylc/diylc-core/src/main/java/org/diylc/core/annotations/EditableProperty.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/core/annotations/EditableProperty.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/annotations/EditableProperty.java
index ebc8085b..ba31063a 100644
--- a/diylc/diylc-core/src/org/diylc/core/annotations/EditableProperty.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/annotations/EditableProperty.java
@@ -1,29 +1,30 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.core.annotations;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import org.diylc.core.AllowAllValidator;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+import org.diylc.core.AllowAllValidator;
import org.diylc.core.IPropertyValidator;
/**
diff --git a/diylc/diylc-core/src/org/diylc/core/annotations/ElementLabel.java b/diylc/diylc-core/src/main/java/org/diylc/core/annotations/ElementLabel.java
similarity index 99%
rename from diylc/diylc-core/src/org/diylc/core/annotations/ElementLabel.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/annotations/ElementLabel.java
index 16d01752..6d39b9b8 100644
--- a/diylc/diylc-core/src/org/diylc/core/annotations/ElementLabel.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/annotations/ElementLabel.java
@@ -19,9 +19,9 @@
along with DIYLC. If not, see .
*/
-package org.diylc.core.annotations;
-
-public @interface ElementLabel {
-
- public String functionName();
-}
+package org.diylc.core.annotations;
+
+public @interface ElementLabel {
+
+ public String functionName();
+}
diff --git a/diylc/diylc-core/src/org/diylc/core/annotations/IAutoCreator.java b/diylc/diylc-core/src/main/java/org/diylc/core/annotations/IAutoCreator.java
similarity index 98%
rename from diylc/diylc-core/src/org/diylc/core/annotations/IAutoCreator.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/annotations/IAutoCreator.java
index 6ea5e88f..e22cd4af 100644
--- a/diylc/diylc-core/src/org/diylc/core/annotations/IAutoCreator.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/annotations/IAutoCreator.java
@@ -19,23 +19,24 @@
along with DIYLC. If not, see .
*/
-package org.diylc.core.annotations;
-
+package org.diylc.core.annotations;
+
import java.util.List;
-import org.diylc.core.IDIYComponent;
-
-/**
- * Interface for creating components automatically each time a component is created by the user.
- *
- * @author Branislav Stojkovic
- */
-public interface IAutoCreator {
-
- /**
- * @param lastAdded the component created by the user
- * @return {@link List} of {@link IDIYComponent}s that will be automatically created as a result.
- * Empty {@link List} or {@code null} are valid responses for cases when no components
- * should be auto-created.
- */
- public List> createIfNeeded(IDIYComponent> lastAdded);
-}
+
+import org.diylc.core.IDIYComponent;
+
+/**
+ * Interface for creating components automatically each time a component is created by the user.
+ *
+ * @author Branislav Stojkovic
+ */
+public interface IAutoCreator {
+
+ /**
+ * @param lastAdded the component created by the user
+ * @return {@link List} of {@link IDIYComponent}s that will be automatically created as a result.
+ * Empty {@link List} or {@code null} are valid responses for cases when no components
+ * should be auto-created.
+ */
+ public List> createIfNeeded(IDIYComponent> lastAdded);
+}
diff --git a/diylc/diylc-core/src/org/diylc/core/annotations/KeywordPolicy.java b/diylc/diylc-core/src/main/java/org/diylc/core/annotations/KeywordPolicy.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/core/annotations/KeywordPolicy.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/annotations/KeywordPolicy.java
index 9b351204..933bafeb 100644
--- a/diylc/diylc-core/src/org/diylc/core/annotations/KeywordPolicy.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/annotations/KeywordPolicy.java
@@ -1,24 +1,24 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.core.annotations;
/**
diff --git a/diylc/diylc-core/src/org/diylc/core/annotations/MultiLineText.java b/diylc/diylc-core/src/main/java/org/diylc/core/annotations/MultiLineText.java
similarity index 99%
rename from diylc/diylc-core/src/org/diylc/core/annotations/MultiLineText.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/annotations/MultiLineText.java
index 020070b6..8079c919 100644
--- a/diylc/diylc-core/src/org/diylc/core/annotations/MultiLineText.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/annotations/MultiLineText.java
@@ -19,12 +19,12 @@
along with DIYLC. If not, see .
*/
-package org.diylc.core.annotations;
-
+package org.diylc.core.annotations;
+
import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-@Retention(RetentionPolicy.RUNTIME)
-public @interface MultiLineText {
-
-}
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface MultiLineText {
+
+}
diff --git a/diylc/diylc-core/src/org/diylc/core/annotations/PercentEditor.java b/diylc/diylc-core/src/main/java/org/diylc/core/annotations/PercentEditor.java
similarity index 99%
rename from diylc/diylc-core/src/org/diylc/core/annotations/PercentEditor.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/annotations/PercentEditor.java
index 2e92021b..506e1a8f 100644
--- a/diylc/diylc-core/src/org/diylc/core/annotations/PercentEditor.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/annotations/PercentEditor.java
@@ -19,13 +19,13 @@
along with DIYLC. If not, see .
*/
-package org.diylc.core.annotations;
-
+package org.diylc.core.annotations;
+
import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-@Retention(RetentionPolicy.RUNTIME)
-public @interface PercentEditor {
-
- public byte _100PercentValue();
-}
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface PercentEditor {
+
+ public byte _100PercentValue();
+}
diff --git a/diylc/diylc-core/src/org/diylc/core/annotations/PositiveMeasureValidator.java b/diylc/diylc-core/src/main/java/org/diylc/core/annotations/PositiveMeasureValidator.java
similarity index 98%
rename from diylc/diylc-core/src/org/diylc/core/annotations/PositiveMeasureValidator.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/annotations/PositiveMeasureValidator.java
index 3ec08d2c..087e9e2a 100644
--- a/diylc/diylc-core/src/org/diylc/core/annotations/PositiveMeasureValidator.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/annotations/PositiveMeasureValidator.java
@@ -19,35 +19,35 @@
along with DIYLC. If not, see .
*/
-package org.diylc.core.annotations;
-
+package org.diylc.core.annotations;
+
import org.diylc.core.IPropertyValidator;
import org.diylc.core.ValidationException;
-import org.diylc.core.measures.AbstractMeasure;
-
-/**
- * Validates any generic {@link AbstractMeasure} descendants and makes sure that the value is
- * positive.
- *
- * @author Branislav Stojkovic
- */
-public class PositiveMeasureValidator implements IPropertyValidator {
-
- @Override
- public void validate(Object owner, Object value) throws ValidationException {
- if (value == null)
- return;
- if (value instanceof AbstractMeasure) {
- AbstractMeasure> measure = (AbstractMeasure>) value;
- if (measure.getValue() < 0) {
- throw new ValidationException("must be greater or equal to zero.");
- }
+import org.diylc.core.measures.AbstractMeasure;
+
+/**
+ * Validates any generic {@link AbstractMeasure} descendants and makes sure that the value is
+ * positive.
+ *
+ * @author Branislav Stojkovic
+ */
+public class PositiveMeasureValidator implements IPropertyValidator {
+
+ @Override
+ public void validate(Object owner, Object value) throws ValidationException {
+ if (value == null)
+ return;
+ if (value instanceof AbstractMeasure) {
+ AbstractMeasure> measure = (AbstractMeasure>) value;
+ if (measure.getValue() < 0) {
+ throw new ValidationException("must be greater or equal to zero.");
+ }
} else if (value instanceof Integer) {
Integer i = (Integer) value;
if (i < 0)
throw new ValidationException("must be greater or equal to zero.");
- } else {
- throw new ValidationException("wrong data type.");
- }
- }
-}
+ } else {
+ throw new ValidationException("wrong data type.");
+ }
+ }
+}
diff --git a/diylc/diylc-core/src/org/diylc/core/annotations/PositiveNonZeroMeasureValidator.java b/diylc/diylc-core/src/main/java/org/diylc/core/annotations/PositiveNonZeroMeasureValidator.java
similarity index 98%
rename from diylc/diylc-core/src/org/diylc/core/annotations/PositiveNonZeroMeasureValidator.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/annotations/PositiveNonZeroMeasureValidator.java
index 68072061..16ad13fb 100644
--- a/diylc/diylc-core/src/org/diylc/core/annotations/PositiveNonZeroMeasureValidator.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/annotations/PositiveNonZeroMeasureValidator.java
@@ -19,35 +19,35 @@
along with DIYLC. If not, see .
*/
-package org.diylc.core.annotations;
-
+package org.diylc.core.annotations;
+
import org.diylc.core.IPropertyValidator;
import org.diylc.core.ValidationException;
-import org.diylc.core.measures.AbstractMeasure;
-
-/**
- * Validates any generic {@link AbstractMeasure} descendants and makes sure that the value is
- * positive.
- *
- * @author Branislav Stojkovic
- */
-public class PositiveNonZeroMeasureValidator implements IPropertyValidator {
-
- @Override
- public void validate(Object owner, Object value) throws ValidationException {
- if (value == null)
- return;
- if (value instanceof AbstractMeasure) {
- AbstractMeasure> measure = (AbstractMeasure>) value;
- if (measure.getValue() <= 0) {
- throw new ValidationException("must be greater than zero.");
- }
+import org.diylc.core.measures.AbstractMeasure;
+
+/**
+ * Validates any generic {@link AbstractMeasure} descendants and makes sure that the value is
+ * positive.
+ *
+ * @author Branislav Stojkovic
+ */
+public class PositiveNonZeroMeasureValidator implements IPropertyValidator {
+
+ @Override
+ public void validate(Object owner, Object value) throws ValidationException {
+ if (value == null)
+ return;
+ if (value instanceof AbstractMeasure) {
+ AbstractMeasure> measure = (AbstractMeasure>) value;
+ if (measure.getValue() <= 0) {
+ throw new ValidationException("must be greater than zero.");
+ }
} else if (value instanceof Integer) {
Integer i = (Integer) value;
if (i < 0)
throw new ValidationException("must be greater or equal to zero.");
- } else {
- throw new ValidationException("wrong data type.");
- }
- }
-}
+ } else {
+ throw new ValidationException("wrong data type.");
+ }
+ }
+}
diff --git a/diylc/diylc-core/src/org/diylc/core/gerber/GerberExporter.java b/diylc/diylc-core/src/main/java/org/diylc/core/gerber/GerberExporter.java
similarity index 99%
rename from diylc/diylc-core/src/org/diylc/core/gerber/GerberExporter.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/gerber/GerberExporter.java
index 1dfccda5..066254c7 100644
--- a/diylc/diylc-core/src/org/diylc/core/gerber/GerberExporter.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/gerber/GerberExporter.java
@@ -13,6 +13,9 @@ import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.log4j.Logger;
+
+import com.bancika.gerberwriter.DataLayer;
+
import org.diylc.core.ComponentState;
import org.diylc.core.IDIYComponent;
import org.diylc.core.IView;
@@ -20,7 +23,6 @@ import org.diylc.core.Project;
import org.diylc.core.measures.Size;
import org.diylc.core.measures.SizeUnit;
import org.diylc.lang.LangUtil;
-import com.bancika.gerberwriter.DataLayer;
public class GerberExporter {
diff --git a/diylc/diylc-core/src/org/diylc/core/gerber/GerberG2DWrapper.java b/diylc/diylc-core/src/main/java/org/diylc/core/gerber/GerberG2DWrapper.java
similarity index 99%
rename from diylc/diylc-core/src/org/diylc/core/gerber/GerberG2DWrapper.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/gerber/GerberG2DWrapper.java
index 37efd070..e541cb0a 100644
--- a/diylc/diylc-core/src/org/diylc/core/gerber/GerberG2DWrapper.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/gerber/GerberG2DWrapper.java
@@ -30,13 +30,15 @@ import java.awt.image.renderable.RenderableImage;
import java.text.AttributedCharacterIterator;
import java.util.HashMap;
import java.util.Map;
-import org.diylc.core.IDrawingObserver;
-import org.diylc.core.measures.SizeUnit;
-import org.diylc.utils.Constants;
+
import com.bancika.gerberwriter.DataLayer;
import com.bancika.gerberwriter.Point;
import com.bancika.gerberwriter.padmasters.Circle;
+import org.diylc.core.IDrawingObserver;
+import org.diylc.core.measures.SizeUnit;
+import org.diylc.utils.Constants;
+
public class GerberG2DWrapper extends Graphics2D
implements IDrawingObserver, IGerberDrawingObserver {
diff --git a/diylc/diylc-core/src/org/diylc/core/gerber/GerberLayer.java b/diylc/diylc-core/src/main/java/org/diylc/core/gerber/GerberLayer.java
similarity index 100%
rename from diylc/diylc-core/src/org/diylc/core/gerber/GerberLayer.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/gerber/GerberLayer.java
diff --git a/diylc/diylc-core/src/org/diylc/core/gerber/GerberPathRenderer.java b/diylc/diylc-core/src/main/java/org/diylc/core/gerber/GerberPathRenderer.java
similarity index 99%
rename from diylc/diylc-core/src/org/diylc/core/gerber/GerberPathRenderer.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/gerber/GerberPathRenderer.java
index 74d2d142..bc47380e 100644
--- a/diylc/diylc-core/src/org/diylc/core/gerber/GerberPathRenderer.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/gerber/GerberPathRenderer.java
@@ -19,15 +19,17 @@ import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import javax.imageio.ImageIO;
-import org.diylc.core.ComponentState;
-import org.diylc.core.IDIYComponent;
-import org.diylc.core.Project;
-import org.diylc.core.measures.SizeUnit;
+
import com.bancika.gerberwriter.DataLayer;
import com.bancika.gerberwriter.Point;
import com.bancika.gerberwriter.path.MoveTo;
import com.bancika.gerberwriter.path.Path;
+import org.diylc.core.ComponentState;
+import org.diylc.core.IDIYComponent;
+import org.diylc.core.Project;
+import org.diylc.core.measures.SizeUnit;
+
public class GerberPathRenderer {
public static void drawComponent(Project currentProject, GerberG2DWrapper g2d, IDIYComponent> c,
diff --git a/diylc/diylc-core/src/org/diylc/core/gerber/GerberRenderMode.java b/diylc/diylc-core/src/main/java/org/diylc/core/gerber/GerberRenderMode.java
similarity index 100%
rename from diylc/diylc-core/src/org/diylc/core/gerber/GerberRenderMode.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/gerber/GerberRenderMode.java
diff --git a/diylc/diylc-core/src/org/diylc/core/gerber/IGerberBoard.java b/diylc/diylc-core/src/main/java/org/diylc/core/gerber/IGerberBoard.java
similarity index 100%
rename from diylc/diylc-core/src/org/diylc/core/gerber/IGerberBoard.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/gerber/IGerberBoard.java
diff --git a/diylc/diylc-core/src/org/diylc/core/gerber/IGerberComponent.java b/diylc/diylc-core/src/main/java/org/diylc/core/gerber/IGerberComponent.java
similarity index 100%
rename from diylc/diylc-core/src/org/diylc/core/gerber/IGerberComponent.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/gerber/IGerberComponent.java
diff --git a/diylc/diylc-core/src/org/diylc/core/gerber/IGerberComponentCustom.java b/diylc/diylc-core/src/main/java/org/diylc/core/gerber/IGerberComponentCustom.java
similarity index 99%
rename from diylc/diylc-core/src/org/diylc/core/gerber/IGerberComponentCustom.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/gerber/IGerberComponentCustom.java
index f63efbc5..2416a8da 100644
--- a/diylc/diylc-core/src/org/diylc/core/gerber/IGerberComponentCustom.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/gerber/IGerberComponentCustom.java
@@ -3,6 +3,7 @@ package org.diylc.core.gerber;
import java.awt.Graphics2D;
import java.util.EnumSet;
import java.util.Set;
+
import org.diylc.core.ComponentState;
import org.diylc.core.IDrawingObserver;
import org.diylc.core.Project;
diff --git a/diylc/diylc-core/src/org/diylc/core/gerber/IGerberComponentSimple.java b/diylc/diylc-core/src/main/java/org/diylc/core/gerber/IGerberComponentSimple.java
similarity index 100%
rename from diylc/diylc-core/src/org/diylc/core/gerber/IGerberComponentSimple.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/gerber/IGerberComponentSimple.java
diff --git a/diylc/diylc-core/src/org/diylc/core/gerber/IGerberDrawingObserver.java b/diylc/diylc-core/src/main/java/org/diylc/core/gerber/IGerberDrawingObserver.java
similarity index 100%
rename from diylc/diylc-core/src/org/diylc/core/gerber/IGerberDrawingObserver.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/gerber/IGerberDrawingObserver.java
diff --git a/diylc/diylc-core/src/org/diylc/core/gerber/IGerberOutput.java b/diylc/diylc-core/src/main/java/org/diylc/core/gerber/IGerberOutput.java
similarity index 100%
rename from diylc/diylc-core/src/org/diylc/core/gerber/IGerberOutput.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/gerber/IGerberOutput.java
diff --git a/diylc/diylc-core/src/org/diylc/core/images/IconLoader.java b/diylc/diylc-core/src/main/java/org/diylc/core/images/IconLoader.java
similarity index 87%
rename from diylc/diylc-core/src/org/diylc/core/images/IconLoader.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/images/IconLoader.java
index a0aa6f76..6000c70f 100644
--- a/diylc/diylc-core/src/org/diylc/core/images/IconLoader.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/images/IconLoader.java
@@ -1,31 +1,33 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.core.images;
-import java.awt.Image;
-import java.awt.image.BufferedImage;
-import java.io.IOException;
-import javax.imageio.ImageIO;
-import javax.swing.Icon;
+import org.apache.log4j.Logger;
+
+import java.awt.Image;
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+import javax.imageio.ImageIO;
+import javax.swing.Icon;
import javax.swing.ImageIcon;
/**
@@ -57,11 +59,11 @@ public enum IconLoader {
}
public Icon getIcon() {
- java.net.URL imgURL = getClass().getResource(name);
+ java.net.URL imgURL = getClass().getResource("/diylc-core-images/" + name);
if (imgURL != null) {
return new ImageIcon(imgURL, name);
} else {
- System.err.println("Couldn't find file: " + name);
+ Logger.getLogger(IconLoader.class).error("Couldn't find file: " + name);
return null;
}
}
@@ -69,9 +71,9 @@ public enum IconLoader {
public Image getImage() {
BufferedImage img = null;
try {
- img = ImageIO.read(getClass().getResourceAsStream(name));
+ img = ImageIO.read(getClass().getResourceAsStream("/diylc-core-images/" + name));
} catch (IOException e) {
- System.err.println("Couldn't find file: " + name);
+ Logger.getLogger(IconLoader.class).error("Couldn't find file: " + name);
}
return img;
}
diff --git a/diylc/diylc-core/src/org/diylc/core/measures/AbstractMeasure.java b/diylc/diylc-core/src/main/java/org/diylc/core/measures/AbstractMeasure.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/core/measures/AbstractMeasure.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/measures/AbstractMeasure.java
index 2abd8352..6bf2a51a 100644
--- a/diylc/diylc-core/src/org/diylc/core/measures/AbstractMeasure.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/measures/AbstractMeasure.java
@@ -1,28 +1,28 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.core.measures;
-import java.io.Serializable;
-import java.text.DecimalFormat;
+import java.io.Serializable;
+import java.text.DecimalFormat;
import java.text.Format;
/***
diff --git a/diylc/diylc-core/src/org/diylc/core/measures/Capacitance.java b/diylc/diylc-core/src/main/java/org/diylc/core/measures/Capacitance.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/core/measures/Capacitance.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/measures/Capacitance.java
index 2ad74ac6..bb306582 100644
--- a/diylc/diylc-core/src/org/diylc/core/measures/Capacitance.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/measures/Capacitance.java
@@ -1,24 +1,24 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.core.measures;
public class Capacitance extends AbstractMeasure {
@@ -49,11 +49,11 @@ public class Capacitance extends AbstractMeasure {
}
}
throw new IllegalArgumentException("Could not parse capacitance: " + value);
- }
-
- public Double getNormalizedValue() {
- if (value == null || unit == null)
- return null;
- return value * unit.getFactor();
+ }
+
+ public Double getNormalizedValue() {
+ if (value == null || unit == null)
+ return null;
+ return value * unit.getFactor();
}
}
diff --git a/diylc/diylc-core/src/org/diylc/core/measures/CapacitanceUnit.java b/diylc/diylc-core/src/main/java/org/diylc/core/measures/CapacitanceUnit.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/core/measures/CapacitanceUnit.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/measures/CapacitanceUnit.java
index 18447d86..ad87e1f6 100644
--- a/diylc/diylc-core/src/org/diylc/core/measures/CapacitanceUnit.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/measures/CapacitanceUnit.java
@@ -1,24 +1,24 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.core.measures;
public enum CapacitanceUnit implements Unit {
diff --git a/diylc/diylc-core/src/org/diylc/core/measures/Current.java b/diylc/diylc-core/src/main/java/org/diylc/core/measures/Current.java
similarity index 98%
rename from diylc/diylc-core/src/org/diylc/core/measures/Current.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/measures/Current.java
index 3379a1ec..562c8b74 100644
--- a/diylc/diylc-core/src/org/diylc/core/measures/Current.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/measures/Current.java
@@ -19,19 +19,19 @@
along with DIYLC. If not, see .
*/
-package org.diylc.core.measures;
-
-public class Current extends AbstractMeasure {
-
- private static final long serialVersionUID = 1L;
-
- public Current(Double value, CurrentUnit unit) {
- super(value, unit);
- // TODO Auto-generated constructor stub
- }
-
- @Override
- public Current clone() throws CloneNotSupportedException {
- return new Current(value, unit);
- }
-}
+package org.diylc.core.measures;
+
+public class Current extends AbstractMeasure {
+
+ private static final long serialVersionUID = 1L;
+
+ public Current(Double value, CurrentUnit unit) {
+ super(value, unit);
+ // TODO Auto-generated constructor stub
+ }
+
+ @Override
+ public Current clone() throws CloneNotSupportedException {
+ return new Current(value, unit);
+ }
+}
diff --git a/diylc/diylc-core/src/org/diylc/core/measures/CurrentUnit.java b/diylc/diylc-core/src/main/java/org/diylc/core/measures/CurrentUnit.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/core/measures/CurrentUnit.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/measures/CurrentUnit.java
index e1e2fcde..272142c8 100644
--- a/diylc/diylc-core/src/org/diylc/core/measures/CurrentUnit.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/measures/CurrentUnit.java
@@ -1,24 +1,24 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.core.measures;
public enum CurrentUnit implements Unit {
diff --git a/diylc/diylc-core/src/org/diylc/core/measures/Frequency.java b/diylc/diylc-core/src/main/java/org/diylc/core/measures/Frequency.java
similarity index 98%
rename from diylc/diylc-core/src/org/diylc/core/measures/Frequency.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/measures/Frequency.java
index 564bc980..e047720b 100644
--- a/diylc/diylc-core/src/org/diylc/core/measures/Frequency.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/measures/Frequency.java
@@ -19,19 +19,19 @@
along with DIYLC. If not, see .
*/
-package org.diylc.core.measures;
-
-public class Frequency extends AbstractMeasure {
-
- private static final long serialVersionUID = 1L;
-
- public Frequency(Double value, FrequencyUnit unit) {
- super(value, unit);
- // TODO Auto-generated constructor stub
- }
-
- @Override
- public Frequency clone() throws CloneNotSupportedException {
- return new Frequency(value, unit);
- }
-}
+package org.diylc.core.measures;
+
+public class Frequency extends AbstractMeasure {
+
+ private static final long serialVersionUID = 1L;
+
+ public Frequency(Double value, FrequencyUnit unit) {
+ super(value, unit);
+ // TODO Auto-generated constructor stub
+ }
+
+ @Override
+ public Frequency clone() throws CloneNotSupportedException {
+ return new Frequency(value, unit);
+ }
+}
diff --git a/diylc/diylc-core/src/org/diylc/core/measures/FrequencyUnit.java b/diylc/diylc-core/src/main/java/org/diylc/core/measures/FrequencyUnit.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/core/measures/FrequencyUnit.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/measures/FrequencyUnit.java
index 4776502a..72a7d0f9 100644
--- a/diylc/diylc-core/src/org/diylc/core/measures/FrequencyUnit.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/measures/FrequencyUnit.java
@@ -1,24 +1,24 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.core.measures;
public enum FrequencyUnit implements Unit {
diff --git a/diylc/diylc-core/src/org/diylc/core/measures/Inductance.java b/diylc/diylc-core/src/main/java/org/diylc/core/measures/Inductance.java
similarity index 97%
rename from diylc/diylc-core/src/org/diylc/core/measures/Inductance.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/measures/Inductance.java
index 12762571..62cf83c5 100644
--- a/diylc/diylc-core/src/org/diylc/core/measures/Inductance.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/measures/Inductance.java
@@ -1,24 +1,24 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.core.measures;
public class Inductance extends AbstractMeasure {
diff --git a/diylc/diylc-core/src/org/diylc/core/measures/InductanceUnit.java b/diylc/diylc-core/src/main/java/org/diylc/core/measures/InductanceUnit.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/core/measures/InductanceUnit.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/measures/InductanceUnit.java
index e3f289a2..7191dd6b 100644
--- a/diylc/diylc-core/src/org/diylc/core/measures/InductanceUnit.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/measures/InductanceUnit.java
@@ -1,24 +1,24 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.core.measures;
public enum InductanceUnit implements Unit {
diff --git a/diylc/diylc-core/src/org/diylc/core/measures/MeasureList.java b/diylc/diylc-core/src/main/java/org/diylc/core/measures/MeasureList.java
similarity index 98%
rename from diylc/diylc-core/src/org/diylc/core/measures/MeasureList.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/measures/MeasureList.java
index 20a8a53a..9e27e776 100644
--- a/diylc/diylc-core/src/org/diylc/core/measures/MeasureList.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/measures/MeasureList.java
@@ -19,21 +19,21 @@
along with DIYLC. If not, see .
*/
-package org.diylc.core.measures;
-
-import java.util.ArrayList;
-
-public class MeasureList> extends ArrayList> {
-
- private static final long serialVersionUID = 1L;
-
- private String name;
-
- public MeasureList(String name) {
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-}
+package org.diylc.core.measures;
+
+import java.util.ArrayList;
+
+public class MeasureList> extends ArrayList> {
+
+ private static final long serialVersionUID = 1L;
+
+ private String name;
+
+ public MeasureList(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+}
diff --git a/diylc/diylc-core/src/org/diylc/core/measures/Nudge.java b/diylc/diylc-core/src/main/java/org/diylc/core/measures/Nudge.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/core/measures/Nudge.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/measures/Nudge.java
index 9863f2bc..3946daa1 100644
--- a/diylc/diylc-core/src/org/diylc/core/measures/Nudge.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/measures/Nudge.java
@@ -1,24 +1,24 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.core.measures;
import org.diylc.core.annotations.EditableProperty;
diff --git a/diylc/diylc-core/src/org/diylc/core/measures/Power.java b/diylc/diylc-core/src/main/java/org/diylc/core/measures/Power.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/core/measures/Power.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/measures/Power.java
index 17e8ba27..308910b5 100644
--- a/diylc/diylc-core/src/org/diylc/core/measures/Power.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/measures/Power.java
@@ -1,24 +1,24 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.core.measures;
public class Power extends AbstractMeasure {
diff --git a/diylc/diylc-core/src/org/diylc/core/measures/PowerUnit.java b/diylc/diylc-core/src/main/java/org/diylc/core/measures/PowerUnit.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/core/measures/PowerUnit.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/measures/PowerUnit.java
index 00de0562..b373a304 100644
--- a/diylc/diylc-core/src/org/diylc/core/measures/PowerUnit.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/measures/PowerUnit.java
@@ -1,24 +1,24 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.core.measures;
public enum PowerUnit implements Unit {
diff --git a/diylc/diylc-core/src/org/diylc/core/measures/Resistance.java b/diylc/diylc-core/src/main/java/org/diylc/core/measures/Resistance.java
similarity index 97%
rename from diylc/diylc-core/src/org/diylc/core/measures/Resistance.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/measures/Resistance.java
index 0628e423..d98c7568 100644
--- a/diylc/diylc-core/src/org/diylc/core/measures/Resistance.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/measures/Resistance.java
@@ -1,27 +1,28 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.core.measures;
-import java.awt.Color;
+import java.awt.Color;
+
import org.diylc.common.ResistorColorCode;
public class Resistance extends AbstractMeasure {
diff --git a/diylc/diylc-core/src/org/diylc/core/measures/ResistanceUnit.java b/diylc/diylc-core/src/main/java/org/diylc/core/measures/ResistanceUnit.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/core/measures/ResistanceUnit.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/measures/ResistanceUnit.java
index 4484a1d5..471788a1 100644
--- a/diylc/diylc-core/src/org/diylc/core/measures/ResistanceUnit.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/measures/ResistanceUnit.java
@@ -1,24 +1,24 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.core.measures;
public enum ResistanceUnit implements Unit {
@@ -35,7 +35,7 @@ public enum ResistanceUnit implements Unit {
@Override
public double getFactor() {
- return factor;
+ return factor;
}
diff --git a/diylc/diylc-core/src/org/diylc/core/measures/Size.java b/diylc/diylc-core/src/main/java/org/diylc/core/measures/Size.java
similarity index 97%
rename from diylc/diylc-core/src/org/diylc/core/measures/Size.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/measures/Size.java
index 352623ed..c9e00c9b 100644
--- a/diylc/diylc-core/src/org/diylc/core/measures/Size.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/measures/Size.java
@@ -1,24 +1,24 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.core.measures;
import org.diylc.utils.Constants;
@@ -44,13 +44,13 @@ public class Size extends AbstractMeasure implements Comparable
// return (int) Math.round(Constants.PIXELS_PER_INCH / Constants.GRIDS_PER_INCH
// * (grids + remainder));
return getValue() * getUnit().getFactor() / SizeUnit.in.getFactor() * Constants.PIXELS_PER_INCH;
- }
-
- public double convertToUnits(SizeUnit unit) {
- if (unit == getUnit()) {
- return this.getValue();
- }
- return convertToPixels() * SizeUnit.px.getFactor();
+ }
+
+ public double convertToUnits(SizeUnit unit) {
+ if (unit == getUnit()) {
+ return this.getValue();
+ }
+ return convertToPixels() * SizeUnit.px.getFactor();
}
@Override
@@ -67,14 +67,14 @@ public class Size extends AbstractMeasure implements Comparable
}
}
throw new IllegalArgumentException("Could not parse size: " + value);
- }
-
- public static Size fromPixels(double pixels, SizeUnit unit) {
- return new Size(pixels / unit.getFactor() * SizeUnit.in.getFactor() / Constants.PIXELS_PER_INCH, unit);
- }
-
- public Size scale(double factor) {
- return new Size(value * factor, unit);
+ }
+
+ public static Size fromPixels(double pixels, SizeUnit unit) {
+ return new Size(pixels / unit.getFactor() * SizeUnit.in.getFactor() / Constants.PIXELS_PER_INCH, unit);
+ }
+
+ public Size scale(double factor) {
+ return new Size(value * factor, unit);
}
@Override
diff --git a/diylc/diylc-core/src/org/diylc/core/measures/SizeUnit.java b/diylc/diylc-core/src/main/java/org/diylc/core/measures/SizeUnit.java
similarity index 98%
rename from diylc/diylc-core/src/org/diylc/core/measures/SizeUnit.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/measures/SizeUnit.java
index 4f8084ba..c5cab803 100644
--- a/diylc/diylc-core/src/org/diylc/core/measures/SizeUnit.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/measures/SizeUnit.java
@@ -19,22 +19,22 @@
along with DIYLC. If not, see .
*/
-package org.diylc.core.measures;
+package org.diylc.core.measures;
import org.diylc.utils.Constants;
-
-public enum SizeUnit implements Unit {
-
- px(25.4d / Constants.PIXELS_PER_INCH), mm(1d), cm(10d), m(1e3d), in(25.4d), ft(25.4d * 12), yd(9144d);
-
- double factor;
-
- private SizeUnit(double factor) {
- this.factor = factor;
- }
-
- @Override
- public double getFactor() {
- return factor;
- }
-}
+
+public enum SizeUnit implements Unit {
+
+ px(25.4d / Constants.PIXELS_PER_INCH), mm(1d), cm(10d), m(1e3d), in(25.4d), ft(25.4d * 12), yd(9144d);
+
+ double factor;
+
+ private SizeUnit(double factor) {
+ this.factor = factor;
+ }
+
+ @Override
+ public double getFactor() {
+ return factor;
+ }
+}
diff --git a/diylc/diylc-core/src/org/diylc/core/measures/Unit.java b/diylc/diylc-core/src/main/java/org/diylc/core/measures/Unit.java
similarity index 99%
rename from diylc/diylc-core/src/org/diylc/core/measures/Unit.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/measures/Unit.java
index b0fe8d18..22841ac0 100644
--- a/diylc/diylc-core/src/org/diylc/core/measures/Unit.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/measures/Unit.java
@@ -19,9 +19,9 @@
along with DIYLC. If not, see .
*/
-package org.diylc.core.measures;
-
-public interface Unit {
-
- double getFactor();
-}
+package org.diylc.core.measures;
+
+public interface Unit {
+
+ double getFactor();
+}
diff --git a/diylc/diylc-core/src/org/diylc/core/measures/Voltage.java b/diylc/diylc-core/src/main/java/org/diylc/core/measures/Voltage.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/core/measures/Voltage.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/measures/Voltage.java
index c9ec9889..a4e25de9 100644
--- a/diylc/diylc-core/src/org/diylc/core/measures/Voltage.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/measures/Voltage.java
@@ -1,24 +1,24 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.core.measures;
public class Voltage extends AbstractMeasure {
@@ -49,11 +49,11 @@ public class Voltage extends AbstractMeasure {
}
}
throw new IllegalArgumentException("Could not parse voltage: " + value);
- }
-
- public Double getNormalizedValue() {
- if (value == null || unit == null)
- return null;
- return value * unit.getFactor();
+ }
+
+ public Double getNormalizedValue() {
+ if (value == null || unit == null)
+ return null;
+ return value * unit.getFactor();
}
}
diff --git a/diylc/diylc-core/src/org/diylc/core/measures/VoltageUnit.java b/diylc/diylc-core/src/main/java/org/diylc/core/measures/VoltageUnit.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/core/measures/VoltageUnit.java
rename to diylc/diylc-core/src/main/java/org/diylc/core/measures/VoltageUnit.java
index 854a733a..6eb0caaa 100644
--- a/diylc/diylc-core/src/org/diylc/core/measures/VoltageUnit.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/core/measures/VoltageUnit.java
@@ -1,24 +1,24 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.core.measures;
public enum VoltageUnit implements Unit {
diff --git a/diylc/diylc-core/src/org/diylc/lang/LangUtil.java b/diylc/diylc-core/src/main/java/org/diylc/lang/LangUtil.java
similarity index 79%
rename from diylc/diylc-core/src/org/diylc/lang/LangUtil.java
rename to diylc/diylc-core/src/main/java/org/diylc/lang/LangUtil.java
index b996e72d..55b3824e 100644
--- a/diylc/diylc-core/src/org/diylc/lang/LangUtil.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/lang/LangUtil.java
@@ -17,12 +17,12 @@
*/
package org.diylc.lang;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.PrintWriter;
+import java.io.*;
+import java.net.URISyntaxException;
+import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
+import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collections;
@@ -32,8 +32,9 @@ import java.util.Map;
import java.util.stream.Stream;
import org.apache.log4j.Logger;
import org.diylc.appframework.miscutils.ConfigurationManager;
+
import org.diylc.common.IPlugInPort;
-import org.diylc.utils.ResourceLoader;
+import org.diylc.utils.ResourceUtils;
public class LangUtil {
@@ -88,21 +89,17 @@ public class LangUtil {
LOG.info("Loading translation for " + language);
dict = new HashMap();
try {
- String path = ResourceLoader.getFile(LANG_DIR + File.separator + language + ".txt").getAbsolutePath();
- LOG.debug("Loading language file: " + path);
- try (Stream stream = Files.lines(
- Paths.get(path), StandardCharsets.UTF_8)) {
- stream.forEach(s -> {
- if (s.contains("|")) {
- String[] parts = s.split("\\|");
- if (parts.length == 2)
- dict.put(parts[0].toLowerCase().trim(), parts[1].trim());
- } else {
- dict.put(s.toLowerCase(), s);
- }
- });
- } catch (IOException e) {
- LOG.error("Error loading language file", e);
+ BufferedReader reader = new BufferedReader(new InputStreamReader(
+ (LangUtil.class.getResourceAsStream("/" + LANG_DIR + File.separator + language + ".txt"))));
+ while(reader.ready()) {
+ String s = reader.readLine();
+ if (s.contains("|")) {
+ String[] parts = s.split("\\|");
+ if (parts.length == 2)
+ dict.put(parts[0].toLowerCase().trim(), parts[1].trim());
+ } else {
+ dict.put(s.toLowerCase(), s);
+ }
}
} catch (Exception e) {
LOG.error("Error loading language file", e);
@@ -127,9 +124,8 @@ public class LangUtil {
public static List getAvailableLanguages() {
List res = new ArrayList();
- File[] files = ResourceLoader.getFiles(LANG_DIR);
- if (files == null)
- return res;
+
+ List files = ResourceUtils.getResourceFiles(LANG_DIR);
try {
for (File file : files) {
String key = file.getName().replaceFirst("[.][^.]+$", "");
diff --git a/diylc/diylc-core/src/org/diylc/lang/Language.java b/diylc/diylc-core/src/main/java/org/diylc/lang/Language.java
similarity index 100%
rename from diylc/diylc-core/src/org/diylc/lang/Language.java
rename to diylc/diylc-core/src/main/java/org/diylc/lang/Language.java
diff --git a/diylc/diylc-core/src/org/diylc/netlist/AbstractNetlistParser.java b/diylc/diylc-core/src/main/java/org/diylc/netlist/AbstractNetlistParser.java
similarity index 97%
rename from diylc/diylc-core/src/org/diylc/netlist/AbstractNetlistParser.java
rename to diylc/diylc-core/src/main/java/org/diylc/netlist/AbstractNetlistParser.java
index f4d6d6b6..4c58c388 100644
--- a/diylc/diylc-core/src/org/diylc/netlist/AbstractNetlistParser.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/netlist/AbstractNetlistParser.java
@@ -33,6 +33,7 @@ import java.util.Map;
import java.util.Optional;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+
import org.diylc.core.IDIYComponent;
import org.diylc.core.measures.Size;
import org.diylc.core.measures.SizeUnit;
diff --git a/diylc/diylc-core/src/org/diylc/netlist/AreaSimplifier.java b/diylc/diylc-core/src/main/java/org/diylc/netlist/AreaSimplifier.java
similarity index 100%
rename from diylc/diylc-core/src/org/diylc/netlist/AreaSimplifier.java
rename to diylc/diylc-core/src/main/java/org/diylc/netlist/AreaSimplifier.java
diff --git a/diylc/diylc-core/src/org/diylc/netlist/ContinuityGraph.java b/diylc/diylc-core/src/main/java/org/diylc/netlist/ContinuityGraph.java
similarity index 99%
rename from diylc/diylc-core/src/org/diylc/netlist/ContinuityGraph.java
rename to diylc/diylc-core/src/main/java/org/diylc/netlist/ContinuityGraph.java
index 3d583279..5f7a0613 100644
--- a/diylc/diylc-core/src/org/diylc/netlist/ContinuityGraph.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/netlist/ContinuityGraph.java
@@ -24,6 +24,7 @@ import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
+
import org.diylc.presenter.ContinuityArea;
import org.diylc.utils.RTree;
diff --git a/diylc/diylc-core/src/org/diylc/netlist/Group.java b/diylc/diylc-core/src/main/java/org/diylc/netlist/Group.java
similarity index 95%
rename from diylc/diylc-core/src/org/diylc/netlist/Group.java
rename to diylc/diylc-core/src/main/java/org/diylc/netlist/Group.java
index ed3423d6..88e4afd8 100644
--- a/diylc/diylc-core/src/org/diylc/netlist/Group.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/netlist/Group.java
@@ -27,6 +27,7 @@ import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+
import org.diylc.core.IDIYComponent;
/**
diff --git a/diylc/diylc-core/src/org/diylc/netlist/INetlistParser.java b/diylc/diylc-core/src/main/java/org/diylc/netlist/INetlistParser.java
similarity index 97%
rename from diylc/diylc-core/src/org/diylc/netlist/INetlistParser.java
rename to diylc/diylc-core/src/main/java/org/diylc/netlist/INetlistParser.java
index c1fc01a0..df655bdc 100644
--- a/diylc/diylc-core/src/org/diylc/netlist/INetlistParser.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/netlist/INetlistParser.java
@@ -20,6 +20,7 @@ package org.diylc.netlist;
import java.util.List;
import java.util.Map;
+
import org.diylc.core.IDIYComponent;
/*
diff --git a/diylc/diylc-core/src/org/diylc/netlist/ITree.java b/diylc/diylc-core/src/main/java/org/diylc/netlist/ITree.java
similarity index 100%
rename from diylc/diylc-core/src/org/diylc/netlist/ITree.java
rename to diylc/diylc-core/src/main/java/org/diylc/netlist/ITree.java
diff --git a/diylc/diylc-core/src/org/diylc/netlist/Netlist.java b/diylc/diylc-core/src/main/java/org/diylc/netlist/Netlist.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/netlist/Netlist.java
rename to diylc/diylc-core/src/main/java/org/diylc/netlist/Netlist.java
index 76c3fd6b..8c269ccf 100644
--- a/diylc/diylc-core/src/org/diylc/netlist/Netlist.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/netlist/Netlist.java
@@ -23,6 +23,7 @@ import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+
import org.diylc.core.IDIYComponent;
public class Netlist implements Comparable {
diff --git a/diylc/diylc-core/src/main/java/org/diylc/netlist/NetlistAnalyzer.java b/diylc/diylc-core/src/main/java/org/diylc/netlist/NetlistAnalyzer.java
new file mode 100644
index 00000000..64fd22f3
--- /dev/null
+++ b/diylc/diylc-core/src/main/java/org/diylc/netlist/NetlistAnalyzer.java
@@ -0,0 +1,281 @@
+/*
+ *
+ * DIY Layout Creator (DIYLC). Copyright (c) 2009-2018 held jointly by the individual authors.
+ *
+ * This file is part of DIYLC.
+ *
+ * DIYLC is free software: you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License as published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * DIYLC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+ * Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with DIYLC. If not, see
+ * .
+ */
+package org.diylc.netlist;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.diylc.core.IDIYComponent;
+
+public abstract class NetlistAnalyzer {
+
+ public NetlistAnalyzer() {
+ }
+
+ public List summarize(List netlists, Node preferredOutput)
+ throws TreeException {
+ Map summaries = new HashMap();
+ for (Netlist n : netlists) {
+ Summary s = summarize(n, preferredOutput);
+ if (summaries.containsKey(s.getSummary()))
+ summaries.get(s.getSummary()).append(n);
+ else
+ summaries.put(s.getSummary(), s);
+ }
+
+ List res = new ArrayList(summaries.values());
+ Collections.sort(res);
+ return res;
+ }
+
+ protected abstract Summary summarize(Netlist netlist, Node preferredOutput) throws TreeException;
+
+ public Tree constructTreeBetween(Netlist netlist, Node nodeA, Node nodeB) {
+ Tree tree = new Tree(TreeConnectionType.Parallel);
+ connectNodes(netlist, nodeA, nodeB, tree.getChildren(), new Tree(TreeConnectionType.Series),
+ new HashSet());
+
+ return tree;
+ }
+
+ protected void connectNodes(Netlist netlist, Node nodeA, Node nodeB, List concurrentPaths,
+ Tree currentPath, Set visited) {
+ if (nodeA == nodeB) {
+ concurrentPaths.add(currentPath);
+ return;
+ }
+
+ Group groupA = findGroup(netlist, nodeA);
+ if (groupA == null)
+ return;
+
+ if (groupA.getNodes().contains(nodeB)) {
+ concurrentPaths.add(currentPath);
+ return;
+ }
+
+ Set pathVisited = new HashSet<>(visited);
+ pathVisited.add(nodeA);
+
+ // First collect all immediate next nodes and their paths
+ Map> nextNodes = new HashMap<>();
+ for (Node n : groupA.getNodes()) {
+ if (pathVisited.contains(n))
+ continue;
+
+ IDIYComponent> c = n.getComponent();
+ for (int i = 0; i < c.getControlPointCount(); i++) {
+ int targetPoint = i;
+ int sourcePoint = n.getPointIndex();
+
+ if (targetPoint == sourcePoint)
+ continue;
+
+ if (c.getInternalLinkName(targetPoint, sourcePoint) != null) {
+ Node newNodeA = new Node(c, targetPoint, n.getZIndex());
+ if (pathVisited.contains(newNodeA))
+ continue;
+
+ try {
+ Tree newPath = (Tree) currentPath.clone();
+ TreeLeaf leaf = new TreeLeaf(c, targetPoint, sourcePoint);
+ Tree newItem = new Tree(leaf);
+
+ if (!newPath.getChildren().contains(newItem)) {
+ newPath.getChildren().add(newItem);
+ nextNodes.computeIfAbsent(newNodeA, k -> new ArrayList<>()).add(newPath);
+ }
+ } catch (CloneNotSupportedException e) {
+ // Skip this path if clone fails
+ }
+ }
+ }
+ }
+
+ // Now explore each next node
+ List allPaths = new ArrayList<>();
+ for (Map.Entry> entry : nextNodes.entrySet()) {
+ for (Tree path : entry.getValue()) {
+ List branchPaths = new ArrayList<>();
+ connectNodes(netlist, entry.getKey(), nodeB, branchPaths, path, pathVisited);
+ allPaths.addAll(branchPaths);
+ }
+ }
+
+ if (allPaths.isEmpty())
+ return;
+
+ if (allPaths.size() > 1) {
+ // Find common prefix among all paths
+ List commonPrefix = findCommonElements(allPaths, true, false);
+
+ // Create a new tree for the merged result
+ Tree mergedTree = new Tree(TreeConnectionType.Series);
+
+ // Add common prefix elements
+ for (Tree prefixElement : commonPrefix) {
+ mergedTree.getChildren().add(prefixElement);
+ }
+
+ // Extract unique parts
+ List uniqueParts = new ArrayList<>();
+ for (Tree path : allPaths) {
+ Tree uniquePart = extractUniquePart(path, commonPrefix.size(), 0);
+ if (uniquePart != null) {
+ if (uniquePart.getChildren().size() == 1) {
+ uniqueParts.add(uniquePart.getChildren().get(0));
+ } else {
+ uniqueParts.add(uniquePart);
+ }
+ }
+ }
+
+ // Create parallel section for unique parts
+ if (!uniqueParts.isEmpty()) {
+ Tree parallelSection = new Tree(TreeConnectionType.Parallel);
+ parallelSection.getChildren().addAll(uniqueParts);
+
+ // Add parallel section to series container
+ Tree parallelContainer = new Tree(TreeConnectionType.Series);
+ parallelContainer.getChildren().add(parallelSection);
+ mergedTree.getChildren().add(parallelContainer);
+ }
+
+ concurrentPaths.add(mergedTree);
+ } else {
+ concurrentPaths.add(allPaths.get(0));
+ }
+ }
+
+ private List findCommonElements(List paths, boolean fromStart, boolean backward) {
+ if (paths.isEmpty())
+ return new ArrayList<>();
+
+ List common = new ArrayList<>();
+ Tree template = paths.get(0);
+ int maxLength = template.getChildren().size();
+
+ for (int i = 0; i < maxLength; i++) {
+ int index = fromStart ?
+ (backward ? template.getChildren().size() - i - 1 : i) :
+ (backward ? i : template.getChildren().size() - i - 1);
+
+ if (index < 0 || index >= template.getChildren().size())
+ break;
+
+ Tree element = template.getChildren().get(index);
+ boolean isCommon = true;
+
+ for (int j = 1; j < paths.size(); j++) {
+ Tree current = paths.get(j);
+ if (current.getChildren().size() <= i || index >= current.getChildren()
+ .size() || !current.getChildren().get(index).equals(element)) {
+ isCommon = false;
+ break;
+ }
+ }
+
+ if (isCommon) {
+ common.add(element);
+ } else {
+ break;
+ }
+ }
+
+ return common;
+ }
+
+ private Tree extractUniquePart(Tree path, int prefixSize, int suffixSize) {
+ if (path.getChildren().size() <= prefixSize + suffixSize)
+ return null;
+
+ Tree uniquePart = new Tree(TreeConnectionType.Series);
+ for (int i = prefixSize; i < path.getChildren().size() - suffixSize; i++) {
+ uniquePart.getChildren().add(path.getChildren().get(i));
+ }
+
+ return uniquePart.getChildren().isEmpty() ? null : uniquePart;
+ }
+
+ protected Group findGroup(Netlist netlist, Node node) {
+ for (Group g : netlist.getGroups())
+ if (g.getNodes().contains(node))
+ return g;
+ return null;
+ }
+
+ protected List find(Set typeNames, String nodeName, Netlist netlist) {
+ List res = new ArrayList();
+ for (Group g : netlist.getGroups()) {
+ for (Node n : g.getNodes()) {
+ if (typeNames.contains(n.getComponent().getClass()
+ .getCanonicalName()) && (nodeName == null || n.getDisplayName()
+ .equalsIgnoreCase(nodeName))) {
+ res.add(n);
+ }
+ }
+ }
+ return res;
+ }
+
+ public static List>> extractComponentGroups(List netlists) {
+ List>> res = new ArrayList>>();
+ for (Netlist n : netlists) {
+ res.addAll(extractComponentGroups(n));
+ }
+ return res;
+ }
+
+ public static List>> extractComponentGroups(Netlist netlist) {
+ List>> res = new ArrayList>>();
+ for (Group g : netlist.getGroups()) {
+ Set> components = new HashSet>();
+ for (Node n : g.getNodes())
+ components.add(n.getComponent());
+ res.add(components);
+ }
+ return res;
+ }
+
+ protected int find(Node node, List groups) {
+ for (int i = 0; i < groups.size(); i++)
+ if (groups.get(i).getNodes().contains(node))
+ return i;
+ return -1;
+ }
+
+ protected boolean intersect(List groups, Node node) {
+ for (Group g : groups)
+ if (g.getNodes().contains(node))
+ return true;
+ return false;
+ }
+
+ protected Node intersect(List groups, Group group) {
+ for (Group g : groups)
+ for (Node node : group.getNodes())
+ if (g.getNodes().contains(node))
+ return node;
+ return null;
+ }
+}
diff --git a/diylc/diylc-core/src/org/diylc/netlist/NetlistBuilder.java b/diylc/diylc-core/src/main/java/org/diylc/netlist/NetlistBuilder.java
similarity index 99%
rename from diylc/diylc-core/src/org/diylc/netlist/NetlistBuilder.java
rename to diylc/diylc-core/src/main/java/org/diylc/netlist/NetlistBuilder.java
index 9762c12c..5178513a 100644
--- a/diylc/diylc-core/src/org/diylc/netlist/NetlistBuilder.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/netlist/NetlistBuilder.java
@@ -30,6 +30,11 @@ import java.util.Set;
import java.util.TreeSet;
import java.util.stream.Collectors;
import org.apache.log4j.Logger;
+
+import com.google.common.graph.GraphBuilder;
+import com.google.common.graph.ImmutableGraph;
+import com.google.common.graph.ImmutableGraph.Builder;
+
import org.diylc.common.ComponentType;
import org.diylc.core.ICommonNode;
import org.diylc.core.IContinuity;
@@ -42,9 +47,7 @@ import org.diylc.presenter.ComponentProcessor;
import org.diylc.presenter.Connection;
import org.diylc.presenter.ContinuityArea;
import org.diylc.utils.RTree;
-import com.google.common.graph.GraphBuilder;
-import com.google.common.graph.ImmutableGraph;
-import com.google.common.graph.ImmutableGraph.Builder;
+
import com.google.common.graph.Traverser;
public class NetlistBuilder {
diff --git a/diylc/diylc-core/src/org/diylc/netlist/NetlistException.java b/diylc/diylc-core/src/main/java/org/diylc/netlist/NetlistException.java
similarity index 100%
rename from diylc/diylc-core/src/org/diylc/netlist/NetlistException.java
rename to diylc/diylc-core/src/main/java/org/diylc/netlist/NetlistException.java
diff --git a/diylc/diylc-core/src/org/diylc/netlist/NetlistParseException.java b/diylc/diylc-core/src/main/java/org/diylc/netlist/NetlistParseException.java
similarity index 100%
rename from diylc/diylc-core/src/org/diylc/netlist/NetlistParseException.java
rename to diylc/diylc-core/src/main/java/org/diylc/netlist/NetlistParseException.java
diff --git a/diylc/diylc-core/src/org/diylc/netlist/Node.java b/diylc/diylc-core/src/main/java/org/diylc/netlist/Node.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/netlist/Node.java
rename to diylc/diylc-core/src/main/java/org/diylc/netlist/Node.java
index 238d24ec..bd4b24a0 100644
--- a/diylc/diylc-core/src/org/diylc/netlist/Node.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/netlist/Node.java
@@ -22,6 +22,7 @@
package org.diylc.netlist;
import java.awt.geom.Point2D;
+
import org.diylc.core.ICommonNode;
import org.diylc.core.IDIYComponent;
diff --git a/diylc/diylc-core/src/org/diylc/netlist/ParsedNetlistComponent.java b/diylc/diylc-core/src/main/java/org/diylc/netlist/ParsedNetlistComponent.java
similarity index 100%
rename from diylc/diylc-core/src/org/diylc/netlist/ParsedNetlistComponent.java
rename to diylc/diylc-core/src/main/java/org/diylc/netlist/ParsedNetlistComponent.java
diff --git a/diylc/diylc-core/src/org/diylc/netlist/ParsedNetlistEntry.java b/diylc/diylc-core/src/main/java/org/diylc/netlist/ParsedNetlistEntry.java
similarity index 100%
rename from diylc/diylc-core/src/org/diylc/netlist/ParsedNetlistEntry.java
rename to diylc/diylc-core/src/main/java/org/diylc/netlist/ParsedNetlistEntry.java
diff --git a/diylc/diylc-core/src/org/diylc/netlist/Position.java b/diylc/diylc-core/src/main/java/org/diylc/netlist/Position.java
similarity index 100%
rename from diylc/diylc-core/src/org/diylc/netlist/Position.java
rename to diylc/diylc-core/src/main/java/org/diylc/netlist/Position.java
diff --git a/diylc/diylc-core/src/org/diylc/netlist/Summary.java b/diylc/diylc-core/src/main/java/org/diylc/netlist/Summary.java
similarity index 100%
rename from diylc/diylc-core/src/org/diylc/netlist/Summary.java
rename to diylc/diylc-core/src/main/java/org/diylc/netlist/Summary.java
diff --git a/diylc/diylc-core/src/org/diylc/netlist/SwitchSetup.java b/diylc/diylc-core/src/main/java/org/diylc/netlist/SwitchSetup.java
similarity index 100%
rename from diylc/diylc-core/src/org/diylc/netlist/SwitchSetup.java
rename to diylc/diylc-core/src/main/java/org/diylc/netlist/SwitchSetup.java
diff --git a/diylc/diylc-core/src/org/diylc/netlist/Tree.java b/diylc/diylc-core/src/main/java/org/diylc/netlist/Tree.java
similarity index 86%
rename from diylc/diylc-core/src/org/diylc/netlist/Tree.java
rename to diylc/diylc-core/src/main/java/org/diylc/netlist/Tree.java
index f9ee373a..71cebbd5 100644
--- a/diylc/diylc-core/src/org/diylc/netlist/Tree.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/netlist/Tree.java
@@ -1,332 +1,343 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
-package org.diylc.netlist;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-import org.diylc.core.IDIYComponent;
-
-public class Tree {
-
- private List children;
- private TreeConnectionType connectionType;
- private TreeLeaf leaf;
-
- public Tree(TreeConnectionType connectionType) {
- this.children = new ArrayList();
- this.connectionType = connectionType;
- }
-
- public Tree(TreeLeaf leaf) {
- this.leaf = leaf;
- }
-
- public Tree(List children, TreeConnectionType connectionType) {
- this.children = children;
- this.connectionType = connectionType;
- }
-
- public List getChildren() {
- return children;
- }
-
- public void trimChildrenLeft(int count) {
- children = children.subList(count, children.size());
- }
-
- public void trimChildrenRight(int count) {
- children = children.subList(0, children.size() - count);
- }
-
- public TreeConnectionType getConnectionType() {
- return connectionType;
- }
-
- public TreeLeaf getLeaf() {
- return leaf;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((children == null) ? 0 : children.hashCode());
- result = prime * result + ((connectionType == null) ? 0 : connectionType.hashCode());
- result = prime * result + ((leaf == null) ? 0 : leaf.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- Tree other = (Tree) obj;
- if (children == null) {
- if (other.children != null)
- return false;
- } else if (!children.equals(other.children))
- return false;
- if (connectionType != other.connectionType)
- return false;
- if (leaf == null) {
- if (other.leaf != null)
- return false;
- } else if (!leaf.equals(other.leaf))
- return false;
- return true;
- }
-
- private List getOrderedChildren() {
- if (getConnectionType() == TreeConnectionType.Series)
- return children;
- List ordered = new ArrayList(children);
- Collections.sort(ordered, new Comparator() {
-
- @Override
- public int compare(Tree o1, Tree o2) {
- return o1.toString().compareToIgnoreCase(o2.toString());
- }});
- return ordered;
- }
-
- @Override
- public String toString() {
- if (leaf != null)
- return leaf.toString();
-
- StringBuilder sb = new StringBuilder("(");
- boolean first = true;
- for(Tree child : getOrderedChildren()) {
- if (!first)
- sb.append(" " ).append(connectionType).append(" ");
- first = false;
- sb.append(child);
- }
- sb.append(")");
- return sb.toString();
- }
-
- public String toHTML(int depth) {
- if (leaf != null)
- return leaf.toHTML();
-
- List children = getOrderedChildren();
-
- StringBuilder sb = new StringBuilder();
- if (depth > 0 && children.size() > 1)
- sb.append("(");
- boolean first = true;
- for(Tree child : children) {
- if (!first) {
- sb.append(" ").append(connectionType.toHTML()).append(" ");
- if (depth == 0)
- sb.append("
");
- }
- first = false;
- sb.append(child.toHTML(depth + children.size() > 1 ? 1 : 0));
- }
- if (depth > 0 && children.size() > 1)
- sb.append(")");
- return sb.toString();
- }
-
- public String toAsciiString() {
- return String.join("
", toAscii());
- }
-
- private List toAscii() {
- if (leaf != null) {
- return Arrays.asList(TreeAsciiUtil.generateString(TreeAsciiUtil.BOXH, 1) + " " + leaf.toHTML() + " " + TreeAsciiUtil.generateString(TreeAsciiUtil.BOXH, 1));
- }
-
- List children = getOrderedChildren();
-
- List> childrenAscii =
- children.stream().map(c -> c.toAscii()).collect(Collectors.toList());
-
- if (TreeConnectionType.Series.equals(connectionType)) {
- return TreeAsciiUtil.concatenateMultiLineSerial(TreeAsciiUtil.generateString(TreeAsciiUtil.BOXH, 1), childrenAscii);
- } else {
- return TreeAsciiUtil.concatenateMultiLineParallel(childrenAscii);
- }
- }
-
- @Override
- protected Object clone() throws CloneNotSupportedException {
- if (leaf != null)
- return new Tree(leaf);
- List newChildren = new ArrayList();
- for (Tree t : children)
- newChildren.add((Tree) t.clone());
- return new Tree(newChildren, connectionType);
- }
-
- public Tree filter(Set types) {
- if (leaf != null) {
- if (types.contains(leaf.getComponent().getClass().getCanonicalName()))
- return new Tree(leaf);
- return null;
- }
- List newChildren = new ArrayList();
- for (Tree t : children) {
- Tree child = t.filter(types);
- if (child != null)
- newChildren.add(child);
- }
- if (newChildren.isEmpty())
- return null;
- return new Tree(newChildren, connectionType);
- }
-
- public void walk(ITreeWalker walker) {
- if (leaf != null) {
- walker.visit(leaf);
- } else {
- for (Tree t : children) {
- walker.visit(t);
- t.walk(walker);
- }
- }
- }
-
- public Set> extractComponents(Set types) {
- Set> res = new HashSet>();
- if (leaf != null && types.contains(leaf.getComponent().getClass().getCanonicalName())) {
- res.add(leaf.getComponent());
- } else if (children != null) {
- for (Tree t : children) {
- Set> childRes = t.extractComponents(types);
- if (childRes != null)
- res.addAll(childRes);
- }
- }
- return res;
- }
-
- public Tree locate(TreeLeaf l, boolean forceDirection) {
- if (leaf != null && leaf.equals(l, forceDirection))
- return this;
- if (children != null) {
- for (Tree t : children) {
- Tree childL = t.locate(l, forceDirection);
- if (childL != null) {
-// if (t.getLeaf() != null)
-// return this;
- return childL;
- }
- }
- }
- return null;
- }
-
- public Tree findCommonParent(Tree t1, Tree t2) {
- if (t1 == null)
- return t2;
- if (t2 == null)
- return t1;
-
- if (children == null)
- return null;
-
- if (!this.contains(t1) || !this.contains(t2))
- return null;
-
- Tree p1 = this;
- Tree p2 = this;
- for (Tree c : children) {
- if (c.contains(t1))
- p1 = c;
- if (c.contains(t2))
- p2 = c;
- }
-
- if (p1 != p2 || p1 == this || p2 == this)
- return this;
-
- return p1.findCommonParent(t1, t2);
- }
-
- public Tree findCommonParent(List t) {
- if (t.contains(null))
- {
- while(t.contains(null))
- t.remove(null);
- return findCommonParent(t);
- }
-
- if (t.size() == 0)
- return null;
- if (t.size() == 1)
- return t.get(0);
- if (t.size() == 2)
- return findCommonParent(t.get(0), t.get(1));
-
- List remainder = t.subList(1, t.size());
- return findCommonParent(t.get(0), findCommonParent(remainder));
- }
-
- public Tree findParent(Tree t) {
- if (children == null)
- return null;
- if (children.contains(t))
- return this;
- for (Tree c : children)
- {
- Tree p = c.findParent(t);
- if (p != null)
- return p;
- }
- return null;
- }
-
- public boolean contains(Tree t) {
- if (this == t)
- return true;
-
- if (children == null)
- return false;
- if (children.contains(t))
- return true;
- for (Tree c : children)
- if (c.contains(t))
- return true;
- return false;
- }
-
- public interface ITreeWalker {
-
- void visit(Tree t);
-
- void visit(TreeLeaf l);
- }
-}
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
+package org.diylc.netlist;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import org.diylc.core.IDIYComponent;
+
+public class Tree {
+
+ private List children;
+ private TreeConnectionType connectionType;
+ private TreeLeaf leaf;
+
+ public Tree(TreeConnectionType connectionType) {
+ this.children = new ArrayList();
+ this.connectionType = connectionType;
+ }
+
+ public Tree(TreeLeaf leaf) {
+ this.leaf = leaf;
+ }
+
+ public Tree(List children, TreeConnectionType connectionType) {
+ this.children = children;
+ this.connectionType = connectionType;
+ }
+
+ public List getChildren() {
+ return children;
+ }
+
+ public void trimChildrenLeft(int count) {
+ children = children.subList(count, children.size());
+ }
+
+ public void trimChildrenRight(int count) {
+ children = children.subList(0, children.size() - count);
+ }
+
+ public TreeConnectionType getConnectionType() {
+ return connectionType;
+ }
+
+ public TreeLeaf getLeaf() {
+ return leaf;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((children == null) ? 0 : children.hashCode());
+ result = prime * result + ((connectionType == null) ? 0 : connectionType.hashCode());
+ result = prime * result + ((leaf == null) ? 0 : leaf.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ Tree other = (Tree) obj;
+ if (children == null) {
+ if (other.children != null)
+ return false;
+ } else if (!children.equals(other.children))
+ return false;
+ if (connectionType != other.connectionType)
+ return false;
+ if (leaf == null) {
+ if (other.leaf != null)
+ return false;
+ } else if (!leaf.equals(other.leaf))
+ return false;
+ return true;
+ }
+
+ private List getOrderedChildren() {
+ if (getConnectionType() == TreeConnectionType.Series)
+ return children;
+ List ordered = new ArrayList(children);
+ Collections.sort(ordered, new Comparator() {
+
+ @Override
+ public int compare(Tree o1, Tree o2) {
+ return o1.toString().compareToIgnoreCase(o2.toString());
+ }
+ });
+ return ordered;
+ }
+
+ @Override
+ public String toString() {
+ if (leaf != null)
+ return leaf.toString();
+
+ // If we only have one child, no need for parentheses
+ if (children.size() == 1)
+ return children.get(0).toString();
+
+ StringBuilder sb = new StringBuilder("(");
+ boolean first = true;
+ for (Tree child : getOrderedChildren()) {
+ if (!first)
+ sb.append(" ").append(connectionType).append(" ");
+ first = false;
+ // Only include child's parentheses if it has multiple children with a different connection type
+ String childStr = child.toString();
+ if (child.children != null && child.children.size() > 1 && child.connectionType != connectionType) {
+ sb.append(childStr);
+ } else {
+ sb.append(childStr.replaceAll("^\\((.*)\\)$", "$1"));
+ }
+ }
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public String toHTML(int depth) {
+ if (leaf != null)
+ return leaf.toHTML();
+
+ List children = getOrderedChildren();
+
+ StringBuilder sb = new StringBuilder();
+ if (depth > 0 && children.size() > 1)
+ sb.append("(");
+ boolean first = true;
+ for (Tree child : children) {
+ if (!first) {
+ sb.append(" ").append(connectionType.toHTML()).append(" ");
+ if (depth == 0)
+ sb.append("
");
+ }
+ first = false;
+ sb.append(child.toHTML(depth + children.size() > 1 ? 1 : 0));
+ }
+ if (depth > 0 && children.size() > 1)
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public String toAsciiString() {
+ return String.join("
", toAscii());
+ }
+
+ private List toAscii() {
+ if (leaf != null) {
+ return Arrays.asList(TreeAsciiUtil.generateString(TreeAsciiUtil.BOXH,
+ 1) + " " + leaf.toHTML() + " " + TreeAsciiUtil.generateString(TreeAsciiUtil.BOXH, 1));
+ }
+
+ List children = getOrderedChildren();
+
+ List> childrenAscii =
+ children.stream().map(c -> c.toAscii()).collect(Collectors.toList());
+
+ if (TreeConnectionType.Series.equals(connectionType)) {
+ return TreeAsciiUtil.concatenateMultiLineSerial(
+ TreeAsciiUtil.generateString(TreeAsciiUtil.BOXH, 1), childrenAscii);
+ } else {
+ return TreeAsciiUtil.concatenateMultiLineParallel(childrenAscii);
+ }
+ }
+
+ @Override
+ protected Object clone() throws CloneNotSupportedException {
+ if (leaf != null)
+ return new Tree(leaf);
+ List newChildren = new ArrayList();
+ for (Tree t : children)
+ newChildren.add((Tree) t.clone());
+ return new Tree(newChildren, connectionType);
+ }
+
+ public Tree filter(Set types) {
+ if (leaf != null) {
+ if (types.contains(leaf.getComponent().getClass().getCanonicalName()))
+ return new Tree(leaf);
+ return null;
+ }
+ List newChildren = new ArrayList();
+ for (Tree t : children) {
+ Tree child = t.filter(types);
+ if (child != null)
+ newChildren.add(child);
+ }
+ if (newChildren.isEmpty())
+ return null;
+ return new Tree(newChildren, connectionType);
+ }
+
+ public void walk(ITreeWalker walker) {
+ if (leaf != null) {
+ walker.visit(leaf);
+ } else {
+ for (Tree t : children) {
+ walker.visit(t);
+ t.walk(walker);
+ }
+ }
+ }
+
+ public Set> extractComponents(Set types) {
+ Set> res = new HashSet>();
+ if (leaf != null && types.contains(leaf.getComponent().getClass().getCanonicalName())) {
+ res.add(leaf.getComponent());
+ } else if (children != null) {
+ for (Tree t : children) {
+ Set> childRes = t.extractComponents(types);
+ if (childRes != null)
+ res.addAll(childRes);
+ }
+ }
+ return res;
+ }
+
+ public Tree locate(TreeLeaf l, boolean forceDirection) {
+ if (leaf != null && leaf.equals(l, forceDirection))
+ return this;
+ if (children != null) {
+ for (Tree t : children) {
+ Tree childL = t.locate(l, forceDirection);
+ if (childL != null) {
+ // if (t.getLeaf() != null)
+ // return this;
+ return childL;
+ }
+ }
+ }
+ return null;
+ }
+
+ public Tree findCommonParent(Tree t1, Tree t2) {
+ if (t1 == null)
+ return t2;
+ if (t2 == null)
+ return t1;
+
+ if (children == null)
+ return null;
+
+ if (!this.contains(t1) || !this.contains(t2))
+ return null;
+
+ Tree p1 = this;
+ Tree p2 = this;
+ for (Tree c : children) {
+ if (c.contains(t1))
+ p1 = c;
+ if (c.contains(t2))
+ p2 = c;
+ }
+
+ if (p1 != p2 || p1 == this || p2 == this)
+ return this;
+
+ return p1.findCommonParent(t1, t2);
+ }
+
+ public Tree findCommonParent(List t) {
+ if (t.contains(null)) {
+ while (t.contains(null))
+ t.remove(null);
+ return findCommonParent(t);
+ }
+
+ if (t.size() == 0)
+ return null;
+ if (t.size() == 1)
+ return t.get(0);
+ if (t.size() == 2)
+ return findCommonParent(t.get(0), t.get(1));
+
+ List remainder = t.subList(1, t.size());
+ return findCommonParent(t.get(0), findCommonParent(remainder));
+ }
+
+ public Tree findParent(Tree t) {
+ if (children == null)
+ return null;
+ if (children.contains(t))
+ return this;
+ for (Tree c : children) {
+ Tree p = c.findParent(t);
+ if (p != null)
+ return p;
+ }
+ return null;
+ }
+
+ public boolean contains(Tree t) {
+ if (this == t)
+ return true;
+
+ if (children == null)
+ return false;
+ if (children.contains(t))
+ return true;
+ for (Tree c : children)
+ if (c.contains(t))
+ return true;
+ return false;
+ }
+
+ public interface ITreeWalker {
+
+ void visit(Tree t);
+
+ void visit(TreeLeaf l);
+ }
+}
diff --git a/diylc/diylc-core/src/org/diylc/netlist/TreeAsciiUtil.java b/diylc/diylc-core/src/main/java/org/diylc/netlist/TreeAsciiUtil.java
similarity index 100%
rename from diylc/diylc-core/src/org/diylc/netlist/TreeAsciiUtil.java
rename to diylc/diylc-core/src/main/java/org/diylc/netlist/TreeAsciiUtil.java
diff --git a/diylc/diylc-core/src/org/diylc/netlist/TreeConnectionType.java b/diylc/diylc-core/src/main/java/org/diylc/netlist/TreeConnectionType.java
similarity index 100%
rename from diylc/diylc-core/src/org/diylc/netlist/TreeConnectionType.java
rename to diylc/diylc-core/src/main/java/org/diylc/netlist/TreeConnectionType.java
diff --git a/diylc/diylc-core/src/org/diylc/netlist/TreeException.java b/diylc/diylc-core/src/main/java/org/diylc/netlist/TreeException.java
similarity index 100%
rename from diylc/diylc-core/src/org/diylc/netlist/TreeException.java
rename to diylc/diylc-core/src/main/java/org/diylc/netlist/TreeException.java
diff --git a/diylc/diylc-core/src/org/diylc/netlist/TreeLeaf.java b/diylc/diylc-core/src/main/java/org/diylc/netlist/TreeLeaf.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/netlist/TreeLeaf.java
rename to diylc/diylc-core/src/main/java/org/diylc/netlist/TreeLeaf.java
index 11cfcd37..9d4cc9d8 100644
--- a/diylc/diylc-core/src/org/diylc/netlist/TreeLeaf.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/netlist/TreeLeaf.java
@@ -22,6 +22,7 @@
package org.diylc.netlist;
import java.util.List;
+
import org.diylc.core.IDIYComponent;
public class TreeLeaf implements ITree {
diff --git a/diylc/diylc-core/src/org/diylc/plugins/cloud/model/CommentEntity.java b/diylc/diylc-core/src/main/java/org/diylc/plugins/cloud/model/CommentEntity.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/plugins/cloud/model/CommentEntity.java
rename to diylc/diylc-core/src/main/java/org/diylc/plugins/cloud/model/CommentEntity.java
index 89dad269..7a280b33 100644
--- a/diylc/diylc-core/src/org/diylc/plugins/cloud/model/CommentEntity.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/plugins/cloud/model/CommentEntity.java
@@ -1,24 +1,24 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.plugins.cloud.model;
import java.io.Serializable;
diff --git a/diylc/diylc-core/src/org/diylc/plugins/cloud/model/IServiceAPI.java b/diylc/diylc-core/src/main/java/org/diylc/plugins/cloud/model/IServiceAPI.java
similarity index 100%
rename from diylc/diylc-core/src/org/diylc/plugins/cloud/model/IServiceAPI.java
rename to diylc/diylc-core/src/main/java/org/diylc/plugins/cloud/model/IServiceAPI.java
diff --git a/diylc/diylc-core/src/org/diylc/plugins/cloud/model/ProjectEntity.java b/diylc/diylc-core/src/main/java/org/diylc/plugins/cloud/model/ProjectEntity.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/plugins/cloud/model/ProjectEntity.java
rename to diylc/diylc-core/src/main/java/org/diylc/plugins/cloud/model/ProjectEntity.java
index a5c8fdb6..74cb90ed 100644
--- a/diylc/diylc-core/src/org/diylc/plugins/cloud/model/ProjectEntity.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/plugins/cloud/model/ProjectEntity.java
@@ -1,29 +1,30 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.plugins.cloud.model;
-import java.io.Serializable;
-import org.diylc.core.annotations.DynamicList;
-import org.diylc.core.annotations.EditableProperty;
+import java.io.Serializable;
+
+import org.diylc.core.annotations.DynamicList;
+import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.annotations.MultiLineText;
/**
diff --git a/diylc/diylc-core/src/org/diylc/plugins/cloud/model/UserEntity.java b/diylc/diylc-core/src/main/java/org/diylc/plugins/cloud/model/UserEntity.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/plugins/cloud/model/UserEntity.java
rename to diylc/diylc-core/src/main/java/org/diylc/plugins/cloud/model/UserEntity.java
index 893f493f..266b0c38 100644
--- a/diylc/diylc-core/src/org/diylc/plugins/cloud/model/UserEntity.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/plugins/cloud/model/UserEntity.java
@@ -1,24 +1,24 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.plugins.cloud.model;
import java.io.Serializable;
diff --git a/diylc/diylc-core/src/org/diylc/plugins/cloud/presenter/CloudException.java b/diylc/diylc-core/src/main/java/org/diylc/plugins/cloud/presenter/CloudException.java
similarity index 98%
rename from diylc/diylc-core/src/org/diylc/plugins/cloud/presenter/CloudException.java
rename to diylc/diylc-core/src/main/java/org/diylc/plugins/cloud/presenter/CloudException.java
index e48bcfda..f0525276 100644
--- a/diylc/diylc-core/src/org/diylc/plugins/cloud/presenter/CloudException.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/plugins/cloud/presenter/CloudException.java
@@ -19,18 +19,18 @@
along with DIYLC. If not, see .
*/
-package org.diylc.plugins.cloud.presenter;
-
-public class CloudException extends Exception {
-
- private static final long serialVersionUID = 1L;
-
- public CloudException(Exception e) {
- super(e);
- }
-
- public CloudException(String string) {
- super(string);
- }
-
-}
+package org.diylc.plugins.cloud.presenter;
+
+public class CloudException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ public CloudException(Exception e) {
+ super(e);
+ }
+
+ public CloudException(String string) {
+ super(string);
+ }
+
+}
diff --git a/diylc/diylc-core/src/org/diylc/plugins/cloud/presenter/CloudListener.java b/diylc/diylc-core/src/main/java/org/diylc/plugins/cloud/presenter/CloudListener.java
similarity index 99%
rename from diylc/diylc-core/src/org/diylc/plugins/cloud/presenter/CloudListener.java
rename to diylc/diylc-core/src/main/java/org/diylc/plugins/cloud/presenter/CloudListener.java
index 50bd0c5f..df44432e 100644
--- a/diylc/diylc-core/src/org/diylc/plugins/cloud/presenter/CloudListener.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/plugins/cloud/presenter/CloudListener.java
@@ -19,11 +19,11 @@
along with DIYLC. If not, see .
*/
-package org.diylc.plugins.cloud.presenter;
-
-public interface CloudListener {
-
- public void loggedIn();
-
- public void loggedOut();
-}
+package org.diylc.plugins.cloud.presenter;
+
+public interface CloudListener {
+
+ public void loggedIn();
+
+ public void loggedOut();
+}
diff --git a/diylc/diylc-core/src/org/diylc/plugins/cloud/presenter/CloudPresenter.java b/diylc/diylc-core/src/main/java/org/diylc/plugins/cloud/presenter/CloudPresenter.java
similarity index 97%
rename from diylc/diylc-core/src/org/diylc/plugins/cloud/presenter/CloudPresenter.java
rename to diylc/diylc-core/src/main/java/org/diylc/plugins/cloud/presenter/CloudPresenter.java
index a9bd2e49..05a7644e 100644
--- a/diylc/diylc-core/src/org/diylc/plugins/cloud/presenter/CloudPresenter.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/plugins/cloud/presenter/CloudPresenter.java
@@ -1,48 +1,50 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.plugins.cloud.presenter;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.NetworkInterface;
-import java.net.URL;
-import java.nio.channels.Channels;
-import java.nio.channels.ReadableByteChannel;
-import java.util.Collections;
-import java.util.List;
-import org.apache.log4j.Logger;
-import org.diylc.appframework.miscutils.ConfigurationManager;
-import org.diylc.common.PropertyWrapper;
-import org.diylc.plugins.cloud.model.CommentEntity;
-import org.diylc.plugins.cloud.model.IServiceAPI;
-import org.diylc.plugins.cloud.model.ProjectEntity;
-import org.diylc.plugins.cloud.model.UserEntity;
-import org.diylc.presenter.ComparatorFactory;
-import org.diylc.presenter.ComponentProcessor;
-import com.diyfever.httpproxy.PhpFlatProxy;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.net.URL;
+import java.nio.channels.Channels;
+import java.nio.channels.ReadableByteChannel;
+import java.util.Collections;
+import java.util.List;
+import org.apache.log4j.Logger;
+import org.diylc.appframework.miscutils.ConfigurationManager;
+
+import com.diyfever.httpproxy.PhpFlatProxy;
import com.diyfever.httpproxy.ProxyFactory;
+import org.diylc.common.PropertyWrapper;
+import org.diylc.plugins.cloud.model.CommentEntity;
+import org.diylc.plugins.cloud.model.IServiceAPI;
+import org.diylc.plugins.cloud.model.ProjectEntity;
+import org.diylc.plugins.cloud.model.UserEntity;
+import org.diylc.presenter.ComparatorFactory;
+import org.diylc.presenter.ComponentProcessor;
+
/**
* Contains all the back-end logic for using the cloud and manipulating projects on the cloud.
*
@@ -165,11 +167,11 @@ public class CloudPresenter {
if (username == null || token == null)
throw new CloudException("Login failed. Please try to login again.");
-
+
if (projectId == null)
- LOG.info("Uploading a new project: " + projectName);
- else
- LOG.info("Updating project: " + projectId);
+ LOG.info("Uploading a new project: " + projectName);
+ else
+ LOG.info("Updating project: " + projectId);
try {
String res =
@@ -180,24 +182,24 @@ public class CloudPresenter {
} catch (Exception e) {
throw new CloudException(e);
}
- }
-
- public void replaceProjectFile(String diylcVersion, File thumbnail, File project, Integer projectId) throws IOException, CloudException {
- String username = ConfigurationManager.getInstance().readString(USERNAME_KEY, null);
- String token = ConfigurationManager.getInstance().readString(TOKEN_KEY, null);
-
- if (username == null || token == null)
- throw new CloudException("Login failed. Please try to login again.");
-
- LOG.info("Replacing project files for: " + projectId);
- try {
- String res =
- getService().replaceProjectFiles(username, token, getMachineId(), diylcVersion, thumbnail, project, projectId);
- if (!res.equals(SUCCESS))
- throw new CloudException(res);
- } catch (Exception e) {
- throw new CloudException(e);
- }
+ }
+
+ public void replaceProjectFile(String diylcVersion, File thumbnail, File project, Integer projectId) throws IOException, CloudException {
+ String username = ConfigurationManager.getInstance().readString(USERNAME_KEY, null);
+ String token = ConfigurationManager.getInstance().readString(TOKEN_KEY, null);
+
+ if (username == null || token == null)
+ throw new CloudException("Login failed. Please try to login again.");
+
+ LOG.info("Replacing project files for: " + projectId);
+ try {
+ String res =
+ getService().replaceProjectFiles(username, token, getMachineId(), diylcVersion, thumbnail, project, projectId);
+ if (!res.equals(SUCCESS))
+ throw new CloudException(res);
+ } catch (Exception e) {
+ throw new CloudException(e);
+ }
}
public void updateProjectDetails(ProjectEntity project, String diylcVersion) throws IOException, CloudException {
diff --git a/diylc/diylc-core/src/org/diylc/plugins/cloud/presenter/NotConnectedException.java b/diylc/diylc-core/src/main/java/org/diylc/plugins/cloud/presenter/NotConnectedException.java
similarity index 99%
rename from diylc/diylc-core/src/org/diylc/plugins/cloud/presenter/NotConnectedException.java
rename to diylc/diylc-core/src/main/java/org/diylc/plugins/cloud/presenter/NotConnectedException.java
index deeeebd7..96835cb8 100644
--- a/diylc/diylc-core/src/org/diylc/plugins/cloud/presenter/NotConnectedException.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/plugins/cloud/presenter/NotConnectedException.java
@@ -19,10 +19,10 @@
along with DIYLC. If not, see .
*/
-package org.diylc.plugins.cloud.presenter;
-
-public class NotConnectedException extends Exception {
-
- private static final long serialVersionUID = 1L;
-
-}
+package org.diylc.plugins.cloud.presenter;
+
+public class NotConnectedException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+}
diff --git a/diylc/diylc-core/src/org/diylc/plugins/cloud/presenter/NotExistsException.java b/diylc/diylc-core/src/main/java/org/diylc/plugins/cloud/presenter/NotExistsException.java
similarity index 99%
rename from diylc/diylc-core/src/org/diylc/plugins/cloud/presenter/NotExistsException.java
rename to diylc/diylc-core/src/main/java/org/diylc/plugins/cloud/presenter/NotExistsException.java
index ea5f1024..6c812b8e 100644
--- a/diylc/diylc-core/src/org/diylc/plugins/cloud/presenter/NotExistsException.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/plugins/cloud/presenter/NotExistsException.java
@@ -19,13 +19,13 @@
along with DIYLC. If not, see .
*/
-package org.diylc.plugins.cloud.presenter;
-
-public class NotExistsException extends Exception {
-
- private static final long serialVersionUID = 1L;
-
- public NotExistsException(String message) {
- super(message);
- }
-}
+package org.diylc.plugins.cloud.presenter;
+
+public class NotExistsException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ public NotExistsException(String message) {
+ super(message);
+ }
+}
diff --git a/diylc/diylc-core/src/org/diylc/plugins/cloud/presenter/NotLoggedInException.java b/diylc/diylc-core/src/main/java/org/diylc/plugins/cloud/presenter/NotLoggedInException.java
similarity index 99%
rename from diylc/diylc-core/src/org/diylc/plugins/cloud/presenter/NotLoggedInException.java
rename to diylc/diylc-core/src/main/java/org/diylc/plugins/cloud/presenter/NotLoggedInException.java
index df07800d..94267e3a 100644
--- a/diylc/diylc-core/src/org/diylc/plugins/cloud/presenter/NotLoggedInException.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/plugins/cloud/presenter/NotLoggedInException.java
@@ -19,10 +19,10 @@
along with DIYLC. If not, see .
*/
-package org.diylc.plugins.cloud.presenter;
-
-public class NotLoggedInException extends Exception {
-
- private static final long serialVersionUID = 1L;
-
-}
+package org.diylc.plugins.cloud.presenter;
+
+public class NotLoggedInException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+}
diff --git a/diylc/diylc-core/src/org/diylc/plugins/cloud/presenter/SearchSession.java b/diylc/diylc-core/src/main/java/org/diylc/plugins/cloud/presenter/SearchSession.java
similarity index 97%
rename from diylc/diylc-core/src/org/diylc/plugins/cloud/presenter/SearchSession.java
rename to diylc/diylc-core/src/main/java/org/diylc/plugins/cloud/presenter/SearchSession.java
index 853f897a..e92f912b 100644
--- a/diylc/diylc-core/src/org/diylc/plugins/cloud/presenter/SearchSession.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/plugins/cloud/presenter/SearchSession.java
@@ -1,27 +1,28 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.plugins.cloud.presenter;
-import java.util.List;
+import java.util.List;
+
import org.diylc.plugins.cloud.model.ProjectEntity;
/**
diff --git a/diylc/diylc-core/src/org/diylc/presenter/AreaUtils.java b/diylc/diylc-core/src/main/java/org/diylc/presenter/AreaUtils.java
similarity index 100%
rename from diylc/diylc-core/src/org/diylc/presenter/AreaUtils.java
rename to diylc/diylc-core/src/main/java/org/diylc/presenter/AreaUtils.java
diff --git a/diylc/diylc-core/src/org/diylc/presenter/BuildingBlockManager.java b/diylc/diylc-core/src/main/java/org/diylc/presenter/BuildingBlockManager.java
similarity index 95%
rename from diylc/diylc-core/src/org/diylc/presenter/BuildingBlockManager.java
rename to diylc/diylc-core/src/main/java/org/diylc/presenter/BuildingBlockManager.java
index 795c9a8f..45484187 100644
--- a/diylc/diylc-core/src/org/diylc/presenter/BuildingBlockManager.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/presenter/BuildingBlockManager.java
@@ -17,11 +17,7 @@
*/
package org.diylc.presenter;
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
+import java.io.*;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
@@ -32,16 +28,18 @@ import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.diylc.appframework.miscutils.IConfigurationManager;
-import org.diylc.common.BuildingBlockPackage;
-import org.diylc.common.IBlockProcessor;
-import org.diylc.common.IBlockProcessor.InvalidBlockException;
-import org.diylc.common.IPlugInPort;
-import org.diylc.core.IDIYComponent;
-import org.diylc.serialization.ProjectFileManager;
+
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;
import com.thoughtworks.xstream.security.AnyTypePermission;
+import org.diylc.common.BuildingBlockPackage;
+import org.diylc.common.IBlockProcessor;
+import org.diylc.common.IPlugInPort;
+import org.diylc.common.IBlockProcessor.InvalidBlockException;
+import org.diylc.core.IDIYComponent;
+import org.diylc.serialization.ProjectFileManager;
+
public class BuildingBlockManager {
private static final String BLOCKS_FILE_NAME = "blocks.xml";
@@ -65,9 +63,11 @@ public class BuildingBlockManager {
// import default templates from variants.xml file only if we didn't do it already
if (!configManager.readBoolean(IPlugInPort.DEFAULT_BLOCKS_IMPORTED_KEY, false)) {
try {
- URL resource = Presenter.class.getResource(BLOCKS_FILE_NAME);
- if (resource != null) {
- BufferedInputStream in = new BufferedInputStream(resource.openStream());
+ InputStream inputStream = Presenter.class.getResourceAsStream("/" + BLOCKS_FILE_NAME);
+ if (inputStream == null) {
+ return;
+ }
+ BufferedInputStream in = new BufferedInputStream(inputStream);
Map>> defaults =
(Map>>) ProjectFileManager.xStreamSerializer
.fromXML(in);
@@ -90,7 +90,6 @@ public class BuildingBlockManager {
configManager.writeValue(IPlugInPort.BLOCKS_KEY, blocksMap);
LOG.info(String.format("Imported %d default building blocks",
defaults == null ? 0 : defaults.size()));
- }
} catch (Exception e) {
LOG.error("Could not load default blocks", e);
}
diff --git a/diylc/diylc-core/src/org/diylc/presenter/CalcUtils.java b/diylc/diylc-core/src/main/java/org/diylc/presenter/CalcUtils.java
similarity index 99%
rename from diylc/diylc-core/src/org/diylc/presenter/CalcUtils.java
rename to diylc/diylc-core/src/main/java/org/diylc/presenter/CalcUtils.java
index fb424f13..d362ef3d 100644
--- a/diylc/diylc-core/src/org/diylc/presenter/CalcUtils.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/presenter/CalcUtils.java
@@ -20,6 +20,7 @@ package org.diylc.presenter;
import java.awt.geom.Point2D;
import java.util.List;
+
import org.diylc.core.IDIYComponent;
import org.diylc.core.measures.Size;
diff --git a/diylc/diylc-core/src/org/diylc/presenter/ComparatorFactory.java b/diylc/diylc-core/src/main/java/org/diylc/presenter/ComparatorFactory.java
similarity index 97%
rename from diylc/diylc-core/src/org/diylc/presenter/ComparatorFactory.java
rename to diylc/diylc-core/src/main/java/org/diylc/presenter/ComparatorFactory.java
index b1fc457c..378b2ec2 100644
--- a/diylc/diylc-core/src/org/diylc/presenter/ComparatorFactory.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/presenter/ComparatorFactory.java
@@ -1,31 +1,32 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.presenter;
-import java.util.Comparator;
-import org.diylc.common.ComponentType;
-import org.diylc.common.PropertyWrapper;
-import org.diylc.core.IDIYComponent;
-import org.diylc.core.Project;
+import java.util.Comparator;
+
+import org.diylc.common.ComponentType;
+import org.diylc.common.PropertyWrapper;
+import org.diylc.core.IDIYComponent;
+import org.diylc.core.Project;
public class ComparatorFactory {
@@ -97,10 +98,10 @@ public class ComparatorFactory {
propertyNameComparator = new Comparator() {
@Override
- public int compare(PropertyWrapper o1, PropertyWrapper o2) {
- if (o1.isReadOnly() && !o2.isReadOnly())
- return 1;
- if (!o1.isReadOnly() && o2.isReadOnly())
+ public int compare(PropertyWrapper o1, PropertyWrapper o2) {
+ if (o1.isReadOnly() && !o2.isReadOnly())
+ return 1;
+ if (!o1.isReadOnly() && o2.isReadOnly())
return -1;
int comp = Integer.valueOf(o1.getSortOrder()).compareTo(o2.getSortOrder());
if (comp != 0)
@@ -131,17 +132,17 @@ public class ComparatorFactory {
};
}
return componentZOrderComparator;
- }
-
- public Comparator> getComponentProjectZOrderComparator(final Project project) {
- return new Comparator>() {
-
- @Override
- public int compare(IDIYComponent> o1, IDIYComponent> o2) {
- int index1 = project.getComponents().indexOf(o1);
- int index2 = project.getComponents().indexOf(o2);
- return Integer.valueOf(index1).compareTo(index2);
- }
- };
+ }
+
+ public Comparator> getComponentProjectZOrderComparator(final Project project) {
+ return new Comparator>() {
+
+ @Override
+ public int compare(IDIYComponent> o1, IDIYComponent> o2) {
+ int index1 = project.getComponents().indexOf(o1);
+ int index2 = project.getComponents().indexOf(o2);
+ return Integer.valueOf(index1).compareTo(index2);
+ }
+ };
}
}
diff --git a/diylc/diylc-core/src/org/diylc/presenter/ComponentArea.java b/diylc/diylc-core/src/main/java/org/diylc/presenter/ComponentArea.java
similarity index 100%
rename from diylc/diylc-core/src/org/diylc/presenter/ComponentArea.java
rename to diylc/diylc-core/src/main/java/org/diylc/presenter/ComponentArea.java
diff --git a/diylc/diylc-core/src/org/diylc/presenter/ComponentProcessor.java b/diylc/diylc-core/src/main/java/org/diylc/presenter/ComponentProcessor.java
similarity index 97%
rename from diylc/diylc-core/src/org/diylc/presenter/ComponentProcessor.java
rename to diylc/diylc-core/src/main/java/org/diylc/presenter/ComponentProcessor.java
index 72fcd326..2bab6e2b 100644
--- a/diylc/diylc-core/src/org/diylc/presenter/ComponentProcessor.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/presenter/ComponentProcessor.java
@@ -1,50 +1,51 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.presenter;
-import java.awt.Graphics2D;
-import java.awt.Image;
-import java.awt.RenderingHints;
-import java.awt.image.BufferedImage;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-import org.apache.log4j.Logger;
-import org.diylc.common.ComponentType;
-import org.diylc.common.IComponentTransformer;
-import org.diylc.common.PropertyWrapper;
-import org.diylc.core.CreationMethod;
-import org.diylc.core.IDIYComponent;
-import org.diylc.core.IPropertyValidator;
-import org.diylc.core.annotations.BomPolicy;
-import org.diylc.core.annotations.ComponentDescriptor;
-import org.diylc.core.annotations.EditableProperty;
-import org.diylc.core.annotations.KeywordPolicy;
+import java.awt.Graphics2D;
+import java.awt.Image;
+import java.awt.RenderingHints;
+import java.awt.image.BufferedImage;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+import org.apache.log4j.Logger;
+
+import org.diylc.common.ComponentType;
+import org.diylc.common.IComponentTransformer;
+import org.diylc.common.PropertyWrapper;
+import org.diylc.core.CreationMethod;
+import org.diylc.core.IDIYComponent;
+import org.diylc.core.IPropertyValidator;
+import org.diylc.core.annotations.BomPolicy;
+import org.diylc.core.annotations.ComponentDescriptor;
+import org.diylc.core.annotations.EditableProperty;
+import org.diylc.core.annotations.KeywordPolicy;
import org.diylc.lang.LangUtil;
/**
@@ -92,13 +93,13 @@ public class ComponentProcessor {
double zOrder;
boolean flexibleZOrder;
BomPolicy bomPolicy;
- boolean autoEdit;
+ boolean autoEdit;
boolean cacheDrawing;
IComponentTransformer transformer;
KeywordPolicy keywordPolicy;
- String keywordTag;
- List datasheet = null;
- int datasheetCreationStepCount = 0;
+ String keywordTag;
+ List datasheet = null;
+ int datasheetCreationStepCount = 0;
if (clazz.isAnnotationPresent(ComponentDescriptor.class)) {
ComponentDescriptor annotation = clazz.getAnnotation(ComponentDescriptor.class);
@@ -114,11 +115,11 @@ public class ComponentProcessor {
autoEdit = annotation.autoEdit();
transformer = getComponentTransformer(annotation.transformer());
keywordPolicy = annotation.keywordPolicy();
- keywordTag = annotation.keywordTag();
- cacheDrawing = annotation.enableCache();
- if (annotation.enableDatasheet()) {
- datasheet = DatasheetService.getInstance().loadDatasheet(clazz);
- datasheetCreationStepCount = annotation.datasheetCreationStepCount();
+ keywordTag = annotation.keywordTag();
+ cacheDrawing = annotation.enableCache();
+ if (annotation.enableDatasheet()) {
+ datasheet = DatasheetService.getInstance().loadDatasheet(clazz);
+ datasheetCreationStepCount = annotation.datasheetCreationStepCount();
}
} else { // default
return null;
@@ -141,7 +142,7 @@ public class ComponentProcessor {
}
ComponentType componentType =
new ComponentType(name, description, creationMethod, category, namePrefix, author, icon, clazz, zOrder,
- flexibleZOrder, bomPolicy, autoEdit, transformer, keywordPolicy, keywordTag, cacheDrawing, datasheet,
+ flexibleZOrder, bomPolicy, autoEdit, transformer, keywordPolicy, keywordTag, cacheDrawing, datasheet,
datasheetCreationStepCount);
componentTypeMap.put(clazz.getName(), componentType);
return componentType;
@@ -161,9 +162,9 @@ public class ComponentProcessor {
for (Method getter : clazz.getMethods()) {
if (getter.getName().startsWith("get")) {
- if (getter.isAnnotationPresent(EditableProperty.class) && !getter.isAnnotationPresent(Deprecated.class)
- // since Java 8 in generic classes we get properties of both the generic type and Object
- // added this condition to skip Object property that we do not need
+ if (getter.isAnnotationPresent(EditableProperty.class) && !getter.isAnnotationPresent(Deprecated.class)
+ // since Java 8 in generic classes we get properties of both the generic type and Object
+ // added this condition to skip Object property that we do not need
&& getter.getReturnType() != Object.class) {
EditableProperty annotation = getter.getAnnotation(EditableProperty.class);
String name;
@@ -172,22 +173,22 @@ public class ComponentProcessor {
} else {
name = annotation.name();
}
- IPropertyValidator validator = getPropertyValidator(annotation.validatorClass());
-
- String setterName = null;
+ IPropertyValidator validator = getPropertyValidator(annotation.validatorClass());
+
+ String setterName = null;
try {
- Method setter = clazz.getMethod("set" + getter.getName().substring(3), getter.getReturnType());
- setterName = setter.getName();
- } catch (NoSuchMethodException e) {
- LOG.debug("No matching setter found for " + clazz.getName() + "." + getter.getName() + ". Skipping...");
- }
-
- LangUtil.translate(name); // temporary, just to make sure we catch it in the dict
- if (getter.getReturnType().isEnum()) {
- for(Object o : getter.getReturnType().getEnumConstants()) {
- LangUtil.translate(o.toString());
- }
- }
+ Method setter = clazz.getMethod("set" + getter.getName().substring(3), getter.getReturnType());
+ setterName = setter.getName();
+ } catch (NoSuchMethodException e) {
+ LOG.debug("No matching setter found for " + clazz.getName() + "." + getter.getName() + ". Skipping...");
+ }
+
+ LangUtil.translate(name); // temporary, just to make sure we catch it in the dict
+ if (getter.getReturnType().isEnum()) {
+ for(Object o : getter.getReturnType().getEnumConstants()) {
+ LangUtil.translate(o.toString());
+ }
+ }
PropertyWrapper property =
new PropertyWrapper(name, getter.getReturnType(), getter.getName(), setterName,
@@ -292,22 +293,22 @@ public class ComponentProcessor {
}
componentTransformerMap.put(clazz.getName(), transformer);
return transformer;
- }
-
- public static boolean hasStickyPoint(IDIYComponent> c) {
- for (int i = 0; i < c.getControlPointCount(); i++)
- if (c.isControlPointSticky(0))
- return true;
- return false;
- }
-
- private static int touchSensitivity = 5;
-
- public static boolean componentPointsTouch(IDIYComponent> c1, IDIYComponent> c2) {
- for (int i = 0; i < c1.getControlPointCount(); i++)
- for (int j = 0; j < c2.getControlPointCount(); j++)
- if (c1.isControlPointSticky(i) && c2.isControlPointSticky(j) && c1.getControlPoint(i).distance(c2.getControlPoint(j)) < touchSensitivity)
- return true;
- return false;
+ }
+
+ public static boolean hasStickyPoint(IDIYComponent> c) {
+ for (int i = 0; i < c.getControlPointCount(); i++)
+ if (c.isControlPointSticky(0))
+ return true;
+ return false;
+ }
+
+ private static int touchSensitivity = 5;
+
+ public static boolean componentPointsTouch(IDIYComponent> c1, IDIYComponent> c2) {
+ for (int i = 0; i < c1.getControlPointCount(); i++)
+ for (int j = 0; j < c2.getControlPointCount(); j++)
+ if (c1.isControlPointSticky(i) && c2.isControlPointSticky(j) && c1.getControlPoint(i).distance(c2.getControlPoint(j)) < touchSensitivity)
+ return true;
+ return false;
}
}
diff --git a/diylc/diylc-core/src/org/diylc/presenter/Connection.java b/diylc/diylc-core/src/main/java/org/diylc/presenter/Connection.java
similarity index 100%
rename from diylc/diylc-core/src/org/diylc/presenter/Connection.java
rename to diylc/diylc-core/src/main/java/org/diylc/presenter/Connection.java
diff --git a/diylc/diylc-core/src/org/diylc/presenter/ContinuityArea.java b/diylc/diylc-core/src/main/java/org/diylc/presenter/ContinuityArea.java
similarity index 99%
rename from diylc/diylc-core/src/org/diylc/presenter/ContinuityArea.java
rename to diylc/diylc-core/src/main/java/org/diylc/presenter/ContinuityArea.java
index afb68b60..455f51c7 100644
--- a/diylc/diylc-core/src/org/diylc/presenter/ContinuityArea.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/presenter/ContinuityArea.java
@@ -20,6 +20,7 @@ package org.diylc.presenter;
import java.awt.geom.Area;
import java.io.Serializable;
+
import org.diylc.netlist.AreaSimplifier;
public class ContinuityArea implements Serializable {
diff --git a/diylc/diylc-core/src/org/diylc/presenter/Counter.java b/diylc/diylc-core/src/main/java/org/diylc/presenter/Counter.java
similarity index 100%
rename from diylc/diylc-core/src/org/diylc/presenter/Counter.java
rename to diylc/diylc-core/src/main/java/org/diylc/presenter/Counter.java
diff --git a/diylc/diylc-core/src/org/diylc/presenter/DatasheetService.java b/diylc/diylc-core/src/main/java/org/diylc/presenter/DatasheetService.java
similarity index 93%
rename from diylc/diylc-core/src/org/diylc/presenter/DatasheetService.java
rename to diylc/diylc-core/src/main/java/org/diylc/presenter/DatasheetService.java
index 48ceea99..abff8506 100644
--- a/diylc/diylc-core/src/org/diylc/presenter/DatasheetService.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/presenter/DatasheetService.java
@@ -55,10 +55,11 @@ public class DatasheetService {
private DatasheetService() {}
public List loadDatasheet(Class> clazz) {
+ ClassLoader classloader = Thread.currentThread().getContextClassLoader();
return datasheetCache.computeIfAbsent(clazz.getCanonicalName(), key -> {
String fileName = clazz.getSimpleName() + ".datasheet";
LOG.info("Loading datasheet file for " + fileName);
- URL resource = clazz.getResource(fileName);
+ URL resource = classloader.getResource(fileName);
if (resource == null) {
LOG.warn("Datasheet file not found: " + fileName);
return null;
@@ -119,4 +120,10 @@ public class DatasheetService {
return null;
}
+
+ // Add method to clear cache for testing
+ public void clearCache() {
+ datasheetCache.clear();
+ lookupCache.clear();
+ }
}
diff --git a/diylc/diylc-core/src/org/diylc/presenter/DrawingCache.java b/diylc/diylc-core/src/main/java/org/diylc/presenter/DrawingCache.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/presenter/DrawingCache.java
rename to diylc/diylc-core/src/main/java/org/diylc/presenter/DrawingCache.java
index 079f8720..88e9d789 100644
--- a/diylc/diylc-core/src/org/diylc/presenter/DrawingCache.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/presenter/DrawingCache.java
@@ -28,6 +28,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.log4j.Logger;
+
import org.diylc.common.ComponentType;
import org.diylc.core.ComponentForRender;
import org.diylc.core.ComponentState;
@@ -180,6 +181,11 @@ public class DrawingCache {
private CacheValue renderAndCache(IDIYComponent> component, G2DWrapper g2d, ComponentState componentState,
boolean outlineMode, Project project, double zoom, double scaleFactor, int zOrder) {
+
+ if (!g2d.getClipBounds().intersects(component.getCachingBounds())) {
+ return null;
+ }
+
// if we need to apply caching
Point2D firstPoint = component.getControlPoint(0);
@@ -310,6 +316,7 @@ public class DrawingCache {
this.zoom = zoom;
this.dx = dx;
this.dy = dy;
+ this.scaleFactor = scaleFactor;
}
public IDIYComponent> getComponent() {
diff --git a/diylc/diylc-core/src/org/diylc/presenter/DrawingManager.java b/diylc/diylc-core/src/main/java/org/diylc/presenter/DrawingManager.java
similarity index 99%
rename from diylc/diylc-core/src/org/diylc/presenter/DrawingManager.java
rename to diylc/diylc-core/src/main/java/org/diylc/presenter/DrawingManager.java
index d3aa9b24..f2920b1d 100644
--- a/diylc/diylc-core/src/org/diylc/presenter/DrawingManager.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/presenter/DrawingManager.java
@@ -48,6 +48,7 @@ import java.util.stream.Collectors;
import org.apache.log4j.Logger;
import org.diylc.appframework.miscutils.IConfigurationManager;
import org.diylc.appframework.simplemq.MessageDispatcher;
+
import org.diylc.common.DrawOption;
import org.diylc.common.EventType;
import org.diylc.common.GridType;
diff --git a/diylc/diylc-core/src/org/diylc/presenter/G2DWrapper.java b/diylc/diylc-core/src/main/java/org/diylc/presenter/G2DWrapper.java
similarity index 99%
rename from diylc/diylc-core/src/org/diylc/presenter/G2DWrapper.java
rename to diylc/diylc-core/src/main/java/org/diylc/presenter/G2DWrapper.java
index 39a426bf..f5fac8a0 100644
--- a/diylc/diylc-core/src/org/diylc/presenter/G2DWrapper.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/presenter/G2DWrapper.java
@@ -62,6 +62,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+
import org.diylc.common.ObjectCache;
import org.diylc.common.ZoomableStroke;
import org.diylc.core.IDrawingObserver;
diff --git a/diylc/diylc-core/src/org/diylc/presenter/InstantiationManager.java b/diylc/diylc-core/src/main/java/org/diylc/presenter/InstantiationManager.java
similarity index 97%
rename from diylc/diylc-core/src/org/diylc/presenter/InstantiationManager.java
rename to diylc/diylc-core/src/main/java/org/diylc/presenter/InstantiationManager.java
index 48456d52..a54dbc75 100644
--- a/diylc/diylc-core/src/org/diylc/presenter/InstantiationManager.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/presenter/InstantiationManager.java
@@ -1,51 +1,52 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.presenter;
-import java.awt.geom.Point2D;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-import java.util.stream.Collectors;
-import org.apache.log4j.Logger;
-import org.diylc.appframework.miscutils.ConfigurationManager;
-import org.diylc.clipboard.ComponentTransferable;
-import org.diylc.common.ComponentType;
-import org.diylc.common.IPlugInPort;
-import org.diylc.common.Orientation;
-import org.diylc.common.OrientationHV;
-import org.diylc.common.PropertyWrapper;
-import org.diylc.core.Angle;
-import org.diylc.core.CreationMethod;
-import org.diylc.core.IDIYComponent;
-import org.diylc.core.Project;
-import org.diylc.core.Template;
-import org.diylc.core.annotations.KeywordPolicy;
+import java.awt.geom.Point2D;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+import org.apache.log4j.Logger;
+import org.diylc.appframework.miscutils.ConfigurationManager;
+
+import org.diylc.clipboard.ComponentTransferable;
+import org.diylc.common.ComponentType;
+import org.diylc.common.IPlugInPort;
+import org.diylc.common.Orientation;
+import org.diylc.common.OrientationHV;
+import org.diylc.common.PropertyWrapper;
+import org.diylc.core.Angle;
+import org.diylc.core.CreationMethod;
+import org.diylc.core.IDIYComponent;
+import org.diylc.core.Project;
+import org.diylc.core.Template;
+import org.diylc.core.annotations.KeywordPolicy;
import org.diylc.core.measures.Size;
/**
@@ -60,7 +61,7 @@ public class InstantiationManager {
public static int MAX_RECENT_COMPONENTS = 16;
private ComponentType componentTypeSlot;
- private Template template;
+ private Template template;
private String[] model;
private List> componentSlot;
private Point2D firstControlPoint;
@@ -68,9 +69,9 @@ public class InstantiationManager {
public static final ComponentType clipboardType = new ComponentType("Clipboard contents",
"Components from the clipboard", CreationMethod.SINGLE_CLICK, "Multi", "", "", null, null, 0, false, null,
- false, null, KeywordPolicy.NEVER_SHOW, null, false, null, 0);
- public static final ComponentType blockType = new ComponentType("Building block",
- "Components from the building block", CreationMethod.SINGLE_CLICK, "Multi", "", "", null, null, 0, false, null,
+ false, null, KeywordPolicy.NEVER_SHOW, null, false, null, 0);
+ public static final ComponentType blockType = new ComponentType("Building block",
+ "Components from the building block", CreationMethod.SINGLE_CLICK, "Multi", "", "", null, null, 0, false, null,
false, null, KeywordPolicy.NEVER_SHOW, null, false, null, 0);
public InstantiationManager() {}
@@ -81,10 +82,10 @@ public class InstantiationManager {
public Template getTemplate() {
return template;
- }
-
- public String[] getModel() {
- return model;
+ }
+
+ public String[] getModel() {
+ return model;
}
public List> getComponentSlot() {
@@ -97,17 +98,17 @@ public class InstantiationManager {
public Point2D getPotentialControlPoint() {
return potentialControlPoint;
- }
-
- public void setPotentialControlPoint(Point2D potentialControlPoint) {
- this.potentialControlPoint = potentialControlPoint;
+ }
+
+ public void setPotentialControlPoint(Point2D potentialControlPoint) {
+ this.potentialControlPoint = potentialControlPoint;
}
- public void setComponentTypeSlot(ComponentType componentTypeSlot, Template template, String[] model,
+ public void setComponentTypeSlot(ComponentType componentTypeSlot, Template template, String[] model,
Project currentProject, boolean forceInstatiate)
throws Exception {
this.componentTypeSlot = componentTypeSlot;
- this.template = template;
+ this.template = template;
this.model = model;
if (componentTypeSlot == null) {
this.componentSlot = null;
@@ -150,7 +151,7 @@ public class InstantiationManager {
return changeMade;
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked")
public void pasteComponents(ComponentTransferable componentTransferable, Point2D scaledPoint, boolean snapToGrid,
Size gridSpacing, boolean autoGroup, Project currentProject, boolean assignNewNames) {
// Adjust location of components so they are centered under the mouse
@@ -158,26 +159,26 @@ public class InstantiationManager {
double minX = Integer.MAX_VALUE;
double maxX = Integer.MIN_VALUE;
double minY = Integer.MAX_VALUE;
- double maxY = Integer.MIN_VALUE;
-
- Set existingNames = new HashSet();
- for (IDIYComponent> c : currentProject.getComponents())
- existingNames.add(c.getName());
-
- List> allComponents = new ArrayList>(currentProject.getComponents());
-
- List> components = componentTransferable.getComponents();
+ double maxY = Integer.MIN_VALUE;
- for (IDIYComponent> component : components) {
- // assign a new name if it already exists in the project
- if (assignNewNames && existingNames.contains(component.getName())) {
- ComponentType componentType =
- ComponentProcessor.getInstance().extractComponentTypeFrom((Class extends IDIYComponent>>) component.getClass());
- String newName = createUniqueName(componentType, allComponents);
- existingNames.add(newName);
- component.setName(newName);
- allComponents.add(component);
- }
+ Set existingNames = new HashSet();
+ for (IDIYComponent> c : currentProject.getComponents())
+ existingNames.add(c.getName());
+
+ List> allComponents = new ArrayList>(currentProject.getComponents());
+
+ List> components = componentTransferable.getComponents();
+
+ for (IDIYComponent> component : components) {
+ // assign a new name if it already exists in the project
+ if (assignNewNames && existingNames.contains(component.getName())) {
+ ComponentType componentType =
+ ComponentProcessor.getInstance().extractComponentTypeFrom((Class extends IDIYComponent>>) component.getClass());
+ String newName = createUniqueName(componentType, allComponents);
+ existingNames.add(newName);
+ component.setName(newName);
+ allComponents.add(component);
+ }
for (int i = 0; i < component.getControlPointCount(); i++) {
Point2D p = component.getControlPoint(i);
@@ -203,7 +204,7 @@ public class InstantiationManager {
}
for (IDIYComponent> component : components) {
for (int i = 0; i < component.getControlPointCount(); i++) {
- Point2D p = component.getControlPoint(i);
+ Point2D p = component.getControlPoint(i);
Point2D newP = new Point2D.Double(p.getX() - x, p.getY() - y);
component.setControlPoint(newP, i);
}
@@ -221,11 +222,11 @@ public class InstantiationManager {
CalcUtils.snapPointToGrid(scaledPoint, gridSpacing);
}
// Update the location according to mouse location
- updateSingleClick(scaledPoint, snapToGrid, gridSpacing);
-
- // copy group information if available
- if (componentTransferable.getGroups() != null) {
- currentProject.getGroups().addAll(componentTransferable.getGroups());
+ updateSingleClick(scaledPoint, snapToGrid, gridSpacing);
+
+ // copy group information if available
+ if (componentTransferable.getGroups() != null) {
+ currentProject.getGroups().addAll(componentTransferable.getGroups());
}
}
@@ -260,7 +261,7 @@ public class InstantiationManager {
} else {
Point2D p = new Point2D.Double();
for (IDIYComponent> component : componentSlot) {
- for (int i = 0; i < component.getControlPointCount(); i++) {
+ for (int i = 0; i < component.getControlPointCount(); i++) {
Point2D oldP = component.getControlPoint(i);
p.setLocation(oldP.getX() + dx, oldP.getY() + dy);
component.setControlPoint(p, i);
@@ -272,23 +273,23 @@ public class InstantiationManager {
@SuppressWarnings("unchecked")
private List> instantiateComponent(ComponentType componentType, Point2D point,
- Project currentProject) throws InstantiationException, IllegalAccessException, NoSuchMethodException,
+ Project currentProject) throws InstantiationException, IllegalAccessException, NoSuchMethodException,
SecurityException, IllegalArgumentException, InvocationTargetException {
LOG.info("Instatiating component of type: " + componentType.getInstanceClass().getName());
// Instantiate the component.
- IDIYComponent> component;
- if (model == null) {
- component = componentType.getInstanceClass().getDeclaredConstructor().newInstance();
- } else {
- Constructor extends IDIYComponent>> constructor = componentType.getInstanceClass().getConstructor(String[].class);
- component = constructor.newInstance((Object)model);
- }
+ IDIYComponent> component;
+ if (model == null) {
+ component = componentType.getInstanceClass().getDeclaredConstructor().newInstance();
+ } else {
+ Constructor extends IDIYComponent>> constructor = componentType.getInstanceClass().getConstructor(String[].class);
+ component = constructor.newInstance((Object)model);
+ }
component.createdIn(currentProject);
// Translate them to the desired location.
if (point != null) {
- for (int j = 0; j < component.getControlPointCount(); j++) {
+ for (int j = 0; j < component.getControlPointCount(); j++) {
Point2D p = component.getControlPoint(j);
Point2D controlPoint = new Point2D.Double(p.getX() + point.getX(), p.getY() + point.getY());
// snapPointToGrid(controlPoint);
@@ -297,15 +298,15 @@ public class InstantiationManager {
}
loadComponentShapeFromTemplate(component, template);
-
- if (model == null) {
+
+ if (model == null) {
// do not fill with defaults if creating by a model
- fillWithDefaultProperties(component, template);
- }
-
- // preserve component from the template if RENUMBER_ON_PASTE_KEY is OFF
- if (template == null || ConfigurationManager.getInstance().readBoolean(IPlugInPort.RENUMBER_ON_PASTE_KEY, true)) {
- component.setName(createUniqueName(componentType, currentProject.getComponents()));
+ fillWithDefaultProperties(component, template);
+ }
+
+ // preserve component from the template if RENUMBER_ON_PASTE_KEY is OFF
+ if (template == null || ConfigurationManager.getInstance().readBoolean(IPlugInPort.RENUMBER_ON_PASTE_KEY, true)) {
+ component.setName(createUniqueName(componentType, currentProject.getComponents()));
}
// Write to recent components
@@ -343,9 +344,9 @@ public class InstantiationManager {
public String createUniqueName(ComponentType componentType, List> components) {
boolean exists = true;
- Set takenNames = components.stream()
- .map(x -> x.getName())
- .filter(Objects::nonNull)
+ Set takenNames = components.stream()
+ .map(x -> x.getName())
+ .filter(Objects::nonNull)
.collect(Collectors.toSet());
int i = 0;
while (exists) {
@@ -382,11 +383,11 @@ public class InstantiationManager {
ConfigurationManager.getInstance().readObject(
Presenter.DEFAULTS_KEY_PREFIX + object.getClass().getName() + ":" + property.getName(), null);
if (defaultValue != null) {
- property.setValue(defaultValue);
+ property.setValue(defaultValue);
try {
- property.writeTo(object);
- } catch (Exception e) {
- LOG.error("Could not write property " + property.getName(), e);
+ property.writeTo(object);
+ } catch (Exception e) {
+ LOG.error("Could not write property " + property.getName(), e);
}
}
}
@@ -397,11 +398,11 @@ public class InstantiationManager {
LOG.warn("Cannot find property " + pair.getKey());
} else {
LOG.debug("Filling value from template for " + pair.getKey());
- property.setValue(pair.getValue());
+ property.setValue(pair.getValue());
try {
- property.writeTo(object);
- } catch (Exception e) {
- LOG.error("Could not write property " + property.getName(), e);
+ property.writeTo(object);
+ } catch (Exception e) {
+ LOG.error("Could not write property " + property.getName(), e);
}
}
}
@@ -417,7 +418,7 @@ public class InstantiationManager {
public void loadComponentShapeFromTemplate(IDIYComponent> component, Template template) {
if (template != null && template.getPoints() != null
&& template.getPoints().size() >= component.getControlPointCount()) {
- for (int i = 0; i < component.getControlPointCount(); i++) {
+ for (int i = 0; i < component.getControlPointCount(); i++) {
Point2D oldP = component.getControlPoint(0);
Point2D p = new Point2D.Double(oldP.getX() + template.getPoints().get(i).getX(), oldP.getY() + template.getPoints().get(i).getY());
component.setControlPoint(p, i);
@@ -435,7 +436,7 @@ public class InstantiationManager {
PropertyWrapper angleProperty = null;
for (PropertyWrapper propertyWrapper : properties) {
if (propertyWrapper.getType().getName().equals(Orientation.class.getName())
- || propertyWrapper.getType().getName().equals(OrientationHV.class.getName())
+ || propertyWrapper.getType().getName().equals(OrientationHV.class.getName())
|| propertyWrapper.getName().equalsIgnoreCase("angle")) {
angleProperty = propertyWrapper;
break;
@@ -455,10 +456,10 @@ public class InstantiationManager {
} else if (value instanceof OrientationHV) {
angleProperty.setValue(OrientationHV.values()[(((OrientationHV) value).ordinal() + 1)
% OrientationHV.values().length]);
- } else if (value instanceof Angle) {
- Angle angle = (Angle) angleProperty.getValue();
- Angle newAngle = angle.rotate(1);
- angleProperty.setValue(newAngle);
+ } else if (value instanceof Angle) {
+ Angle angle = (Angle) angleProperty.getValue();
+ Angle newAngle = angle.rotate(1);
+ angleProperty.setValue(newAngle);
}
angleProperty.writeTo(component);
}
diff --git a/diylc/diylc-core/src/org/diylc/presenter/PCBLayerFilter.java b/diylc/diylc-core/src/main/java/org/diylc/presenter/PCBLayerFilter.java
similarity index 96%
rename from diylc/diylc-core/src/org/diylc/presenter/PCBLayerFilter.java
rename to diylc/diylc-core/src/main/java/org/diylc/presenter/PCBLayerFilter.java
index 41b84544..b431a129 100644
--- a/diylc/diylc-core/src/org/diylc/presenter/PCBLayerFilter.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/presenter/PCBLayerFilter.java
@@ -1,29 +1,30 @@
-/*
-
- DIY Layout Creator (DIYLC).
- Copyright (c) 2009-2018 held jointly by the individual authors.
-
- This file is part of DIYLC.
-
- DIYLC is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- DIYLC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DIYLC. If not, see .
-
-*/
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 held jointly by the individual authors.
+
+ This file is part of DIYLC.
+
+ DIYLC is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ DIYLC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DIYLC. If not, see .
+
+*/
package org.diylc.presenter;
-import java.lang.reflect.Method;
-import org.diylc.common.IComponentFilter;
-import org.diylc.common.PCBLayer;
+import java.lang.reflect.Method;
+
+import org.diylc.common.IComponentFilter;
+import org.diylc.common.PCBLayer;
import org.diylc.core.IDIYComponent;
public class PCBLayerFilter implements IComponentFilter {
diff --git a/diylc/diylc-core/src/org/diylc/presenter/Presenter.java b/diylc/diylc-core/src/main/java/org/diylc/presenter/Presenter.java
similarity index 95%
rename from diylc/diylc-core/src/org/diylc/presenter/Presenter.java
rename to diylc/diylc-core/src/main/java/org/diylc/presenter/Presenter.java
index c6a2aa50..a57686b7 100644
--- a/diylc/diylc-core/src/org/diylc/presenter/Presenter.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/presenter/Presenter.java
@@ -55,6 +55,11 @@ import org.diylc.appframework.miscutils.Utils;
import org.diylc.appframework.simplemq.MessageDispatcher;
import org.diylc.appframework.update.Version;
import org.diylc.appframework.update.VersionNumber;
+
+import com.thoughtworks.xstream.XStream;
+import com.thoughtworks.xstream.io.xml.DomDriver;
+import com.thoughtworks.xstream.security.AnyTypePermission;
+
import org.diylc.clipboard.ComponentTransferable;
import org.diylc.common.ComponentType;
import org.diylc.common.DrawOption;
@@ -75,6 +80,7 @@ import org.diylc.core.Project;
import org.diylc.core.Template;
import org.diylc.core.Theme;
import org.diylc.core.VisibilityPolicy;
+import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.IAutoCreator;
import org.diylc.core.gerber.GerberExporter;
import org.diylc.core.measures.Size;
@@ -90,9 +96,11 @@ import org.diylc.test.DIYTest;
import org.diylc.test.Snapshot;
import org.diylc.utils.Constants;
import org.diylc.utils.ReflectionUtils;
-import com.thoughtworks.xstream.XStream;
-import com.thoughtworks.xstream.io.xml.DomDriver;
-import com.thoughtworks.xstream.security.AnyTypePermission;
+import org.reflections.Reflections;
+import org.reflections.util.ConfigurationBuilder;
+import org.reflections.util.FilterBuilder;
+
+import static org.reflections.scanners.Scanners.TypesAnnotated;
/**
* The main presenter class, contains core app logic and drawing routines.
@@ -129,30 +137,9 @@ public class Presenter implements IPlugInPort, IConfigListener {
private static final Logger LOG = Logger.getLogger(Presenter.class);
- public static VersionNumber CURRENT_VERSION = new VersionNumber(4, 0, 0);
- public static List RECENT_VERSIONS = null;
- // Read the latest version from the local update.xml file
- static {
- try {
- URL resource = Presenter.class.getResource("update.xml");
- if (resource != null) {
- BufferedInputStream in = new BufferedInputStream(resource.openStream());
- XStream xStream = new XStream(new DomDriver());
- xStream.addPermission(AnyTypePermission.ANY);
- @SuppressWarnings("unchecked")
- List allVersions = (List) xStream.fromXML(in);
- CURRENT_VERSION = allVersions.get(allVersions.size() - 1).getVersionNumber();
- LOG.info("Current DIYLC version: " + CURRENT_VERSION);
- RECENT_VERSIONS = allVersions.stream()
- .sorted(Comparator.comparing(x -> ((Version)x).getVersionNumber()).reversed())
- .limit(10)
- .collect(Collectors.toList());
- in.close();
- }
- } catch (Exception e) {
- LOG.error("Could not find version number, using default", e);
- }
- }
+ public static VersionNumber CURRENT_VERSION = null;
+ private static List RECENT_VERSIONS = null;
+
public static final String DEFAULTS_KEY_PREFIX = "default.";
public static final List> EMPTY_SELECTION = Collections.emptyList();
@@ -440,21 +427,14 @@ public class Presenter implements IPlugInPort, IConfigListener {
if (componentTypes == null) {
LOG.info("Loading component types.");
componentTypes = new HashMap>();
+ Reflections reflections = new Reflections(
+ new ConfigurationBuilder()
+ .forPackage("org.diylc")
+ .filterInputsBy(new FilterBuilder().includePackage("org.diylc.components"))
+ .setScanners(TypesAnnotated));
Set> componentTypeClasses = null;
try {
- componentTypeClasses = Utils.getClasses("org.diylc.components");
- File libraryFile = new File("library");
- if (libraryFile.exists() && libraryFile.isDirectory() && !Utils.isMac()) {
- LOG.info("Loading additional library JARs");
- try {
- List> additionalComponentTypeClasses =
- JarScanner.getInstance().scanFolder("library", IDIYComponent.class);
- if (additionalComponentTypeClasses != null)
- componentTypeClasses.addAll(additionalComponentTypeClasses);
- } catch (Exception e) {
- LOG.warn("Could not find additional type classes", e);
- }
- }
+ componentTypeClasses = reflections.getTypesAnnotatedWith(ComponentDescriptor.class, false);
for (Class> clazz : componentTypeClasses) {
if (!Modifier.isAbstract(clazz.getModifiers()) && IDIYComponent.class.isAssignableFrom(clazz)) {
@@ -1093,11 +1073,39 @@ public class Presenter implements IPlugInPort, IConfigListener {
@Override
public VersionNumber getCurrentVersionNumber() {
+ if (CURRENT_VERSION == null) {
+ List recentUpdates = getRecentUpdates();
+ CURRENT_VERSION = recentUpdates.stream()
+ .findFirst().map(v -> v.getVersionNumber())
+ .orElse(new VersionNumber(5, 0, 0));
+ LOG.info("Current DIYLC version: " + CURRENT_VERSION);
+ }
return CURRENT_VERSION;
}
@Override
public List getRecentUpdates() {
+ return getRecentVersions();
+ }
+
+ private static List getRecentVersions() {
+ if (RECENT_VERSIONS == null) {
+ try {
+ BufferedInputStream in =
+ new BufferedInputStream(Presenter.class.getResourceAsStream("/update.xml"));
+ XStream xStream = new XStream(new DomDriver());
+ xStream.addPermission(AnyTypePermission.ANY);
+ @SuppressWarnings("unchecked")
+ List allVersions = (List) xStream.fromXML(in);
+ RECENT_VERSIONS = allVersions.stream()
+ .sorted(Comparator.comparing(x -> ((Version) x).getVersionNumber()).reversed())
+ .limit(10).collect(Collectors.toList());
+ in.close();
+ } catch (Exception e) {
+ LOG.error("Could not load recent versions", e);
+ RECENT_VERSIONS = new ArrayList<>();
+ }
+ }
return RECENT_VERSIONS;
}
@@ -1561,8 +1569,8 @@ public class Presenter implements IPlugInPort, IConfigListener {
double centerY = (maxY + minY) / 2;
if (snapToGrid) {
- CalcUtils.roundToGrid(centerX, this.currentProject.getGridSpacing());
- CalcUtils.roundToGrid(centerY, this.currentProject.getGridSpacing());
+ centerX = CalcUtils.roundToGrid(centerX, this.currentProject.getGridSpacing());
+ centerY = CalcUtils.roundToGrid(centerY, this.currentProject.getGridSpacing());
}
return new Point2D.Double(centerX, centerY);
diff --git a/diylc/diylc-core/src/org/diylc/presenter/VariantManager.java b/diylc/diylc-core/src/main/java/org/diylc/presenter/VariantManager.java
similarity index 84%
rename from diylc/diylc-core/src/org/diylc/presenter/VariantManager.java
rename to diylc/diylc-core/src/main/java/org/diylc/presenter/VariantManager.java
index a87c9b8b..4761b4e4 100644
--- a/diylc/diylc-core/src/org/diylc/presenter/VariantManager.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/presenter/VariantManager.java
@@ -20,6 +20,7 @@ package org.diylc.presenter;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.net.URL;
import java.time.LocalDateTime;
import java.util.ArrayList;
@@ -34,12 +35,14 @@ import java.util.TreeMap;
import java.util.stream.Collectors;
import org.apache.log4j.Logger;
import org.diylc.appframework.miscutils.IConfigurationManager;
+
+import com.thoughtworks.xstream.XStream;
+
import org.diylc.common.ComponentType;
import org.diylc.common.IPlugInPort;
import org.diylc.common.VariantPackage;
import org.diylc.core.Template;
import org.diylc.serialization.ProjectFileManager;
-import com.thoughtworks.xstream.XStream;
public class VariantManager {
@@ -65,40 +68,41 @@ public class VariantManager {
int importCount = 0;
try {
- URL resource = Presenter.class.getResource(VARIANTS_FILE_NAME);
- if (resource != null) {
- BufferedInputStream in = new BufferedInputStream(resource.openStream());
- Map> defaults =
- (Map