mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-07 12:24:58 +10:00
Compare commits
53 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 57dce61fc6 | |||
| 248c154ba5 | |||
| 189882c833 | |||
| 0417790aad | |||
| 494f50d04d | |||
| b3798198e2 | |||
| c51072171d | |||
| d2b33f4d1c | |||
| 452a450b04 | |||
| 272cf46be9 | |||
| d88b064b13 | |||
| 8d1be10545 | |||
| 31ee2b93c3 | |||
| f0ed0275cf | |||
| b3568b3ec9 | |||
| 2b5674c44a | |||
| 222050d826 | |||
| 4ba2b3d250 | |||
| 9e916370ee | |||
| f06bd0d49c | |||
| 521301d7ef | |||
| 6ef712b3e5 | |||
| 2ead5592d8 | |||
| 44c776194f | |||
| fbf92fbc6e | |||
| fe51620138 | |||
| 08ca6cef4e | |||
| f966f8873a | |||
| eedc370a6e | |||
| e6427cbec7 | |||
| aa8ca75d5a | |||
| 9f053f5dfa | |||
| 05d056700d | |||
| fce99fcdc0 | |||
| 83b1e02086 | |||
| ee11b5ffe4 | |||
| 344e85e6f7 | |||
| e088b5e8c9 | |||
| 0417947289 | |||
| fcfecd33cd | |||
| 54ba75f306 | |||
| ad43994d8f | |||
| 76071e8c1e | |||
| 29dc9b97b7 | |||
| bc428fad89 | |||
| a0e8f7411c | |||
| 16af862119 | |||
| f580aa65ee | |||
| dac2f8554a | |||
| 2caa91eb2e | |||
| 038e2bcbb4 | |||
| 6e347fd7d0 | |||
| f820c23093 |
Vendored
BIN
Binary file not shown.
Vendored
+28
@@ -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
|
||||
Vendored
+51
@@ -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
|
||||
@@ -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
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"java.compile.nullAnalysis.mode": "automatic",
|
||||
"java.configuration.updateBuildConfiguration": "interactive"
|
||||
}
|
||||
@@ -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
|
||||
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
|
||||
<project name="diylc-core" basedir="." default="jar">
|
||||
<property name="src.dir" value="src" />
|
||||
<property name="src.dir" value="${basedir}/src/main/java" />
|
||||
|
||||
<property name="lib.dir" value="${basedir}/lib" />
|
||||
<property name="build.dir" value="${basedir}/build" />
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="EclipseModuleManager">
|
||||
<libelement value="jar://$MODULE_DIR$/lib/log4j-1.2.15.jar!/" />
|
||||
<libelement value="jar://$MODULE_DIR$/lib/junit-4.7.jar!/" />
|
||||
<libelement value="jar://$MODULE_DIR$/lib/app-framework.jar!/" />
|
||||
<libelement value="jar://$MODULE_DIR$/lib/jettison-1.0.1.jar!/" />
|
||||
<libelement value="jar://$MODULE_DIR$/lib/xstream-1.3.1.jar!/" />
|
||||
<libelement value="jar://$MODULE_DIR$/lib/java-http-proxy.jar!/" />
|
||||
<libelement value="jar://$MODULE_DIR$/lib/AppleJavaExtensions.jar!/" />
|
||||
<src_description expected_position="0">
|
||||
<src_folder value="file://$MODULE_DIR$/src" expected_position="0" />
|
||||
<src_folder value="file://$MODULE_DIR$/test" expected_position="1" />
|
||||
</src_description>
|
||||
</component>
|
||||
<component name="NewModuleRootManager">
|
||||
<output url="file://$MODULE_DIR$/bin" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module-library">
|
||||
<library name="log4j-1.2.15.jar">
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/lib/log4j-1.2.15.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="junit-4.7.jar">
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/lib/junit-4.7.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="app-framework.jar">
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/lib/app-framework.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="jettison-1.0.1.jar">
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/lib/jettison-1.0.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="xstream-1.3.1.jar">
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/lib/xstream-1.3.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="java-http-proxy.jar">
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/lib/java-http-proxy.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="AppleJavaExtensions.jar">
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/lib/AppleJavaExtensions.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
</component>
|
||||
</module>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,96 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.diylc</groupId>
|
||||
<artifactId>diylc-parent</artifactId>
|
||||
<version>5.1.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>diylc-core</artifactId>
|
||||
<!-- No need to specify version - it inherits from parent -->
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- Common dependencies from Maven Central -->
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>javax.jms</groupId>
|
||||
<artifactId>jms</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.sun.jdmk</groupId>
|
||||
<artifactId>jmxtools</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.sun.jmx</groupId>
|
||||
<artifactId>jmxri</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.thoughtworks.xstream</groupId>
|
||||
<artifactId>xstream</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>33.4.0-jre</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.jettison</groupId>
|
||||
<artifactId>jettison</artifactId>
|
||||
<version>1.5.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.reflections</groupId>
|
||||
<artifactId>reflections</artifactId>
|
||||
<version>0.10.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- Add Mockito for testing -->
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<version>5.11.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Local dependencies from lib folder -->
|
||||
<dependency>
|
||||
<groupId>org.diylc.local</groupId>
|
||||
<artifactId>app-framework</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/../lib/app-framework-1.0.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.diylc.local</groupId>
|
||||
<artifactId>gerber-writer-api-1.0.0</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/../lib/gerber-writer-api-1.0.0.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.diylc.local</groupId>
|
||||
<artifactId>java-http-proxy</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/../lib/java-http-proxy.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
+21
-21
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package org.diylc.announcements;
|
||||
|
||||
import java.io.Serializable;
|
||||
+44
-42
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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("<html>");
|
||||
+8
-8
@@ -19,12 +19,12 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package org.diylc.announcements;
|
||||
|
||||
package org.diylc.announcements;
|
||||
|
||||
import java.util.List;
|
||||
import com.diyfever.httpproxy.ParamName;
|
||||
|
||||
public interface IAnnouncementService {
|
||||
|
||||
public List<Announcement> getAnnouncements(@ParamName("userId")String userId);
|
||||
}
|
||||
import com.diyfever.httpproxy.ParamName;
|
||||
|
||||
public interface IAnnouncementService {
|
||||
|
||||
public List<Announcement> getAnnouncements(@ParamName("userId")String userId);
|
||||
}
|
||||
+43
-42
@@ -19,8 +19,8 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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<IDIYComponent<?>> components;
|
||||
private Set<Set<IDIYComponent<?>>> groups;
|
||||
|
||||
public ComponentTransferable() {
|
||||
super();
|
||||
private Set<Set<IDIYComponent<?>>> groups;
|
||||
|
||||
public ComponentTransferable() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ComponentTransferable(List<IDIYComponent<?>> components) {
|
||||
super();
|
||||
this.components = components;
|
||||
this.groups = null;
|
||||
}
|
||||
|
||||
public ComponentTransferable(List<IDIYComponent<?>> components, Set<Set<IDIYComponent<?>>> groups) {
|
||||
}
|
||||
|
||||
public ComponentTransferable(List<IDIYComponent<?>> components, Set<Set<IDIYComponent<?>>> 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<IDIYComponent<?>> getComponents() {
|
||||
@@ -85,5 +86,5 @@ public class ComponentTransferable implements Transferable, Serializable {
|
||||
|
||||
public Set<Set<IDIYComponent<?>>> getGroups() {
|
||||
return groups;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
@@ -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 {
|
||||
+7
-7
@@ -19,10 +19,10 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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;
|
||||
|
||||
}
|
||||
+23
-22
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package org.diylc.common;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.diylc.core.IDIYComponent;
|
||||
|
||||
public class BuildingBlock {
|
||||
+1
@@ -23,6 +23,7 @@ package org.diylc.common;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.diylc.core.IDIYComponent;
|
||||
|
||||
public class BuildingBlockPackage {
|
||||
+1
@@ -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;
|
||||
+1
@@ -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;
|
||||
+11
-11
@@ -19,14 +19,14 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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();
|
||||
}
|
||||
}
|
||||
+33
-33
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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;
|
||||
}
|
||||
+29
-28
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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;
|
||||
}
|
||||
+6
-6
@@ -19,9 +19,9 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package org.diylc.common;
|
||||
|
||||
public enum GridType {
|
||||
|
||||
LINES, CROSSHAIR, DOT, NONE;
|
||||
}
|
||||
package org.diylc.common;
|
||||
|
||||
public enum GridType {
|
||||
|
||||
LINES, CROSSHAIR, DOT, NONE;
|
||||
}
|
||||
+9
-9
@@ -19,12 +19,12 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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();
|
||||
}
|
||||
}
|
||||
+24
-24
@@ -19,32 +19,32 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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;
|
||||
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -19,11 +19,11 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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);
|
||||
}
|
||||
+23
-22
@@ -19,26 +19,27 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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);
|
||||
}
|
||||
+21
-21
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package org.diylc.common;
|
||||
|
||||
public interface IKeyProcessor {
|
||||
+21
-21
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package org.diylc.common;
|
||||
|
||||
import java.awt.Point;
|
||||
+1
@@ -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;
|
||||
+1
@@ -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;
|
||||
+19
-19
@@ -19,22 +19,22 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package org.diylc.common;
|
||||
|
||||
import org.diylc.appframework.simplemq.IMessageListener;
|
||||
|
||||
/**
|
||||
* Interface for plug-ins.
|
||||
*
|
||||
* @author Branislav Stojkovic
|
||||
*/
|
||||
public interface IPlugIn extends IMessageListener<EventType> {
|
||||
|
||||
/**
|
||||
* 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<EventType> {
|
||||
|
||||
/**
|
||||
* Method that connects the plug-in with {@link IPlugInPort}. Called by the application when
|
||||
* plug-in is installed.
|
||||
*
|
||||
* @param plugInPort
|
||||
*/
|
||||
void connect(IPlugInPort plugInPort);
|
||||
}
|
||||
+118
-116
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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 <code>useZoom</code> 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<DrawOption> 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<Version> 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<Area> checkContinuityAreaProximity(Size threshold);
|
||||
}
|
||||
+1
@@ -22,6 +22,7 @@
|
||||
package org.diylc.common;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.Project;
|
||||
|
||||
+71
-70
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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<IDIYComponent<?>> getSelectedComponents();
|
||||
|
||||
/**
|
||||
* Returns selected component types
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Collection<IDIYComponent<?>> getSelectedComponents();
|
||||
|
||||
/**
|
||||
* Returns selected component types
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Collection<ComponentType> 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<IDIYComponent<?>> 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);
|
||||
}
|
||||
+21
-21
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package org.diylc.common;
|
||||
|
||||
/**
|
||||
+26
-25
@@ -19,37 +19,38 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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<Template> getVariantsFor(ComponentType type);
|
||||
|
||||
List<Template> 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<Template> getVariantsFor(ComponentType type);
|
||||
|
||||
List<Template> 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;
|
||||
|
||||
}
|
||||
}
|
||||
+11
-11
@@ -19,14 +19,14 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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();
|
||||
}
|
||||
}
|
||||
+11
-11
@@ -19,14 +19,14 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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();
|
||||
}
|
||||
}
|
||||
+15
-15
@@ -19,19 +19,19 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
-11
@@ -19,14 +19,14 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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();
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+31
-30
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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() {
|
||||
+14
-14
@@ -19,17 +19,17 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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();
|
||||
}
|
||||
}
|
||||
+1
@@ -23,6 +23,7 @@ package org.diylc.common;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.diylc.core.Template;
|
||||
|
||||
public class VariantPackage {
|
||||
+9
-9
@@ -19,12 +19,12 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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();
|
||||
}
|
||||
}
|
||||
+1
@@ -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;
|
||||
+105
-104
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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<T> implements IDIYComponent<T> {
|
||||
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<T> implements IDIYComponent<T> {
|
||||
}
|
||||
|
||||
@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<T> implements IDIYComponent<T> {
|
||||
*/
|
||||
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<T> implements IDIYComponent<T> {
|
||||
* @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<T> implements IDIYComponent<T> {
|
||||
@SuppressWarnings("unchecked")
|
||||
public IDIYComponent<T> clone() throws CloneNotSupportedException {
|
||||
try {
|
||||
// Instantiate object of the same type
|
||||
// Instantiate object of the same type
|
||||
Class<?> clazz = this.getClass();
|
||||
AbstractComponent<T> newInstance = (AbstractComponent<T>) clazz.getDeclaredConstructor().newInstance();
|
||||
while (AbstractComponent.class.isAssignableFrom(clazz)) {
|
||||
@@ -191,7 +192,7 @@ public abstract class AbstractComponent<T> implements IDIYComponent<T> {
|
||||
&& 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<T> implements IDIYComponent<T> {
|
||||
}
|
||||
// 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<T> implements IDIYComponent<T> {
|
||||
} 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<T> implements IDIYComponent<T> {
|
||||
// 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<T> implements IDIYComponent<T> {
|
||||
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
|
||||
}
|
||||
}
|
||||
+4
-2
@@ -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<T> extends AbstractTransparentComponent<T> {
|
||||
|
||||
+9
-9
@@ -19,13 +19,13 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package org.diylc.components;
|
||||
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
|
||||
public abstract class AbstractLabeledComponent<T> extends AbstractTransparentComponent<T> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
package org.diylc.components;
|
||||
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
|
||||
public abstract class AbstractLabeledComponent<T> extends AbstractTransparentComponent<T> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected Integer fontSizeOverride;
|
||||
|
||||
@@ -36,5 +36,5 @@ public abstract class AbstractLabeledComponent<T> extends AbstractTransparentCom
|
||||
|
||||
public void setFontSizeOverride(Integer fontSizeOverride) {
|
||||
this.fontSizeOverride = fontSizeOverride;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+21
-21
@@ -19,24 +19,24 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package org.diylc.components;
|
||||
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
|
||||
public abstract class AbstractTransparentComponent<T> extends AbstractComponent<T> {
|
||||
|
||||
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<T> extends AbstractComponent<T> {
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
+24
-23
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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 {
|
||||
+26
-25
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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);
|
||||
+26
-25
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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 {
|
||||
+12
-12
@@ -19,15 +19,15 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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 {}
|
||||
}
|
||||
+11
-11
@@ -19,14 +19,14 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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
|
||||
}
|
||||
+6
-6
@@ -19,9 +19,9 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package org.diylc.core;
|
||||
|
||||
public enum CreationMethod {
|
||||
|
||||
SINGLE_CLICK, POINT_BY_POINT;
|
||||
}
|
||||
package org.diylc.core;
|
||||
|
||||
public enum CreationMethod {
|
||||
|
||||
SINGLE_CLICK, POINT_BY_POINT;
|
||||
}
|
||||
+6
-6
@@ -19,9 +19,9 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package org.diylc.core;
|
||||
|
||||
public enum ExpansionMode {
|
||||
|
||||
ALL, SAME_TYPE, IMMEDIATE,
|
||||
}
|
||||
package org.diylc.core;
|
||||
|
||||
public enum ExpansionMode {
|
||||
|
||||
ALL, SAME_TYPE, IMMEDIATE,
|
||||
}
|
||||
+71
-70
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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<T> 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<T> extends Serializable, Cloneable {
|
||||
* same component</b>. 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<T> 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);
|
||||
}
|
||||
+12
-12
@@ -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);
|
||||
}
|
||||
+15
-15
@@ -19,19 +19,19 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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;
|
||||
}
|
||||
+27
-26
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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<PropertyWrapper> properties, Set<PropertyWrapper> defaultedProperties, String title);
|
||||
|
||||
boolean editProperties(List<PropertyWrapper> properties, Set<PropertyWrapper> defaultedProperties, String title);
|
||||
|
||||
String showInputDialog(String message, String title);
|
||||
|
||||
File promptFileSave();
|
||||
+92
-91
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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<IDIYComponent<?>> components;
|
||||
private Set<Set<IDIYComponent<?>>> groups;
|
||||
private Set<Integer> lockedLayers;
|
||||
private Set<Integer> lockedLayers;
|
||||
private Set<IDIYComponent<?>> lockedComponents;
|
||||
private Set<Integer> hiddenLayers;
|
||||
private Font font = DEFAULT_FONT;
|
||||
@@ -75,7 +76,7 @@ public class Project implements Serializable, Cloneable {
|
||||
components = new ArrayList<IDIYComponent<?>>();
|
||||
groups = new HashSet<Set<IDIYComponent<?>>>();
|
||||
lockedLayers = new HashSet<Integer>();
|
||||
hiddenLayers = new HashSet<Integer>();
|
||||
hiddenLayers = new HashSet<Integer>();
|
||||
lockedComponents = new HashSet<IDIYComponent<?>>();
|
||||
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<Set<IDIYComponent<?>>> getGroups() {
|
||||
return groups;
|
||||
}
|
||||
|
||||
public Set<IDIYComponent<?>> getLockedComponents() {
|
||||
if (lockedComponents == null)
|
||||
lockedComponents = new HashSet<IDIYComponent<?>>();
|
||||
return lockedComponents;
|
||||
}
|
||||
|
||||
public Set<IDIYComponent<?>> getLockedComponents() {
|
||||
if (lockedComponents == null)
|
||||
lockedComponents = new HashSet<IDIYComponent<?>>();
|
||||
return lockedComponents;
|
||||
}
|
||||
|
||||
public Set<Integer> 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<?>, IDIYComponent<?>> cloneMap = new HashMap<IDIYComponent<?>, 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;
|
||||
}
|
||||
+44
-44
@@ -19,17 +19,17 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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<String, Object> values;
|
||||
import java.util.Map;
|
||||
|
||||
public class Template {
|
||||
|
||||
private String name;
|
||||
private Map<String, Object> values;
|
||||
private List<Point2D> points;
|
||||
@SuppressWarnings("unused")
|
||||
@Deprecated
|
||||
@@ -41,37 +41,37 @@ public class Template {
|
||||
|
||||
public Template(String name, Map<String, Object> values, List<Point2D> points) {
|
||||
this(name, values, points, LocalDateTime.now());
|
||||
}
|
||||
|
||||
public Template(String name, Map<String, Object> values, List<Point2D> points, LocalDateTime createdOn) {
|
||||
this.name = name;
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
public Template(String name, Map<String, Object> values, List<Point2D> 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<String, Object> getValues() {
|
||||
return values;
|
||||
}
|
||||
|
||||
public void setValues(Map<String, Object> values) {
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
public List<Point2D> getPoints() {
|
||||
return points;
|
||||
}
|
||||
|
||||
public void setPoints(List<Point2D> points) {
|
||||
this.points = points;
|
||||
this.createdOn = createdOn;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Map<String, Object> getValues() {
|
||||
return values;
|
||||
}
|
||||
|
||||
public void setValues(Map<String, Object> values) {
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
public List<Point2D> getPoints() {
|
||||
return points;
|
||||
}
|
||||
|
||||
public void setPoints(List<Point2D> 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;
|
||||
}
|
||||
}
|
||||
+30
-30
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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() {
|
||||
+10
-10
@@ -19,13 +19,13 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
+21
-21
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package org.diylc.core;
|
||||
|
||||
/**
|
||||
+12
-12
@@ -19,15 +19,15 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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,
|
||||
}
|
||||
+44
-43
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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;
|
||||
}
|
||||
+9
-9
@@ -19,13 +19,13 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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();
|
||||
}
|
||||
+25
-24
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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;
|
||||
|
||||
/**
|
||||
+6
-6
@@ -19,9 +19,9 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package org.diylc.core.annotations;
|
||||
|
||||
public @interface ElementLabel {
|
||||
|
||||
public String functionName();
|
||||
}
|
||||
package org.diylc.core.annotations;
|
||||
|
||||
public @interface ElementLabel {
|
||||
|
||||
public String functionName();
|
||||
}
|
||||
+20
-19
@@ -19,23 +19,24 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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<IDIYComponent<?>> 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<IDIYComponent<?>> createIfNeeded(IDIYComponent<?> lastAdded);
|
||||
}
|
||||
+21
-21
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package org.diylc.core.annotations;
|
||||
|
||||
/**
|
||||
+8
-8
@@ -19,12 +19,12 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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 {
|
||||
|
||||
}
|
||||
+9
-9
@@ -19,13 +19,13 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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();
|
||||
}
|
||||
+26
-26
@@ -19,35 +19,35 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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.");
|
||||
}
|
||||
}
|
||||
}
|
||||
+26
-26
@@ -19,35 +19,35 @@
|
||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
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.");
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-1
@@ -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 {
|
||||
|
||||
+5
-3
@@ -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 {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user