mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-07 12:24:58 +10:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8e20f61946 |
@@ -1,52 +0,0 @@
|
||||
name: Java CI Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '17'
|
||||
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@v4
|
||||
with:
|
||||
name: coverage-report
|
||||
path: target/site/jacoco/
|
||||
retention-days: 5
|
||||
|
||||
# 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
|
||||
@@ -29,7 +29,7 @@ DIY Layout Creator (DIYLC) is a specialized software tool designed for hobbyists
|
||||
<li>group components together and treat them as one, e.g. move, edit or delete </li>
|
||||
<li>export the output to image, PDF or printer </li>
|
||||
<li>export PCB trace mask suitable for toner transfer </li>
|
||||
<li>export PCB designs to Gerber for fabrication </li>
|
||||
<li>export the circuit to a SPICE compatible netlist (beta) </li>
|
||||
<li>create a Bill of Materials as a part of the project or export it to few different file formats </li>
|
||||
<li>analyze guitar wirings and show detailed pickup configuration in each switch configuration</li>
|
||||
<li>zoom in/out feature </li>
|
||||
|
||||
Vendored
BIN
Binary file not shown.
Vendored
-28
@@ -1,28 +0,0 @@
|
||||
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
@@ -1,51 +0,0 @@
|
||||
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
|
||||
@@ -1,149 +0,0 @@
|
||||
# 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
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"java.compile.nullAnalysis.mode": "automatic",
|
||||
"java.configuration.updateBuildConfiguration": "interactive"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
[](https://github.com/{owner}/{repo}/actions/workflows/tests.yml)
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="test"/>
|
||||
<classpathentry kind="lib" path="lib/log4j-1.2.15.jar"/>
|
||||
<classpathentry kind="lib" path="lib/junit-4.7.jar"/>
|
||||
<classpathentry kind="lib" path="lib/app-framework.jar"/>
|
||||
<classpathentry kind="lib" path="lib/jettison-1.0.1.jar"/>
|
||||
<classpathentry kind="lib" path="lib/java-http-proxy.jar"/>
|
||||
<classpathentry kind="lib" path="lib/AppleJavaExtensions.jar"/>
|
||||
<classpathentry kind="lib" path="lib/xstream-1.4.19.jar"/>
|
||||
<classpathentry kind="lib" path="lib/guava-31.1-jre.jar"/>
|
||||
<classpathentry kind="lib" path="lib/gerber-writer-api-1.0.0.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
@@ -5,7 +5,13 @@
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
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="${basedir}/src/main/java" />
|
||||
<property name="src.dir" value="src" />
|
||||
|
||||
<property name="lib.dir" value="${basedir}/lib" />
|
||||
<property name="build.dir" value="${basedir}/build" />
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
<?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.
+17
-13
@@ -62,35 +62,39 @@
|
||||
<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>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<version>5.3.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>6.1.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
<version>6.1.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
package org.diylc.config;
|
||||
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
import org.diylc.appframework.miscutils.IConfigurationManager;
|
||||
import org.diylc.core.IView;
|
||||
import org.diylc.presenter.*;
|
||||
import org.diylc.serialization.ProjectFileManager;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.diylc.appframework.simplemq.MessageDispatcher;
|
||||
import org.diylc.common.EventType;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
|
||||
@Configuration
|
||||
public class DIYLCConfig {
|
||||
|
||||
@Primary
|
||||
@Bean
|
||||
public IConfigurationManager configurationManager() {
|
||||
return ConfigurationManager.getInstance();
|
||||
}
|
||||
|
||||
@Primary
|
||||
@Bean
|
||||
public MessageDispatcher<EventType> messageDispatcher() {
|
||||
return new MessageDispatcher<>(true);
|
||||
}
|
||||
|
||||
@Primary
|
||||
@Bean
|
||||
public DrawingService drawingService(
|
||||
MessageDispatcher<EventType> messageDispatcher,
|
||||
IConfigurationManager configManager) {
|
||||
return new DrawingManager(messageDispatcher, configManager);
|
||||
}
|
||||
|
||||
@Primary
|
||||
@Bean
|
||||
public ProjectFileService projectFileService(MessageDispatcher<EventType> messageDispatcher) {
|
||||
return new ProjectFileManager(messageDispatcher);
|
||||
}
|
||||
|
||||
@Primary
|
||||
@Bean
|
||||
public InstantiationService instantiationService() {
|
||||
return new InstantiationManager();
|
||||
}
|
||||
|
||||
@Primary
|
||||
@Bean
|
||||
public VariantService variantService(
|
||||
IConfigurationManager configManager,
|
||||
ProjectFileService projectFileService) {
|
||||
return new VariantManager(configManager, projectFileService.getXStream());
|
||||
}
|
||||
|
||||
@Bean
|
||||
public BuildingBlockService buildingBlockService(
|
||||
IConfigurationManager configManager,
|
||||
ProjectFileService projectFileService,
|
||||
InstantiationService instantiationService) {
|
||||
return new BuildingBlockManager(configManager, projectFileService.getXStream(), instantiationService);
|
||||
}
|
||||
|
||||
@Primary
|
||||
@Bean
|
||||
public Presenter presenter(
|
||||
@Lazy
|
||||
IView view,
|
||||
IConfigurationManager configManager,
|
||||
MessageDispatcher<EventType> messageDispatcher,
|
||||
DrawingService drawingService,
|
||||
ProjectFileService projectFileService,
|
||||
InstantiationService instantiationService,
|
||||
VariantService variantService,
|
||||
BuildingBlockService buildingBlockService) {
|
||||
return new Presenter(
|
||||
view,
|
||||
configManager,
|
||||
messageDispatcher,
|
||||
drawingService,
|
||||
projectFileService,
|
||||
instantiationService,
|
||||
variantService,
|
||||
buildingBlockService,
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package org.diylc.config;
|
||||
|
||||
import org.diylc.appframework.miscutils.IConfigurationManager;
|
||||
import org.diylc.appframework.miscutils.InMemoryConfigurationManager;
|
||||
import org.diylc.appframework.simplemq.MessageDispatcher;
|
||||
import org.diylc.common.EventType;
|
||||
import org.diylc.core.IView;
|
||||
import org.diylc.presenter.*;
|
||||
import org.diylc.serialization.ProjectFileManager;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class DummyViewDIYLCConfig {
|
||||
|
||||
@Bean
|
||||
public IConfigurationManager dummyViewConfigManager() {
|
||||
return InMemoryConfigurationManager.getInstance();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public MessageDispatcher<EventType> dummyViewMessageDispatcher() {
|
||||
return new MessageDispatcher<>(true);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public DrawingService dummyViewDrawingService(
|
||||
@Qualifier("dummyViewMessageDispatcher")
|
||||
MessageDispatcher<EventType> messageDispatcher,
|
||||
@Qualifier("dummyViewConfigManager")
|
||||
IConfigurationManager configManager) {
|
||||
return new DrawingManager(messageDispatcher, configManager);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ProjectFileService dummyViewProjectFileService(MessageDispatcher<EventType> messageDispatcher) {
|
||||
return new ProjectFileManager(messageDispatcher);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public InstantiationService dummyViewInstantiationService() {
|
||||
return new InstantiationManager();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public VariantService dummyViewVariantService(
|
||||
@Qualifier("dummyViewConfigManager")
|
||||
IConfigurationManager configManager,
|
||||
@Qualifier("dummyViewProjectFileService")
|
||||
ProjectFileService projectFileService) {
|
||||
return new VariantManager(configManager, projectFileService.getXStream());
|
||||
}
|
||||
|
||||
@Bean
|
||||
public BuildingBlockService dummyViewBuildingBlockService(
|
||||
@Qualifier("dummyViewConfigManager")
|
||||
IConfigurationManager configManager,
|
||||
@Qualifier("dummyViewProjectFileService")
|
||||
ProjectFileService projectFileService,
|
||||
@Qualifier("dummyViewInstantiationService")
|
||||
InstantiationService instantiationService) {
|
||||
return new BuildingBlockManager(configManager, projectFileService.getXStream(), instantiationService);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Presenter dummyViewPresenter(
|
||||
@Qualifier("dummyView")
|
||||
IView view,
|
||||
@Qualifier("dummyViewConfigManager")
|
||||
IConfigurationManager configManager,
|
||||
@Qualifier("dummyViewMessageDispatcher")
|
||||
MessageDispatcher<EventType> messageDispatcher,
|
||||
@Qualifier("dummyViewDrawingService")
|
||||
DrawingService drawingService,
|
||||
@Qualifier("dummyViewProjectFileService")
|
||||
ProjectFileService projectFileService,
|
||||
@Qualifier("dummyViewInstantiationService")
|
||||
InstantiationService instantiationService,
|
||||
@Qualifier("dummyViewVariantService")
|
||||
VariantService variantService,
|
||||
@Qualifier("dummyViewBuildingBlockService")
|
||||
BuildingBlockService buildingBlockService) {
|
||||
return new Presenter(
|
||||
view,
|
||||
configManager,
|
||||
messageDispatcher,
|
||||
drawingService,
|
||||
projectFileService,
|
||||
instantiationService,
|
||||
variantService,
|
||||
buildingBlockService,
|
||||
false
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package org.diylc.config;
|
||||
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
import org.diylc.appframework.miscutils.IConfigurationManager;
|
||||
import org.diylc.appframework.miscutils.InMemoryConfigurationManager;
|
||||
import org.diylc.appframework.simplemq.MessageDispatcher;
|
||||
import org.diylc.common.EventType;
|
||||
import org.diylc.core.IView;
|
||||
import org.diylc.presenter.*;
|
||||
import org.diylc.serialization.ProjectFileManager;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
|
||||
@Configuration
|
||||
public class ImportFileDIYLCConfig {
|
||||
|
||||
@Bean
|
||||
public IConfigurationManager importFileConfigManager() {
|
||||
return InMemoryConfigurationManager.getInstance();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public MessageDispatcher<EventType> importFileMessageDispatcher() {
|
||||
return new MessageDispatcher<>(true);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public DrawingService importFileDrawingService(
|
||||
@Qualifier("importFileMessageDispatcher")
|
||||
MessageDispatcher<EventType> messageDispatcher,
|
||||
@Qualifier("importFileConfigManager")
|
||||
IConfigurationManager configManager) {
|
||||
return new DrawingManager(messageDispatcher, configManager);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ProjectFileService importFileProjectFileService(MessageDispatcher<EventType> messageDispatcher) {
|
||||
return new ProjectFileManager(messageDispatcher);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public InstantiationService importFileInstantiationService() {
|
||||
return new InstantiationManager();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public VariantService importFileVariantService(
|
||||
@Qualifier("importFileConfigManager")
|
||||
IConfigurationManager configManager,
|
||||
@Qualifier("importFileProjectFileService")
|
||||
ProjectFileService projectFileService) {
|
||||
return new VariantManager(configManager, projectFileService.getXStream());
|
||||
}
|
||||
|
||||
@Bean
|
||||
public BuildingBlockService importFileBuildingBlockService(
|
||||
@Qualifier("importFileConfigManager")
|
||||
IConfigurationManager configManager,
|
||||
@Qualifier("importFileProjectFileService")
|
||||
ProjectFileService projectFileService,
|
||||
@Qualifier("importFileInstantiationService")
|
||||
InstantiationService instantiationService) {
|
||||
return new BuildingBlockManager(configManager, projectFileService.getXStream(), instantiationService);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Presenter importFilePresenter(
|
||||
@Qualifier("importFileView")
|
||||
IView view,
|
||||
@Qualifier("importFileConfigManager")
|
||||
IConfigurationManager configManager,
|
||||
@Qualifier("importFileMessageDispatcher")
|
||||
MessageDispatcher<EventType> messageDispatcher,
|
||||
@Qualifier("importFileDrawingService")
|
||||
DrawingService drawingService,
|
||||
@Qualifier("importFileProjectFileService")
|
||||
ProjectFileService projectFileService,
|
||||
@Qualifier("importFileInstantiationService")
|
||||
InstantiationService instantiationService,
|
||||
@Qualifier("importFileVariantService")
|
||||
VariantService variantService,
|
||||
@Qualifier("importFileBuildingBlockService")
|
||||
BuildingBlockService buildingBlockService) {
|
||||
return new Presenter(
|
||||
view,
|
||||
configManager,
|
||||
messageDispatcher,
|
||||
drawingService,
|
||||
projectFileService,
|
||||
instantiationService,
|
||||
variantService,
|
||||
buildingBlockService,
|
||||
false
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package org.diylc.config;
|
||||
|
||||
import org.diylc.appframework.miscutils.IConfigurationManager;
|
||||
import org.diylc.appframework.miscutils.InMemoryConfigurationManager;
|
||||
import org.diylc.appframework.simplemq.MessageDispatcher;
|
||||
import org.diylc.common.EventType;
|
||||
import org.diylc.core.IView;
|
||||
import org.diylc.presenter.*;
|
||||
import org.diylc.serialization.ProjectFileManager;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class LoadlineDIYLCConfig {
|
||||
|
||||
@Bean
|
||||
public IConfigurationManager loadlineConfigManager() {
|
||||
return InMemoryConfigurationManager.getInstance();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public MessageDispatcher<EventType> loadlineMessageDispatcher() {
|
||||
return new MessageDispatcher<>(true);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public DrawingService loadlineDrawingService(
|
||||
@Qualifier("loadlineMessageDispatcher")
|
||||
MessageDispatcher<EventType> messageDispatcher,
|
||||
@Qualifier("loadlineConfigManager")
|
||||
IConfigurationManager configManager) {
|
||||
return new DrawingManager(messageDispatcher, configManager);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ProjectFileService loadlineProjectFileService(MessageDispatcher<EventType> messageDispatcher) {
|
||||
return new ProjectFileManager(messageDispatcher);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public InstantiationService loadlineInstantiationService() {
|
||||
return new InstantiationManager();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public VariantService loadlineVariantService(
|
||||
@Qualifier("loadlineConfigManager")
|
||||
IConfigurationManager configManager,
|
||||
@Qualifier("loadlineProjectFileService")
|
||||
ProjectFileService projectFileService) {
|
||||
return new VariantManager(configManager, projectFileService.getXStream());
|
||||
}
|
||||
|
||||
@Bean
|
||||
public BuildingBlockService loadlineBuildingBlockService(
|
||||
@Qualifier("loadlineConfigManager")
|
||||
IConfigurationManager configManager,
|
||||
@Qualifier("loadlineProjectFileService")
|
||||
ProjectFileService projectFileService,
|
||||
@Qualifier("loadlineInstantiationService")
|
||||
InstantiationService instantiationService) {
|
||||
return new BuildingBlockManager(configManager, projectFileService.getXStream(), instantiationService);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Presenter loadlinePresenter(
|
||||
@Qualifier("loadlineView")
|
||||
IView view,
|
||||
@Qualifier("loadlineConfigManager")
|
||||
IConfigurationManager configManager,
|
||||
@Qualifier("loadlineMessageDispatcher")
|
||||
MessageDispatcher<EventType> messageDispatcher,
|
||||
@Qualifier("loadlineDrawingService")
|
||||
DrawingService drawingService,
|
||||
@Qualifier("loadlineProjectFileService")
|
||||
ProjectFileService projectFileService,
|
||||
@Qualifier("loadlineInstantiationService")
|
||||
InstantiationService instantiationService,
|
||||
@Qualifier("loadlineVariantService")
|
||||
VariantService variantService,
|
||||
@Qualifier("loadlineBuildingBlockService")
|
||||
BuildingBlockService buildingBlockService) {
|
||||
return new Presenter(
|
||||
view,
|
||||
configManager,
|
||||
messageDispatcher,
|
||||
drawingService,
|
||||
projectFileService,
|
||||
instantiationService,
|
||||
variantService,
|
||||
buildingBlockService,
|
||||
false
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,281 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* 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.netlist;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.diylc.core.IDIYComponent;
|
||||
|
||||
public abstract class NetlistAnalyzer {
|
||||
|
||||
public NetlistAnalyzer() {
|
||||
}
|
||||
|
||||
public List<Summary> summarize(List<Netlist> netlists, Node preferredOutput)
|
||||
throws TreeException {
|
||||
Map<String, Summary> summaries = new HashMap<String, Summary>();
|
||||
for (Netlist n : netlists) {
|
||||
Summary s = summarize(n, preferredOutput);
|
||||
if (summaries.containsKey(s.getSummary()))
|
||||
summaries.get(s.getSummary()).append(n);
|
||||
else
|
||||
summaries.put(s.getSummary(), s);
|
||||
}
|
||||
|
||||
List<Summary> res = new ArrayList<Summary>(summaries.values());
|
||||
Collections.sort(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
protected abstract Summary summarize(Netlist netlist, Node preferredOutput) throws TreeException;
|
||||
|
||||
public Tree constructTreeBetween(Netlist netlist, Node nodeA, Node nodeB) {
|
||||
Tree tree = new Tree(TreeConnectionType.Parallel);
|
||||
connectNodes(netlist, nodeA, nodeB, tree.getChildren(), new Tree(TreeConnectionType.Series),
|
||||
new HashSet<Node>());
|
||||
|
||||
return tree;
|
||||
}
|
||||
|
||||
protected void connectNodes(Netlist netlist, Node nodeA, Node nodeB, List<Tree> concurrentPaths,
|
||||
Tree currentPath, Set<Node> visited) {
|
||||
if (nodeA == nodeB) {
|
||||
concurrentPaths.add(currentPath);
|
||||
return;
|
||||
}
|
||||
|
||||
Group groupA = findGroup(netlist, nodeA);
|
||||
if (groupA == null)
|
||||
return;
|
||||
|
||||
if (groupA.getNodes().contains(nodeB)) {
|
||||
concurrentPaths.add(currentPath);
|
||||
return;
|
||||
}
|
||||
|
||||
Set<Node> pathVisited = new HashSet<>(visited);
|
||||
pathVisited.add(nodeA);
|
||||
|
||||
// First collect all immediate next nodes and their paths
|
||||
Map<Node, List<Tree>> nextNodes = new HashMap<>();
|
||||
for (Node n : groupA.getNodes()) {
|
||||
if (pathVisited.contains(n))
|
||||
continue;
|
||||
|
||||
IDIYComponent<?> c = n.getComponent();
|
||||
for (int i = 0; i < c.getControlPointCount(); i++) {
|
||||
int targetPoint = i;
|
||||
int sourcePoint = n.getPointIndex();
|
||||
|
||||
if (targetPoint == sourcePoint)
|
||||
continue;
|
||||
|
||||
if (c.getInternalLinkName(targetPoint, sourcePoint) != null) {
|
||||
Node newNodeA = new Node(c, targetPoint, n.getZIndex());
|
||||
if (pathVisited.contains(newNodeA))
|
||||
continue;
|
||||
|
||||
try {
|
||||
Tree newPath = (Tree) currentPath.clone();
|
||||
TreeLeaf leaf = new TreeLeaf(c, targetPoint, sourcePoint);
|
||||
Tree newItem = new Tree(leaf);
|
||||
|
||||
if (!newPath.getChildren().contains(newItem)) {
|
||||
newPath.getChildren().add(newItem);
|
||||
nextNodes.computeIfAbsent(newNodeA, k -> new ArrayList<>()).add(newPath);
|
||||
}
|
||||
} catch (CloneNotSupportedException e) {
|
||||
// Skip this path if clone fails
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Now explore each next node
|
||||
List<Tree> allPaths = new ArrayList<>();
|
||||
for (Map.Entry<Node, List<Tree>> entry : nextNodes.entrySet()) {
|
||||
for (Tree path : entry.getValue()) {
|
||||
List<Tree> branchPaths = new ArrayList<>();
|
||||
connectNodes(netlist, entry.getKey(), nodeB, branchPaths, path, pathVisited);
|
||||
allPaths.addAll(branchPaths);
|
||||
}
|
||||
}
|
||||
|
||||
if (allPaths.isEmpty())
|
||||
return;
|
||||
|
||||
if (allPaths.size() > 1) {
|
||||
// Find common prefix among all paths
|
||||
List<Tree> commonPrefix = findCommonElements(allPaths, true, false);
|
||||
|
||||
// Create a new tree for the merged result
|
||||
Tree mergedTree = new Tree(TreeConnectionType.Series);
|
||||
|
||||
// Add common prefix elements
|
||||
for (Tree prefixElement : commonPrefix) {
|
||||
mergedTree.getChildren().add(prefixElement);
|
||||
}
|
||||
|
||||
// Extract unique parts
|
||||
List<Tree> uniqueParts = new ArrayList<>();
|
||||
for (Tree path : allPaths) {
|
||||
Tree uniquePart = extractUniquePart(path, commonPrefix.size(), 0);
|
||||
if (uniquePart != null) {
|
||||
if (uniquePart.getChildren().size() == 1) {
|
||||
uniqueParts.add(uniquePart.getChildren().get(0));
|
||||
} else {
|
||||
uniqueParts.add(uniquePart);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create parallel section for unique parts
|
||||
if (!uniqueParts.isEmpty()) {
|
||||
Tree parallelSection = new Tree(TreeConnectionType.Parallel);
|
||||
parallelSection.getChildren().addAll(uniqueParts);
|
||||
|
||||
// Add parallel section to series container
|
||||
Tree parallelContainer = new Tree(TreeConnectionType.Series);
|
||||
parallelContainer.getChildren().add(parallelSection);
|
||||
mergedTree.getChildren().add(parallelContainer);
|
||||
}
|
||||
|
||||
concurrentPaths.add(mergedTree);
|
||||
} else {
|
||||
concurrentPaths.add(allPaths.get(0));
|
||||
}
|
||||
}
|
||||
|
||||
private List<Tree> findCommonElements(List<Tree> paths, boolean fromStart, boolean backward) {
|
||||
if (paths.isEmpty())
|
||||
return new ArrayList<>();
|
||||
|
||||
List<Tree> common = new ArrayList<>();
|
||||
Tree template = paths.get(0);
|
||||
int maxLength = template.getChildren().size();
|
||||
|
||||
for (int i = 0; i < maxLength; i++) {
|
||||
int index = fromStart ?
|
||||
(backward ? template.getChildren().size() - i - 1 : i) :
|
||||
(backward ? i : template.getChildren().size() - i - 1);
|
||||
|
||||
if (index < 0 || index >= template.getChildren().size())
|
||||
break;
|
||||
|
||||
Tree element = template.getChildren().get(index);
|
||||
boolean isCommon = true;
|
||||
|
||||
for (int j = 1; j < paths.size(); j++) {
|
||||
Tree current = paths.get(j);
|
||||
if (current.getChildren().size() <= i || index >= current.getChildren()
|
||||
.size() || !current.getChildren().get(index).equals(element)) {
|
||||
isCommon = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isCommon) {
|
||||
common.add(element);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return common;
|
||||
}
|
||||
|
||||
private Tree extractUniquePart(Tree path, int prefixSize, int suffixSize) {
|
||||
if (path.getChildren().size() <= prefixSize + suffixSize)
|
||||
return null;
|
||||
|
||||
Tree uniquePart = new Tree(TreeConnectionType.Series);
|
||||
for (int i = prefixSize; i < path.getChildren().size() - suffixSize; i++) {
|
||||
uniquePart.getChildren().add(path.getChildren().get(i));
|
||||
}
|
||||
|
||||
return uniquePart.getChildren().isEmpty() ? null : uniquePart;
|
||||
}
|
||||
|
||||
protected Group findGroup(Netlist netlist, Node node) {
|
||||
for (Group g : netlist.getGroups())
|
||||
if (g.getNodes().contains(node))
|
||||
return g;
|
||||
return null;
|
||||
}
|
||||
|
||||
protected List<Node> find(Set<String> typeNames, String nodeName, Netlist netlist) {
|
||||
List<Node> res = new ArrayList<Node>();
|
||||
for (Group g : netlist.getGroups()) {
|
||||
for (Node n : g.getNodes()) {
|
||||
if (typeNames.contains(n.getComponent().getClass()
|
||||
.getCanonicalName()) && (nodeName == null || n.getDisplayName()
|
||||
.equalsIgnoreCase(nodeName))) {
|
||||
res.add(n);
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public static List<Set<IDIYComponent<?>>> extractComponentGroups(List<Netlist> netlists) {
|
||||
List<Set<IDIYComponent<?>>> res = new ArrayList<Set<IDIYComponent<?>>>();
|
||||
for (Netlist n : netlists) {
|
||||
res.addAll(extractComponentGroups(n));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public static List<Set<IDIYComponent<?>>> extractComponentGroups(Netlist netlist) {
|
||||
List<Set<IDIYComponent<?>>> res = new ArrayList<Set<IDIYComponent<?>>>();
|
||||
for (Group g : netlist.getGroups()) {
|
||||
Set<IDIYComponent<?>> components = new HashSet<IDIYComponent<?>>();
|
||||
for (Node n : g.getNodes())
|
||||
components.add(n.getComponent());
|
||||
res.add(components);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
protected int find(Node node, List<Group> groups) {
|
||||
for (int i = 0; i < groups.size(); i++)
|
||||
if (groups.get(i).getNodes().contains(node))
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
protected boolean intersect(List<Group> groups, Node node) {
|
||||
for (Group g : groups)
|
||||
if (g.getNodes().contains(node))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
protected Node intersect(List<Group> groups, Group group) {
|
||||
for (Group g : groups)
|
||||
for (Node node : group.getNodes())
|
||||
if (g.getNodes().contains(node))
|
||||
return node;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package org.diylc.utils;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.diylc.lang.LangUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ResourceUtils {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(LangUtil.class);
|
||||
|
||||
public static List<File> getResourceFiles(String dir) {
|
||||
List<File> files = new ArrayList<>();
|
||||
URL url = LangUtil.class.getResource("/" + dir);
|
||||
Path path = null;
|
||||
try {
|
||||
path = Paths.get(url.toURI());
|
||||
Files.walk(path, 5).forEach(p -> {
|
||||
if (!p.toFile().isDirectory()) {
|
||||
files.add(p.toFile());
|
||||
}
|
||||
});
|
||||
} catch (URISyntaxException e) {
|
||||
LOG.error("Error loading language file", e);
|
||||
} catch (IOException e) {
|
||||
LOG.error("Error loading language file", e);
|
||||
}
|
||||
return files;
|
||||
}
|
||||
}
|
||||
+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;
|
||||
+42
-44
@@ -1,43 +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.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 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 org.diylc.plugins.cloud.model.IServiceAPI;
|
||||
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;
|
||||
@@ -57,20 +55,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);
|
||||
}
|
||||
+42
-43
@@ -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,56 +28,55 @@ 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() {
|
||||
@@ -86,5 +85,5 @@ public class ComponentTransferable implements Transferable, Serializable {
|
||||
|
||||
public Set<Set<IDIYComponent<?>>> getGroups() {
|
||||
return groups;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-1
@@ -25,7 +25,6 @@ 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 {
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.diylc.common;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import java.util.EnumSet;
|
||||
|
||||
public abstract class AbstractPlugin implements IPlugIn {
|
||||
|
||||
protected IPlugInPort plugInPort;
|
||||
|
||||
@Override
|
||||
public void connect(IPlugInPort plugInPort) {
|
||||
this.plugInPort = plugInPort;
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract EnumSet<EventType> getSubscribedEventTypes();
|
||||
|
||||
@Override
|
||||
public abstract void processMessage(EventType eventType, Object... params);
|
||||
}
|
||||
+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;
|
||||
|
||||
}
|
||||
+22
-23
@@ -1,28 +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.common;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import java.util.Collection;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
|
||||
public class BuildingBlock {
|
||||
-1
@@ -23,7 +23,6 @@ package org.diylc.common;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.diylc.core.IDIYComponent;
|
||||
|
||||
public class BuildingBlockPackage {
|
||||
-1
@@ -20,7 +20,6 @@ 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,7 +5,6 @@ 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;
|
||||
}
|
||||
+28
-29
@@ -1,29 +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.awt.Rectangle;
|
||||
import java.awt.geom.Point2D;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.geom.Point2D;
|
||||
import org.diylc.core.Project;
|
||||
|
||||
/**
|
||||
@@ -85,7 +84,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,
|
||||
@@ -102,9 +101,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);
|
||||
}
|
||||
+22
-23
@@ -19,27 +19,26 @@
|
||||
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,7 +22,6 @@
|
||||
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,7 +22,6 @@
|
||||
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);
|
||||
}
|
||||
+116
-118
@@ -1,48 +1,47 @@
|
||||
/*
|
||||
|
||||
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
|
||||
@@ -61,11 +60,10 @@ 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";
|
||||
@@ -77,27 +75,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;
|
||||
@@ -116,7 +114,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
|
||||
@@ -128,9 +126,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
|
||||
*/
|
||||
@@ -147,8 +145,8 @@ public interface IPlugInPort extends ISelectionProcessor, IMouseProcessor, IKeyP
|
||||
* Loads specified {@link Project}.
|
||||
*
|
||||
* @param project
|
||||
* @param freshStart
|
||||
* @param filename file name when loading from a file
|
||||
* @param freshStart
|
||||
* @param optional file name when loading from a file
|
||||
*/
|
||||
void loadProject(Project project, boolean freshStart, String filename);
|
||||
|
||||
@@ -170,14 +168,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);
|
||||
|
||||
/**
|
||||
@@ -212,9 +210,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);
|
||||
@@ -240,20 +238,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);
|
||||
@@ -319,8 +317,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);
|
||||
@@ -375,29 +373,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,7 +22,6 @@
|
||||
package org.diylc.common;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.Project;
|
||||
|
||||
+70
-71
@@ -1,34 +1,33 @@
|
||||
/*
|
||||
|
||||
DIY Layout Creator (DIYLC).
|
||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||
|
||||
This file is part of DIYLC.
|
||||
|
||||
DIYLC is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DIYLC is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DIYLC. If not, see <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 {
|
||||
@@ -38,20 +37,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);
|
||||
@@ -60,7 +59,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
|
||||
*/
|
||||
@@ -109,8 +108,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
|
||||
*/
|
||||
@@ -123,36 +122,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;
|
||||
|
||||
/**
|
||||
+25
-26
@@ -19,38 +19,37 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+30
-31
@@ -1,29 +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.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import org.diylc.core.IPropertyValidator;
|
||||
|
||||
/**
|
||||
@@ -75,19 +74,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,7 +23,6 @@ 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,7 +22,6 @@
|
||||
package org.diylc.components;
|
||||
|
||||
import java.awt.Shape;
|
||||
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.core.Angle;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
+104
-105
@@ -1,41 +1,40 @@
|
||||
/*
|
||||
|
||||
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.
|
||||
@@ -58,14 +57,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
|
||||
@@ -89,13 +88,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();
|
||||
}
|
||||
@@ -108,17 +107,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;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,9 +136,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))) {
|
||||
@@ -172,7 +171,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)) {
|
||||
@@ -192,7 +191,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()));
|
||||
}
|
||||
@@ -200,7 +199,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());
|
||||
}
|
||||
@@ -213,7 +212,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) {
|
||||
@@ -230,7 +229,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 {
|
||||
@@ -252,45 +251,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
|
||||
}
|
||||
}
|
||||
+2
-4
@@ -30,10 +30,6 @@ 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;
|
||||
@@ -45,6 +41,8 @@ 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;
|
||||
}
|
||||
}
|
||||
+23
-24
@@ -1,29 +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.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 {
|
||||
+25
-26
@@ -1,30 +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.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 {
|
||||
@@ -47,7 +46,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);
|
||||
+25
-26
@@ -1,31 +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.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,
|
||||
}
|
||||
+70
-71
@@ -1,32 +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.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;
|
||||
|
||||
/**
|
||||
@@ -51,7 +50,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;
|
||||
|
||||
@@ -112,37 +111,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.
|
||||
*/
|
||||
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
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
boolean canPointMoveFreely(int pointIndex);
|
||||
|
||||
/**
|
||||
@@ -185,18 +184,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;
|
||||
}
|
||||
+26
-27
@@ -1,30 +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.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;
|
||||
|
||||
|
||||
@@ -56,8 +55,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();
|
||||
+91
-92
@@ -1,42 +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.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;
|
||||
|
||||
/**
|
||||
@@ -63,11 +62,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;
|
||||
@@ -76,7 +75,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");
|
||||
@@ -138,17 +137,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;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -167,12 +166,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() {
|
||||
@@ -276,36 +275,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;
|
||||
}
|
||||
@@ -341,7 +340,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<?>>();
|
||||
@@ -362,10 +361,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;
|
||||
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) {
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user