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= 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