Compare commits

..

58 Commits

Author SHA1 Message Date
bancika 654eaed88a release 2011-03-03 21:01:58 +00:00
bancika 746b5fbe1a 2011-03-03 20:56:56 +00:00
bancika 365c195091 fix for drawing area and optimization 2011-03-02 18:14:39 +00:00
bancika d89a500a5f fix for drawing area and optimization 2011-03-02 18:13:34 +00:00
bancika 085732fb2c 2011-03-01 00:17:53 +00:00
bancika eab7654883 Curved traces and wires can have 2, 3 and 4 control points 2011-02-28 00:09:13 +00:00
bancika 5488657984 config menu order 2011-02-27 23:38:11 +00:00
bancika 1a256716db tube socket improvement 2011-02-27 23:30:05 +00:00
bancika 2b9c76e876 add file version info
improve image serialization
serialize points referenced in inches
2011-02-27 23:26:11 +00:00
bancika 5ae8a3477e add file version info
improve image serialization
serialize points referenced in inches
2011-02-27 23:23:51 +00:00
bancika 209e970c00 catch drag end outside the area 2011-02-27 22:56:40 +00:00
bancika ae96fb9eef label has editable font 2011-02-27 21:58:57 +00:00
bancika 401f2b5e6f label has editable font 2011-02-27 21:56:08 +00:00
bancika e2da0b884d vertical vero board 2011-02-27 20:48:18 +00:00
bancika bcf390b888 switchable wheel zoom 2011-02-27 19:25:39 +00:00
bancika 144e8f0cfe standing resistors, capacitors and diodes 2011-02-27 19:09:15 +00:00
bancika 84d744a80b switchable wheel zoom 2011-02-27 18:34:33 +00:00
bancika 5430ca71a3 added 6 pin IC 2011-02-26 21:12:45 +00:00
bancika 4665d5d42e added tube 2011-02-26 21:05:40 +00:00
bancika 275918d079 dnd collision improvement 2011-02-26 15:35:53 +00:00
bancika a83093519f 2011-02-26 11:30:05 +00:00
bancika 2e14929eb1 send to back/front renamed 2011-02-26 11:28:40 +00:00
bancika a0b7cdc30e auto-save added 2011-02-26 11:26:49 +00:00
bancika ab5c9ad143 code cleanup 2011-02-24 00:05:27 +00:00
bancika 4154225e71 auto-edit mode 2011-02-24 00:02:32 +00:00
bancika 3856af3e18 continuous component creation 2011-02-23 23:44:00 +00:00
bancika 80e7ebcbe9 auto-create pads 2011-02-23 20:42:40 +00:00
bancika abdf02eac8 configurable snap to grid 2011-02-18 22:17:03 +00:00
bancika 746aadd8a2 improve bring to front/send to back 2011-02-18 13:17:56 +00:00
bancika ac4496040f improve bring to front/send to back 2011-02-18 13:16:58 +00:00
bancika d810096030 relax logging 2011-02-16 19:10:57 +00:00
bancika 4727017be7 fix for default browser 2011-02-15 20:36:18 +00:00
bancika b2dae15ee6 fix for default browser 2011-02-15 19:18:01 +00:00
bancika 56e112ff81 don't show grid on the thumbnail 2011-02-13 11:46:53 +00:00
bancika 6f5926e18e removed unused theme members 2011-02-13 09:43:27 +00:00
bancika b1f4773b10 2011-02-12 20:59:04 +00:00
bancika e5d33fb80d switchable sticky points
added themes
fixed ruler precision
improved board rendering
2011-02-12 20:35:09 +00:00
bancika b8545d27a1 line tracing fix 2011-02-06 20:38:21 +00:00
bancika 70ac30473b use clip to improve performance 2011-02-06 18:27:50 +00:00
bancika 4774e97ba2 use clip to improve performance 2011-02-06 18:22:30 +00:00
bancika de7378c722 2011-02-06 16:23:29 +00:00
bancika e2b3ed1b0e configurable render quality 2011-02-06 16:01:57 +00:00
bancika 99d38feb1c improved speed 2011-02-03 23:42:07 +00:00
bancika a561f6a3f9 tweaked boards 2011-02-03 23:10:23 +00:00
bancika 6eee1525ee better scaling
added marshall board and trimmer
2011-02-03 21:47:16 +00:00
bancika 02d38bed01 added eyelet/turret 2011-01-31 22:47:21 +00:00
bancika b96bad2688 cleanup component area map on loading
fixed lead area mapping bug
2011-01-31 22:05:05 +00:00
bancika 12ca93e2c9 fixed color code rounding 2011-01-31 21:49:01 +00:00
bancika d9b9542883 configurable jumper color 2011-01-31 20:03:41 +00:00
bancika 9e04cff806 fixed lead alignment issue 2011-01-31 20:03:22 +00:00
bancika 16600328cc copy paste doesn't work for some components 2011-01-31 19:32:18 +00:00
bancika 85d7d8a450 fixed lead alignment issue 2011-01-31 00:19:57 +00:00
bancika f358b5d87b fixed lead alignment issue 2011-01-31 00:18:39 +00:00
bancika fa02280292 code cleanup 2011-01-30 23:45:25 +00:00
bancika 8ea53b6876 added capacitor symbol 2011-01-30 23:35:07 +00:00
bancika 4d6e994555 added resistor wattage and capacitor voltage 2011-01-30 21:50:24 +00:00
bancika 10581c51fb added abstract class for leaded schematic symbols and resistor symbol 2011-01-30 21:33:08 +00:00
bancika 2cf6b573a7 added abstract class for leaded schematic symbols and resistor symbol 2011-01-30 21:31:42 +00:00
273 changed files with 1576 additions and 13459 deletions
+1 -1
View File
@@ -2,8 +2,8 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/DIYLC"/>
<classpathentry kind="lib" path="lib/xstream-1.3.1.jar"/>
<classpathentry kind="lib" path="lib/log4j-1.2.15.jar"/>
<classpathentry kind="lib" path="lib/diylc.jar" sourcepath="/DIYLC"/>
<classpathentry kind="output" path="bin"/>
</classpath>
View File
-17
View File
@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="test"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="lib/log4j-1.2.15.jar"/>
<classpathentry kind="lib" path="lib/xstream-1.3.1.jar"/>
<classpathentry kind="lib" path="lib/junit-4.7.jar"/>
<classpathentry kind="lib" path="lib/iText-2.1.7.jar"/>
<classpathentry kind="lib" path="lib/cloning-1.5.jar"/>
<classpathentry kind="lib" path="lib/objenesis-1.1.jar"/>
<classpathentry kind="lib" path="lib/bancika-gui-framework.jar"/>
<classpathentry kind="lib" path="lib/jettison-1.0.1.jar"/>
<classpathentry kind="lib" path="lib/poi-3.5-FINAL-20090928.jar"/>
<classpathentry kind="lib" path="library/main.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
-17
View File
@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>DIYLC</name>
<comment></comment>
<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>
File diff suppressed because one or more lines are too long
-15
View File
@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<stringAttribute key="bad_container_name" value="\DIYLC\r"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/DIYLC/src/org/diylc/DIYLCStarter.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"/>
<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;sourceLookupDirector&gt;&#13;&#10;&lt;sourceContainers duplicates=&quot;false&quot;&gt;&#13;&#10;&lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;javaProject name=&amp;quot;Library&amp;quot;/&amp;gt;&amp;#13;&amp;#10;&quot; typeId=&quot;org.eclipse.jdt.launching.sourceContainer.javaProject&quot;/&gt;&#13;&#10;&lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;javaProject name=&amp;quot;DIYLC&amp;quot;/&amp;gt;&amp;#13;&amp;#10;&quot; typeId=&quot;org.eclipse.jdt.launching.sourceContainer.javaProject&quot;/&gt;&#13;&#10;&lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;default/&amp;gt;&amp;#13;&amp;#10;&quot; typeId=&quot;org.eclipse.debug.core.containerType.default&quot;/&gt;&#13;&#10;&lt;/sourceContainers&gt;&#13;&#10;&lt;/sourceLookupDirector&gt;&#13;&#10;"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.diylc.DIYLCStarter"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="DIYLC"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms256m -Xmx512m"/>
</launchConfiguration>
-78
View File
@@ -1,78 +0,0 @@
<project name="diylc" basedir="." default="jar">
<property name="src.dir" value="src" />
<property name="lib.dir" value="${basedir}/lib" />
<property name="build.dir" value="${basedir}/build" />
<property name="jar.dir" value="${build.dir}/jar" />
<property name="report.dir" value="${build.dir}/junitreport" />
<property name="main.class" value="org.diylc.DIYLCStarter" />
<property name="classes.dir" value="${build.dir}/temp/${ant.project.name}/classes" />
<property name="test.classes.dir" value="${build.dir}/temp/${ant.project.name}/test.classes" />
<target name="clean">
<delete dir="${build.dir}" />
</target>
<!--change src dir-->
<target name="compile">
<mkdir dir="${classes.dir}" />
<echo>Compile with JDK ${java.runtime.version}</echo>
<javac encoding="8859_1" srcdir="${src.dir}" destdir="${classes.dir}" classpathref="class.path" />
</target>
<target name="resource.copy">
<copy todir="${classes.dir}">
<fileset dir="${src.dir}">
<exclude name="**/*.java" />
</fileset>
</copy>
</target>
<target name="lib.copy">
<copy todir="${jar.dir}/lib" overwrite="true">
<fileset dir="${basedir}/lib">
<exclude name="**/*dll" />
</fileset>
</copy>
<copy todir="${jar.dir}/library" overwrite="true">
<fileset dir="${basedir}/library">
<exclude name="**/*dll" />
</fileset>
</copy>
<copy todir="${jar.dir}" overwrite="true">
<fileset dir="${basedir}/lib/" includes="**/*.dll" />
</copy>
</target>
<path id="class.path">
<fileset dir="${basedir}">
<include name="lib/**/*.jar" />
<include name="library/**/*.jar" />
</fileset>
</path>
<manifestclasspath jarfile="${ant.project.name}.jar" property="manifest.class.path">
<classpath refid="class.path" />
</manifestclasspath>
<target name="jar" depends="clean, lib.copy, resource.copy, compile">
<jar destfile="${jar.dir}/${ant.project.name}.jar" basedir="${classes.dir}">
<manifest>
<attribute name="Built-By" value="${user.name}" />
<attribute name="Main-Class" value="${main.class}" />
<attribute name="Class-Path" value="${manifest.class.path}" />
</manifest>
</jar>
</target>
<target name="javadoc">
<javadoc access="public" author="true" classpathref="class.path" destdir="doc" nodeprecated="false" nodeprecatedlist="false" noindex="false" nonavbar="false" notree="false" source="1.6" splitindex="true" use="true" version="true">
<fileset dir="${src.dir}">
<exclude name="**\.svn\**" />
<include name="**/*.java" />
</fileset>
</javadoc>
</target>
</project>
-2
View File
@@ -1,2 +0,0 @@
#org.diylc.utils.Constants.CANVAS_COLOR=#005D96
#org.diylc.utils.Constants.GRID_COLOR=#FFFFFF
-22
View File
@@ -1,22 +0,0 @@
<map>
<entry>
<string>lastPath</string>
<string>C:\Documents and Settings\Branislav Stojkovic\Desktop\oldFiles</string>
</entry>
<entry>
<string>zoom</string>
<double>1.0</double>
</entry>
<entry>
<string>metric</string>
<boolean>true</boolean>
</entry>
<entry>
<string>showTemplatesAtStartup</string>
<boolean>false</boolean>
</entry>
<entry>
<string>default.org.diylc.components.semiconductors.TransistorTO92:Orientation</string>
<org.diylc.common.Orientation>DEFAULT</org.diylc.common.Orientation>
</entry>
</map>
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.
Binary file not shown.
-74
View File
@@ -1,74 +0,0 @@
package org.diylc;
import java.io.FileInputStream;
import java.net.URL;
import java.util.Properties;
import javax.swing.UIManager;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
import org.diylc.presenter.Presenter;
import org.diylc.swing.gui.MainFrame;
import org.diylc.swing.gui.TemplateDialog;
import com.diyfever.gui.miscutils.ConfigurationManager;
import com.diyfever.gui.miscutils.PropertyInjector;
/**
* Main class that runs DIYLC.
*
* @author Branislav Stojkovic
*
* @see Presenter
* @see MainFrame
*/
public class DIYLCStarter {
private static final Logger LOG = Logger.getLogger(Presenter.class);
/**
* @param args
*/
public static void main(String[] args) {
URL url = DIYLCStarter.class.getResource("log4j.properties");
Properties properties = new Properties();
try {
properties.load(url.openStream());
PropertyConfigurator.configure(properties);
} catch (Exception e) {
LOG.error("Could not initialize log4j configuration", e);
}
LOG.info("Starting DIYLC with working directory " + System.getProperty("user.dir"));
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
LOG.error("Could not set Look&Feel", e);
}
MainFrame mainFrame = new MainFrame();
mainFrame.setLocationRelativeTo(null);
mainFrame.setVisible(true);
boolean showTemplates = ConfigurationManager.getInstance().readBoolean(
TemplateDialog.SHOW_TEMPLATES_KEY, true);
if (showTemplates) {
TemplateDialog templateDialog = new TemplateDialog(mainFrame, mainFrame.getPresenter());
if (!templateDialog.getFiles().isEmpty()) {
templateDialog.setVisible(true);
}
}
url = DIYLCStarter.class.getResource("/config.properties");
properties = new Properties();
try {
LOG.info("Injecting default properties.");
properties.load(new FileInputStream("config.properties"));
PropertyInjector.injectProperties(properties);
} catch (Exception e) {
LOG.error("Could not read config.properties file", e);
}
}
}
@@ -1,7 +0,0 @@
package org.diylc.common;
public class BadPositionException extends Exception {
private static final long serialVersionUID = 1L;
}
@@ -1,88 +0,0 @@
package org.diylc.common;
import javax.swing.Icon;
import org.diylc.core.CreationMethod;
import org.diylc.core.IDIYComponent;
/**
* Entity class used to describe a component type.
*
* @author Branislav Stojkovic
*
* @see IDIYComponent
*/
public class ComponentType {
private String name;
private String description;
private CreationMethod creationMethod;
private String category;
private String namePrefix;
private String author;
private Icon icon;
private Class<? extends IDIYComponent<?>> instanceClass;
private double zOrder;
private boolean stretchable;
public ComponentType(String name, String description, CreationMethod creationMethod,
String category, String namePrefix, String author, Icon icon,
Class<? extends IDIYComponent<?>> instanceClass, double zOrder, boolean stretchable) {
super();
this.name = name;
this.description = description;
this.creationMethod = creationMethod;
this.category = category;
this.namePrefix = namePrefix;
this.author = author;
this.icon = icon;
this.instanceClass = instanceClass;
this.zOrder = zOrder;
this.stretchable = stretchable;
}
public String getName() {
return name;
}
public String getDescription() {
return description;
}
public CreationMethod getCreationMethod() {
return creationMethod;
}
public String getCategory() {
return category;
}
public String getNamePrefix() {
return namePrefix;
}
public String getAuthor() {
return author;
}
public Icon getIcon() {
return icon;
}
public Class<? extends IDIYComponent<?>> getInstanceClass() {
return instanceClass;
}
public double getZOrder() {
return zOrder;
}
public boolean isStretchable() {
return stretchable;
}
@Override
public String toString() {
return name;
}
}
-11
View File
@@ -1,11 +0,0 @@
package org.diylc.common;
public enum Display {
NAME, VALUE;
@Override
public String toString() {
return name().substring(0, 1) + name().substring(1).toLowerCase();
}
}
@@ -1,36 +0,0 @@
package org.diylc.common;
import java.awt.Graphics;
/**
* Enumerates all options that can be used when drawing a project.
*
* @see IPlugInPort#draw(java.awt.Graphics2D, java.util.Set, IComponentFiler)
*
* @author Branislav Stojkovic
*/
public enum DrawOption {
/**
* Selection rectangle will be drawn when needed and selected components may
* be rendered differently.
*/
SELECTION,
/**
* Selected zoom level will be applied to scale the {@link Graphics} before
* drawing.
*/
ZOOM,
/**
* Grid lines are drawn.
*/
GRID,
/**
* Control points are drawn.
*/
CONTROL_POINTS,
/**
* Anti-aliasing is used when drawing.
*/
ANTIALIASING;
}
-83
View File
@@ -1,83 +0,0 @@
package org.diylc.common;
import java.awt.Rectangle;
import java.awt.geom.Point2D;
import org.diylc.core.Project;
/**
* Enumerates all possible events between {@link IPlugInPort} and
* {@link IPlugIn}. Some events overlap so be careful which ones you subscribe
* for and how you process them.
*
* @author Branislav Stojkovic
*/
public enum EventType {
/**
* Called when zoom level changes. Typically only one parameter of type
* {@link Double} is passed with new zoom level.
*/
ZOOM_CHANGED,
/**
* Called when a new project is loaded. New {@link Project} is the first
* parameter. Boolean flag is the second parameter and it's true when new
* project is loaded, false when the same project has been either reloaded
* or loaded with undo/redo operations.
*/
PROJECT_LOADED,
/**
* Called when either current file name or modified flag are changed. The
* first parameter is the current file name, the second one is a boolean
* modified flag.
*/
FILE_STATUS_CHANGED,
/**
* Called when selection rectangle is changed. Object of type
* {@link Rectangle} is the only parameter and it contains the new selection
* rectangle.
*/
SELECTION_RECT_CHANGED,
/**
* Called when component selection is changed. New
* {@link ComponentSelection} is attached as a parameter.
*/
SELECTION_CHANGED,
/**
* Called when selection size changes, together with a {@link Point2D}
* object containing selection size (x = width, y = height). Size is
* expressed in the default measure (cm for metric, inches for imperial).
*/
REPAINT,
/**
* Called when new component slot has been changed. The only parameter is
* {@link ComponentType} and may be null.
*/
SLOT_CHANGED,
/**
* Called when the current project has been modified. Two instances of
* {@link Project} are passed as parameters, one before and one after the
* change. The third parameter is a string containing change description.
*/
PROJECT_MODIFIED,
/**
* Called when control points under the cursor are changed. A single
* parameter is passed, an instance of
* <code>Map<IDIYComponent<?>, Set<Integer>></code> containing all the
* components and indices of their control points that are under the cursor.
*/
AVAILABLE_CTRL_POINTS_CHANGED,
/**
* Called when mouse cursor is moved. Point object is passed, containing the
* current cursor location (not taking zoom into account).
*/
MOUSE_MOVED,
/**
* Called when a layer status is changed. The first parameter is a set of indices of locked layers. All layers not included are considered unlocked.
*/
LAYER_STATE_CHANGED,
/**
* Called to update the status message. New status message is passed as a first parameter.
*/
STATUS_MESSAGE_CHANGED;
}
-6
View File
@@ -1,6 +0,0 @@
package org.diylc.common;
public enum GridType {
LINES, CROSSHAIR, DOT, NONE;
}
@@ -1,8 +0,0 @@
package org.diylc.common;
import org.diylc.core.IDIYComponent;
public interface IComponentFiler {
boolean testComponent(IDIYComponent<?> component);
}
-19
View File
@@ -1,19 +0,0 @@
package org.diylc.common;
import com.diyfever.gui.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);
}
-331
View File
@@ -1,331 +0,0 @@
package org.diylc.common;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.geom.Point2D;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.diylc.core.IDIYComponent;
import org.diylc.core.Project;
import com.diyfever.gui.simplemq.IMessageListener;
import com.diyfever.gui.simplemq.MessageDispatcher;
import com.diyfever.gui.update.VersionNumber;
/**
* Interface for communication between plug-ins and the application. Plug-ins
* may acquire information or make changes through this interface. Application
* events are dispatched to plug-ins through {@link MessageDispatcher}
*
* @author Branislav Stojkovic
*
* @see IPlugIn
* @see MessageDispatcher
* @see IMessageListener
* @see EventType
*/
public interface IPlugInPort {
public static final String CHECK_BOX_MENU_ITEM = "org.diylc.checkBoxMenuItem";
/**
* Returns size of the canvas that takes project dimensions into account as
* well as zoom level. 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
*
* @return canvas dimensions
*/
Dimension getCanvasDimensions(boolean useZoom);
/**
* Returns an instance of {@link Cursor} that should be used at the
* specified location.
*
* Note: point coordinates are scaled for zoom factor.
*
* @param point
* @return cursor
*/
Cursor getCursorAt(Point point);
/**
* Returns an instance of currently loaded project.
*
* @return
*/
Project getCurrentProject();
/**
* Loads specified {@link Project}.
*
* @param project
* @param freshStart
*/
void loadProject(Project project, boolean freshStart);
/**
* Creates a new project.
*/
void createNewProject();
/**
* Loads a project from the specified file.
*
* @param fileName
*/
void loadProjectFromFile(String fileName);
/**
* Saves the current project into the specified file.
*
* @param fileName
*/
void saveProjectToFile(String fileName);
/**
* @return the current file name.
*/
String getCurrentFileName();
/**
* @return true if the current project is modified.
*/
boolean isProjectModified();
/**
* Shows a user dialog if there are changes to confirm that it's safe to
* proceed.
*
* @return true, if file actions (new, open, close) can be taken
*/
boolean allowFileAction();
/**
* Returns all available {@link ComponentType}s classified by category.
* Result is a {@link Map} between category name to a {@link List} of all
* {@link ComponentType}s that share that category name.
*
* @return
*/
Map<String, List<ComponentType>> getComponentTypes();
/**
* Draws project on the provided {@link Graphics2D}. If the provided filter
* is not null, it will be used to filter the components that are shown.
*
* @param g2d
* @param drawOptions
* specific drawing options
* @param filter
*/
void draw(Graphics2D g2d, Set<DrawOption> drawOptions, IComponentFiler filter);
Double[] getAvailableZoomLevels();
/**
* Returns current zoom level where <code>zoomLevel = 1.0d</code> means
* 100%.
*
* @return current zoom level
*/
double getZoomLevel();
/**
* Changes current zoom level where <code>zoomLevel = 1.0d</code> means 100%
*
* @param zoomLevel
* new zoom leve
*/
void setZoomLevel(double zoomLevel);
/**
* Notifies the presenter that mouse is clicked.
*
* Note: point coordinates are display based, i.e. scaled for zoom factor.
*
* @param point
* @param ctrlDown
* @param shiftDown
* @param altDown
*/
void mouseClicked(Point point, boolean ctrlDown, boolean shiftDown, boolean altDown);
/**
* Notifies the presenter that mouse is moved.
*
* Note: point coordinates are display based, i.e. scaled for zoom factor.
*
* @param point
* @param ctrlDown
* @param shiftDown
* @param altDown
*/
void mouseMoved(Point point, boolean ctrlDown, boolean shiftDown, boolean altDown);
/**
* Returns the current {@link ComponentTransferable}.
*
* @return
*/
List<IDIYComponent<?>> getSelectedComponents();
/**
* Selects all components in the project.
*/
void selectAll();
/**
* Notification that drag has been started from the specified point.
*
* Note: point coordinates are scaled for zoom factor.
*
* @param point
* @param ctrlDown
* @param shiftDown
* @param altDown
*/
void dragStarted(Point point, boolean ctrlDown, boolean shiftDown, boolean altDown);
/**
* Checks if it's possible to drop over the specified point.
*
* Note: point coordinates are scaled for zoom factor.
*
* @param point
* @return
*/
boolean dragOver(Point point);
/**
* Notification that drag has been ended in the specified point.
*
* Note: point coordinates are scaled for zoom factor.
*
* @param point
*/
void dragEnded(Point point);
/**
* Returns current version number.
*
* @return
*/
VersionNumber getCurrentVersionNumber();
/**
* Adds a list of components to the project.
*
* @param components
*/
void pasteComponents(List<IDIYComponent<?>> components);
/**
* Deletes all the selected components from the project.
*/
void deleteSelectedComponents();
/**
* Sets default value for the specified property name for currently selected
* component types.
*
* @param propertyName
* display name for property
* @param value
* new default value, must not be null
*/
void setSelectionDefaultPropertyValue(String propertyName, Object value);
/**
* Sets default value for the specified property name for projects.
*
* @param propertyName
* display name for property
* @param value
* new default value, must not be null
*/
void setProjectDefaultPropertyValue(String propertyName, Object value);
/**
* @return a list of properties that are mutual for all the selected
* components. Resulting list may be empty if selected components do
* not have mutual properties or can be null if the selection is
* empty.
*/
List<PropertyWrapper> getMutualSelectionProperties();
/**
* Applies specified properties to all the selected components. If some of
* the properties are not applicable to some of the selected components an
* exception will be thrown.
*
* @param properties
*/
void applyPropertiesToSelection(List<PropertyWrapper> properties);
/**
* @return a list of editable properties of the current project.
*/
List<PropertyWrapper> getProjectProperties();
/**
* Applies specified properties to the current project.
*
* @param properties
*/
void applyPropertiesToProject(List<PropertyWrapper> properties);
/**
* Sets the new component slot. Specified component type will be used to
* instantiate new component.
*/
void setNewComponentTypeSlot(ComponentType componentType);
/**
* Changes default size notation, true for metric, false for imperial.
*
* @param isMetric
*/
void setMetric(boolean isMetric);
/**
* Groups all selected components.
*/
void groupSelectedComponents();
/**
* Ungroups all selected components.
*/
void ungroupSelectedComponents();
/**
* Locks or unlocks the specified layer. All components within +- 0.5 range
* will be affected by the change as well.
*
* @param layerZOrder
* @param locked
*/
void setLayerLocked(int layerZOrder, boolean locked);
/**
* @return selection size expressed in either inches or centimeters, based
* on the user preference.
*/
Point2D calculateSelectionDimension();
/**
* Sends each of the selected components one step back.
*/
void sendSelectionToBack();
/**
* Brings each of the selected components one step to front.
*/
void bringSelectionToFront();
}
-34
View File
@@ -1,34 +0,0 @@
package org.diylc.common;
/**
* Abstract layer between the app and platform worker thread implementation.
*
* @author Branislav Stojkovic
*
* @param <T>
*/
public interface ITask<T> {
/**
* Runs in background thread.
*
* @return
* @throws Exception
*/
T doInBackground() throws Exception;
/**
* Called if background thread fails.
*
* @param e
*/
void failed(Exception e);
/**
* Called if background thread is executed correctly, the result is passed
* as a parameter.
*
* @param result
*/
void complete(T result);
}
@@ -1,39 +0,0 @@
package org.diylc.common;
import java.awt.AlphaComposite;
import java.awt.BasicStroke;
import java.awt.Stroke;
import java.util.HashMap;
import java.util.Map;
/**
* Repository for object that may be reused, such as {@link Stroke} or
* {@link AlphaComposite}.
*
* @author Branislav Stojkovic
*/
public class ObjectCache {
private static ObjectCache instance;
public static ObjectCache getInstance() {
if (instance == null) {
instance = new ObjectCache();
}
return instance;
}
private ObjectCache() {
}
private Map<Integer, Stroke> basicStrokeMap = new HashMap<Integer, Stroke>();
public Stroke fetchBasicStroke(int width) {
if (basicStrokeMap.containsKey(width)) {
return basicStrokeMap.get(width);
}
Stroke stroke = new BasicStroke(width, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
basicStrokeMap.put(width, stroke);
return stroke;
}
}
@@ -1,15 +0,0 @@
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";
}
}
}
-5
View File
@@ -1,5 +0,0 @@
package org.diylc.common;
public enum Power {
}
@@ -1,145 +0,0 @@
package org.diylc.common;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.diylc.core.IPropertyValidator;
/**
* Entity class for editable properties extracted from component objects.
* Represents a single editable property together with it's current value.
*
* @author Branislav Stojkovic
*/
public class PropertyWrapper implements Cloneable {
private String name;
private Class<?> type;
private Object value;
private Method setter;
private Method getter;
private boolean defaultable;
private IPropertyValidator validator;
public PropertyWrapper(String name, Class<?> type, Method getter, Method setter,
boolean defaultable, IPropertyValidator validator) {
super();
this.name = name;
this.type = type;
this.getter = getter;
this.setter = setter;
this.defaultable = defaultable;
this.validator = validator;
}
public void readFrom(Object object) throws IllegalArgumentException, IllegalAccessException,
InvocationTargetException {
this.value = getter.invoke(object);
}
// public void readUniqueFrom(IDIYComponent component)
// throws IllegalArgumentException, IllegalAccessException,
// InvocationTargetException {
// Object newValue = getter.invoke(component);
// if (!newValue.equals(value)) {
// this.value = null;
// }
// }
public void writeTo(Object object) throws IllegalArgumentException, IllegalAccessException,
InvocationTargetException {
setter.invoke(object, value);
}
public String getName() {
return name;
}
public Class<?> getType() {
return type;
}
public Object getValue() {
return value;
}
public void setValue(Object value) {
this.value = value;
}
public boolean isDefaultable() {
return defaultable;
}
public IPropertyValidator getValidator() {
return validator;
}
// @Override
// public Object clone() throws CloneNotSupportedException {
// // Try to invoke clone method on value if possible.
// try {
// Method cloneMethod = value.getClass().getMethod("clone");
// return new Property(name, type, cloneMethod.invoke(value));
// } catch (Exception e) {
// }
// return new Property(name, type, value);
// }
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (defaultable ? 1231 : 1237);
result = prime * result + ((getter == null) ? 0 : getter.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((setter == null) ? 0 : setter.hashCode());
result = prime * result + ((type == null) ? 0 : type.hashCode());
result = prime * result + ((value == null) ? 0 : value.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PropertyWrapper other = (PropertyWrapper) obj;
if (defaultable != other.defaultable)
return false;
if (getter == null) {
if (other.getter != null)
return false;
} else if (!getter.equals(other.getter))
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (setter == null) {
if (other.setter != null)
return false;
} else if (!setter.equals(other.setter))
return false;
if (type == null) {
if (other.type != null)
return false;
} else if (!type.equals(other.type))
return false;
if (value == null) {
if (other.value != null)
return false;
} else if (!value.equals(other.value))
return false;
return true;
}
@Override
public String toString() {
return name + " = " + value;
}
}
@@ -1,14 +0,0 @@
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,59 +0,0 @@
package org.diylc.components;
import java.awt.Color;
import java.awt.Font;
import org.diylc.core.IDIYComponent;
import org.diylc.core.annotations.EditableProperty;
/**
* Abstract implementation of {@link IDIYComponent} that contains component name
* and toString.
*
* @author Branislav Stojkovic
*
* @param <T>
*/
public abstract class AbstractComponent<T> implements IDIYComponent<T> {
private static final long serialVersionUID = 1L;
protected String name = "";
public static Color SELECTION_COLOR = Color.red;
public static Color LABEL_COLOR = Color.black;
public static Color LABEL_COLOR_SELECTED = Color.red;
public static Font LABEL_FONT = new Font("Tahoma", Font.PLAIN, 12);
@EditableProperty(defaultable = false)
@Override
public String getName() {
return name;
}
@Override
public void setName(String name) {
this.name = name;
}
@Override
public boolean canControlPointOverlap(int index) {
return false;
}
@Override
public String toString() {
return name;
}
/**
* 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(int x) {
return (x / 2) * 2 + 1;
}
}
@@ -1,136 +0,0 @@
package org.diylc.components;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Composite;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.geom.CubicCurve2D;
import org.diylc.common.ObjectCache;
import org.diylc.core.ComponentState;
import org.diylc.core.IDrawingObserver;
import org.diylc.core.Project;
import org.diylc.core.VisibilityPolicy;
import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.measures.Size;
import org.diylc.core.measures.SizeUnit;
import org.diylc.utils.Constants;
public abstract class AbstractCurvedComponent<T> extends AbstractTransparentComponent<T> {
private static final long serialVersionUID = 1L;
public static Color GUIDELINE_COLOR = Color.blue;
public static Size DEFAULT_SIZE = new Size(1d, SizeUnit.in);
protected Point[] controlPoints = new Point[] { new Point(0, 0),
new Point(DEFAULT_SIZE.convertToPixels() / 2, 0),
new Point(DEFAULT_SIZE.convertToPixels() / 2, DEFAULT_SIZE.convertToPixels()),
new Point(DEFAULT_SIZE.convertToPixels(), DEFAULT_SIZE.convertToPixels()) };
protected Color color = getDefaultColor();
/**
* Draws the specified curve onto graphics.
*
* @param curve
* @param g2d
* @param componentState
*/
protected abstract void drawCurve(CubicCurve2D curve, Graphics2D g2d,
ComponentState componentState);
/**
* @return default color.
*/
protected abstract Color getDefaultColor();
@Override
public void drawIcon(Graphics2D g2d, int width, int height) {
g2d.setColor(getDefaultColor().darker());
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(3));
CubicCurve2D curve = new CubicCurve2D.Double(1, height - 1, width / 4, height / 3,
3 * width / 4, 2 * height / 3, width - 1, 1);
g2d.draw(curve);
g2d.setColor(getDefaultColor());
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
g2d.draw(curve);
}
@Override
public void draw(Graphics2D g2d, ComponentState componentState, Project project,
IDrawingObserver drawingObserver) {
if (componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING) {
// Do not track guidelines.
drawingObserver.stopTracking();
g2d.setStroke(Constants.DASHED_STROKE);
g2d.setColor(GUIDELINE_COLOR);
g2d.drawLine(controlPoints[0].x, controlPoints[0].y, controlPoints[1].x,
controlPoints[1].y);
g2d.drawLine(controlPoints[1].x, controlPoints[1].y, controlPoints[2].x,
controlPoints[2].y);
g2d.drawLine(controlPoints[2].x, controlPoints[2].y, controlPoints[3].x,
controlPoints[3].y);
drawingObserver.startTracking();
}
CubicCurve2D curve = new CubicCurve2D.Double(controlPoints[0].x, controlPoints[0].y,
controlPoints[1].x, controlPoints[1].y, controlPoints[2].x, controlPoints[2].y,
controlPoints[3].x, controlPoints[3].y);
Composite oldComposite = g2d.getComposite();
if (alpha < MAX_ALPHA) {
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha
/ MAX_ALPHA));
}
// g2d.setColor(color.darker());
// g2d.setStroke(new BasicStroke(thickness));
// g2d.draw(path);
// g2d.setColor(color);
// g2d.setStroke(new BasicStroke(thickness - 2));
// g2d.draw(path);
drawCurve(curve, g2d, componentState);
g2d.setComposite(oldComposite);
}
@Override
public int getControlPointCount() {
return controlPoints.length;
}
@Override
public boolean isControlPointSticky(int index) {
return index == 0 || index == 3;
}
@Override
public VisibilityPolicy getControlPointVisibilityPolicy(int index) {
return VisibilityPolicy.WHEN_SELECTED;
}
@Override
public boolean canControlPointOverlap(int index) {
// Only shape control points may overlap.
return index == 1 || index == 2;
}
@Override
public Point getControlPoint(int index) {
return controlPoints[index];
}
@Override
public void setControlPoint(Point point, int index) {
controlPoints[index].setLocation(point);
}
@EditableProperty
public Color getColor() {
return color;
}
public void setColor(Color color) {
this.color = color;
}
}
@@ -1,249 +0,0 @@
package org.diylc.components;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Composite;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.geom.Rectangle2D;
import org.diylc.common.Display;
import org.diylc.common.ObjectCache;
import org.diylc.core.ComponentState;
import org.diylc.core.IDrawingObserver;
import org.diylc.core.Project;
import org.diylc.core.VisibilityPolicy;
import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.measures.Size;
import org.diylc.core.measures.SizeUnit;
/**
* Base class for all leaded components such as resistors or capacitors. Has two
* control points and draws leads between them. Also, it positions and draws the
* shape of the component as specified by a child class.
*
* @author Branislav Stojkovic
*/
public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComponent<T> {
private static final long serialVersionUID = 1L;
public static Color LEAD_COLOR = Color.decode("#236B8E");
public static Size LEAD_THICKNESS = new Size(0.6d, SizeUnit.mm);
public static Size DEFAULT_SIZE = new Size(1d, SizeUnit.in);
protected Size length;
protected Size width;
protected Point[] points = new Point[] {
new Point((int) (-DEFAULT_SIZE.convertToPixels() / 2), 0),
new Point(DEFAULT_SIZE.convertToPixels() / 2, 0) };
protected Color bodyColor = Color.white;
protected Color borderColor = Color.black;
protected Color labelColor = LABEL_COLOR;
protected Display display = Display.NAME;
protected AbstractLeadedComponent() {
super();
try {
this.length = getDefaultLength().clone();
this.width = getDefaultWidth().clone();
} catch (CloneNotSupportedException e) {
// This should never happen because Size supports cloning.
} catch (NullPointerException e) {
// This will happen if components do not have any shape.
}
}
@Override
public void draw(Graphics2D g2d, ComponentState componentState, Project project,
IDrawingObserver drawingObserver) {
double distance = points[0].distance(points[1]);
Shape shape = getBodyShape();
if (shape == null) {
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(
getLeadThickness().convertToPixels()));
g2d.setColor(shouldShadeLeads() ? getLeadColor(componentState).darker()
: getLeadColor(componentState));
g2d.drawLine(points[0].x, points[0].y, points[1].x, points[1].y);
if (shouldShadeLeads()) {
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(
getLeadThickness().convertToPixels() - 2));
g2d.setColor(getLeadColor(componentState));
g2d.drawLine(points[0].x, points[0].y, points[1].x, points[1].y);
}
return;
}
Rectangle shapeRect = shape.getBounds();
double leadLenght = (distance - shapeRect.width) / 2;
Double theta = Math.atan2(points[1].y - points[0].y, points[1].x - points[0].x);
// Transform graphics to draw the body in the right place and at the
// right angle.
g2d.translate((points[0].x + points[1].x - shapeRect.width) / 2,
(points[0].y + points[1].y - shapeRect.height) / 2);
g2d.rotate(theta, shapeRect.width / 2, shapeRect.height / 2);
// Draw body.
Composite oldComposite = g2d.getComposite();
if (alpha < MAX_ALPHA) {
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha
/ MAX_ALPHA));
}
g2d.setColor(bodyColor);
g2d.fill(shape);
decorateComponentBody(g2d);
g2d.setComposite(oldComposite);
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
g2d.setColor(componentState == ComponentState.SELECTED
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : borderColor);
g2d.draw(shape);
// Draw leads.
int leadThickness = getClosestOdd(getLeadThickness().convertToPixels());
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(leadThickness));
g2d.setColor(shouldShadeLeads() ? getLeadColor(componentState).darker()
: getLeadColor(componentState));
g2d.drawLine((int) (shapeRect.width - distance) / 2, (int) shapeRect.height / 2,
(int) ((shapeRect.width - distance) / 2 + leadLenght) - leadThickness / 2,
(int) shapeRect.height / 2);
g2d.drawLine((int) (shapeRect.width + distance) / 2, (int) shapeRect.height / 2,
(int) ((shapeRect.width + distance) / 2 - leadLenght) + leadThickness / 2,
(int) shapeRect.height / 2);
if (shouldShadeLeads()) {
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(leadThickness - 2));
g2d.setColor(getLeadColor(componentState));
g2d.drawLine((int) (shapeRect.width - distance) / 2, (int) shapeRect.height / 2,
(int) ((shapeRect.width - distance) / 2 + leadLenght) - leadThickness / 2,
(int) shapeRect.height / 2);
g2d.drawLine((int) (shapeRect.width + distance) / 2, (int) shapeRect.height / 2,
(int) ((shapeRect.width + distance) / 2 - leadLenght) + leadThickness / 2,
(int) shapeRect.height / 2);
}
// Do not track the label because that area was already covered.
drawingObserver.stopTracking();
// Draw label.
g2d.setFont(LABEL_FONT);
g2d.setColor(componentState == ComponentState.SELECTED ? LABEL_COLOR_SELECTED : labelColor);
FontMetrics fontMetrics = g2d.getFontMetrics();
String label = display == Display.NAME ? getName() : getValue().toString();
// Adjust label angle if needed to make sure that it's readable.
if ((theta >= Math.PI / 2 && theta <= Math.PI)
|| (theta < -Math.PI / 2 && theta > -Math.PI)) {
g2d.rotate(Math.PI, shapeRect.width / 2, shapeRect.height / 2);
}
Rectangle2D textRect = fontMetrics.getStringBounds(label, g2d);
g2d.drawString(label, (int) (shapeRect.width - textRect.getWidth()) / 2,
(int) (shapeRect.height - textRect.getHeight()) / 2 + fontMetrics.getAscent());
}
protected void decorateComponentBody(Graphics2D g2d) {
// Do nothing.
}
protected boolean shouldShadeLeads() {
return true;
}
/**
* @return default component length.
*/
protected abstract Size getDefaultLength();
/**
* Returns default component width.
*
* @return
*/
protected abstract Size getDefaultWidth();
/**
* @return shape that represents component body. Shape should not be
* transformed and should be referenced to (0, 0).
*/
protected abstract Shape getBodyShape();
/**
* @return default lead thickness. Override this method to change it.
*/
protected Size getLeadThickness() {
return LEAD_THICKNESS;
}
/**
* @return default lead color. Override this method to change it.
*/
protected Color getLeadColor(ComponentState componentState) {
return componentState == ComponentState.SELECTED
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : LEAD_COLOR;
}
@Override
public int getControlPointCount() {
return points.length;
}
@Override
public Point getControlPoint(int index) {
return (Point) points[index];
}
@Override
public boolean isControlPointSticky(int index) {
return true;
}
@Override
public VisibilityPolicy getControlPointVisibilityPolicy(int index) {
return VisibilityPolicy.ALWAYS;
}
@Override
public void setControlPoint(Point point, int index) {
points[index].setLocation(point);
}
@EditableProperty(name = "Color")
public Color getBodyColor() {
return bodyColor;
}
public void setBodyColor(Color bodyColor) {
this.bodyColor = bodyColor;
}
@EditableProperty(name = "Border")
public Color getBorderColor() {
return borderColor;
}
public void setBorderColor(Color borderColor) {
this.borderColor = borderColor;
}
@EditableProperty(name = "Length", defaultable = true)
public Size getLength() {
return length;
}
public void setLength(Size length) {
this.length = length;
}
@EditableProperty(name = "Width", defaultable = true)
public Size getWidth() {
return width;
}
public void setWidth(Size width) {
this.width = width;
}
@EditableProperty
public Display getDisplay() {
return display;
}
public void setDisplay(Display display) {
this.display = display;
}
}
@@ -1,36 +0,0 @@
package org.diylc.components;
import java.awt.Point;
public abstract class AbstractSinglePointComponent extends AbstractComponent<Void> {
private static final long serialVersionUID = 1L;
protected Point point = new Point(0, 0);
@Override
public int getControlPointCount() {
return 1;
}
@Override
public Point getControlPoint(int index) {
return point;
}
@Override
public void setControlPoint(Point point, int index) {
this.point.setLocation(point);
}
@Deprecated
@Override
public Void getValue() {
return null;
}
@Deprecated
@Override
public void setValue(Void value) {
}
}
@@ -1,21 +0,0 @@
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;
}
}
@@ -1,13 +0,0 @@
package org.diylc.core;
/**
* Validator that allows all values.
*
* @author Branislav Stojkovic
*/
public class AllowAllValidator implements IPropertyValidator {
@Override
public void validate(Object value) throws ValidationException {
}
}
@@ -1,11 +0,0 @@
package org.diylc.core;
/**
* Enumerates all possible states that a component can be in.
*
* @author Branislav Stojkovic
*/
public enum ComponentState {
NORMAL, SELECTED, LOCKED, DRAGGING
}
@@ -1,6 +0,0 @@
package org.diylc.core;
public enum CreationMethod {
SINGLE_CLICK, POINT_BY_POINT;
}
-121
View File
@@ -1,121 +0,0 @@
package org.diylc.core;
import java.awt.Graphics2D;
import java.awt.Point;
import java.io.Serializable;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
/**
* Interface for component instance. Implementation classes of this interface
* will be instantiated by the application when component is added to the
* canvas. <br>
* <br>
* <b>Implementing classes should meet the following: </b>
* <ul>
* <li>Must have an empty constructor.</li>
* <li>Class should be annotated with {@link ComponentDescriptor}.</li>
* <li>Getters for properties editable by users should be annotated with
* {@link EditableProperty}.</li>
* <li>Component configuration should be stored int <code>public static</code>
* fields so they can be set through config file.</li>
* </ul>
*
* @author Branislav Stojkovic
*
* @param <T>
* type of component values, e.g. Resistance for resistors or String
* for transistors.
*/
public interface IDIYComponent<T> extends Serializable {
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 TEXT = 5;
/**
* @return component instance name.
*/
String getName();
/**
* Updates component instance name.
*
* @param name
*/
void setName(String name);
/**
* @return component value.
*/
T getValue();
/**
* Updates component value.
*
* @param value
*/
void setValue(T value);
/**
* @return number of control points for this component instance. May vary
* between two instances of the same type, e.g. DIL IC with 8 and 16
* pins will have 8 or 16 pins although they are of the same type.
*/
int getControlPointCount();
/**
* @param index
* @return control point at the specified index.
*/
Point getControlPoint(int index);
/**
* Updates the control point at the specified index.
*
* @param point
* @param index
*/
void setControlPoint(Point point, int index);
/**
* @param index
* @return true, if the specified control point may stick to control points
* of other components.
*/
boolean isControlPointSticky(int index);
/**
* @param index
* @return true, if the specified control point may overlap with other
* control points <b>of the same component</b>. The other control
* point must be able to overlap too.
*/
boolean canControlPointOverlap(int index);
VisibilityPolicy getControlPointVisibilityPolicy(int index);
/**
* Draws the component onto the {@link Graphics2D}.
*
* @param g2d
* @param componentState
* @param project
* @param drawingObserver
*/
void draw(Graphics2D g2d, ComponentState componentState, Project project,
IDrawingObserver drawingObserver);
/**
* Draws icon representation of the component. This should not depend on
* component state, i.e. it should be treated as a static method.
*
* @param g2d
* @param width
* @param height
*/
void drawIcon(Graphics2D g2d, int width, int height);
}
@@ -1,15 +0,0 @@
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 {
void stopTracking();
void startTracking();
}
@@ -1,16 +0,0 @@
package org.diylc.core;
/**
* Interface for validating property value changes.
*
* @author Branislav Stojkovic
*/
public interface IPropertyValidator {
/**
* @param value
* @throws ValidationException
* if validation fails. Message will contain the reason.
*/
void validate(Object value) throws ValidationException;
}
-28
View File
@@ -1,28 +0,0 @@
package org.diylc.core;
/**
* Base interface for the main GUI component.
*
* @author Branislav Stojkovic
*/
public interface IView {
public static final int ERROR_MESSAGE = 0;
public static final int INFORMATION_MESSAGE = 1;
public static final int WARNING_MESSAGE = 2;
public static final int QUESTION_MESSAGE = 3;
public static final int PLAIN_MESSAGE = -1;
public static final int DEFAULT_OPTION = -1;
public static final int YES_NO_OPTION = 0;
public static final int YES_NO_CANCEL_OPTION = 1;
public static final int OK_CANCEL_OPTION = 2;
public static final int YES_OPTION = 0;
public static final int NO_OPTION = 1;
public static final int CANCEL_OPTION = 2;
public static final int OK_OPTION = 0;
void showMessage(String message, String title, int messageType);
int showConfirmDialog(String message, String title, int optionType, int messageType);
}
-213
View File
@@ -1,213 +0,0 @@
package org.diylc.core;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.annotations.PositiveMeasureValidator;
import org.diylc.core.measures.Size;
import org.diylc.core.measures.SizeUnit;
/**
* Entity class that defines a project. Contains project properties and a
* collection of components.This class is serialized to file. Some filed getters
* are tagged with {@link EditableProperty} to enable for user to edit them.
*
* @author Branislav Stojkovic
*/
public class Project implements Serializable {
private static final long serialVersionUID = 1L;
public static String DEFAULT_TITLE = "New Project";
public static Size DEFAULT_WIDTH = new Size(29d, SizeUnit.cm);
public static Size DEFAULT_HEIGHT = new Size(21d, SizeUnit.cm);
public static Size DEFAULT_GRID_SPACING = new Size(0.1d, SizeUnit.in);
private String title;
private String author;
private String description;
private Size width;
private Size height;
private Size gridSpacing;
private List<IDIYComponent<?>> components;
private Set<Set<IDIYComponent<?>>> groups;
private Set<Integer> lockedLayers;
public Project() {
components = new ArrayList<IDIYComponent<?>>();
groups = new HashSet<Set<IDIYComponent<?>>>();
lockedLayers = new HashSet<Integer>();
title = DEFAULT_TITLE;
author = System.getProperty("user.name");
width = DEFAULT_WIDTH;
height = DEFAULT_HEIGHT;
gridSpacing = DEFAULT_GRID_SPACING;
}
@EditableProperty(defaultable = false)
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
@EditableProperty
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
@EditableProperty(defaultable = false)
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@EditableProperty
public Size getWidth() {
return width;
}
public void setWidth(Size width) {
this.width = width;
}
@EditableProperty
public Size getHeight() {
return height;
}
public void setHeight(Size height) {
this.height = height;
}
@EditableProperty(name = "Grid spacing", validatorClass = SpacingValidator.class)
public Size getGridSpacing() {
return gridSpacing;
}
public void setGridSpacing(Size gridSpacing) {
this.gridSpacing = gridSpacing;
}
/**
* List of components sorted by z-order ascending.
*
* @return
*/
public List<IDIYComponent<?>> getComponents() {
return components;
}
/**
* Set of grouped components.
*
* @return
*/
public Set<Set<IDIYComponent<?>>> getGroups() {
return groups;
}
public Set<Integer> getLockedLayers() {
return lockedLayers;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((author == null) ? 0 : author.hashCode());
result = prime * result + ((components == null) ? 0 : components.hashCode());
result = prime * result + ((description == null) ? 0 : description.hashCode());
result = prime * result + ((height == null) ? 0 : height.hashCode());
result = prime * result + ((title == null) ? 0 : title.hashCode());
result = prime * result + ((width == null) ? 0 : width.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Project other = (Project) obj;
if (author == null) {
if (other.author != null)
return false;
} else if (!author.equals(other.author))
return false;
if (components == null) {
if (other.components != null)
return false;
} else if (!components.equals(other.components))
return false;
if (description == null) {
if (other.description != null)
return false;
} else if (!description.equals(other.description))
return false;
if (height == null) {
if (other.height != null)
return false;
} else if (!height.equals(other.height))
return false;
if (title == null) {
if (other.title != null)
return false;
} else if (!title.equals(other.title))
return false;
if (width == null) {
if (other.width != null)
return false;
} else if (!width.equals(other.width))
return false;
return true;
}
@Override
public String toString() {
return title;
}
public static class SpacingValidator extends PositiveMeasureValidator {
@Override
public void validate(Object value) throws ValidationException {
super.validate(value);
Size size = (Size) value;
if (size.compareTo(new Size(1d, SizeUnit.mm)) < 0) {
throw new ValidationException("must be greater than 1mm");
}
if (size.compareTo(new Size(1d, SizeUnit.in)) > 0) {
throw new ValidationException("must be less than 1in");
}
}
}
// @Override
// public Project clone() throws CloneNotSupportedException {
// List<IDIYComponent> clonedComponents = new
// ArrayList<IDIYComponent>();
// for (IDIYComponent component : components) {
// clonedComponents.add(component.clone());
// }
// Project project = new Project(title, author, description,
// width.clone(), height.clone(), clonedComponents);
// return project;
// }
}
@@ -1,11 +0,0 @@
package org.diylc.core;
public class ValidationException extends Exception {
private static final long serialVersionUID = 1L;
public ValidationException(String message) {
super(message);
}
}
@@ -1,22 +0,0 @@
package org.diylc.core;
/**
* Enumerates control point visibility policies.
*
* @author Branislav Stojkovic
*/
public enum VisibilityPolicy {
/**
* Control point should be rendered all the time.
*/
ALWAYS,
/**
* Control point should be rendered only when the component is selected.
*/
WHEN_SELECTED,
/**
* Control point should not be rendered regardless of component selection.
*/
NEVER;
}
@@ -1,62 +0,0 @@
package org.diylc.core.annotations;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import org.diylc.core.CreationMethod;
import org.diylc.core.IDIYComponent;
/**
* Annotation for {@link IDIYComponent} implementation. Describes component
* properties.
*
* @author Branislav Stojkovic
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface ComponentDescriptor {
/**
* @return component type name.
*/
String name();
/**
* @return component type description.
*/
String description();
/**
* @return method that should be used to create a component. If
* <code>CreationMethod.POINT_BY_POINT</code> is used, user will
* have to select ending points before the component is created.
*/
CreationMethod creationMethod() default CreationMethod.SINGLE_CLICK;
/**
* @return component category, e.g. "Passive", "Semiconductors", etc.
*/
String category();
/**
* @return component author name.
*/
String author();
/**
* @return prefix that will be used to generate component instance names,
* e.g. "R" for resistors or "Q" for transistors.
*/
String instanceNamePrefix();
/**
* @return Z-order of the component.
*/
double zOrder();
/**
* @return when false, moving one control point will cause all the others to
* move together with it.
*/
boolean stretchable() default true;
}
@@ -1,42 +0,0 @@
package org.diylc.core.annotations;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import org.diylc.core.AllowAllValidator;
import org.diylc.core.IPropertyValidator;
/**
* Used to annotate editable component property. Editable property XYZ must have
* both getter and setter named <code>getXYZ</code> and <code>setXYZ</code>
* respectively and this annotation must be placed on the getter method.
*
* @author Branislav Stojkovic
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface EditableProperty {
/**
* Returns property name. If left blank property name will be extracted from
* the getter name, e.g. getter <code>getXYZ</code> will induce property
* name <code>XYZ</code>. <br>
* Default value is blank.
*
* @return
*/
String name() default "";
/**
* If true, application may set default value for this property. <br>
* Default value is true.
*
* @return
*/
boolean defaultable() default true;
/**
* Class of validator to use to
* @return
*/
Class<? extends IPropertyValidator> validatorClass() default AllowAllValidator.class;
}
@@ -1,20 +0,0 @@
package org.diylc.core.annotations;
import org.diylc.core.IPropertyValidator;
import org.diylc.core.ValidationException;
import org.diylc.core.measures.AbstractMeasure;
public class PositiveMeasureValidator implements IPropertyValidator {
@Override
public void validate(Object value) throws ValidationException {
if (value instanceof AbstractMeasure) {
AbstractMeasure measure = (AbstractMeasure) value;
if (measure.getValue() <= 0) {
throw new ValidationException("must be greater than zero.");
}
} else {
throw new ValidationException("wrong data type, measure expected.");
}
}
}
@@ -1,81 +0,0 @@
package org.diylc.core.measures;
import java.io.Serializable;
import java.text.DecimalFormat;
import java.text.Format;
public class AbstractMeasure<T extends Enum<? extends Unit>> implements Serializable, Cloneable {
private static final long serialVersionUID = 1L;
protected static final Format format = new DecimalFormat("0.####");
protected Double value;
protected T unit;
public AbstractMeasure() {
}
public AbstractMeasure(Double value, T unit) {
super();
this.value = value;
this.unit = unit;
}
public Double getValue() {
return value;
}
public void setValue(Double value) {
this.value = value;
}
public T getUnit() {
return unit;
}
public void setUnit(T multiplier) {
this.unit = multiplier;
}
@Override
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((unit == null) ? 0 : unit.hashCode());
result = prime * result + ((value == null) ? 0 : value.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
AbstractMeasure<?> other = (AbstractMeasure<?>) obj;
if (unit == null) {
if (other.unit != null)
return false;
} else if (!unit.equals(other.unit))
return false;
if (value == null) {
if (other.value != null)
return false;
} else if (!value.equals(other.value))
return false;
return true;
}
@Override
public String toString() {
return format.format(value) + " " + unit;
}
}
@@ -1,31 +0,0 @@
package org.diylc.core.measures;
public class Capacitance extends AbstractMeasure<CapacitanceUnit> {
private static final long serialVersionUID = 1L;
public Capacitance() {
super();
// TODO Auto-generated constructor stub
}
public Capacitance(Double value, CapacitanceUnit unit) {
super(value, unit);
// TODO Auto-generated constructor stub
}
@Override
public Capacitance clone() throws CloneNotSupportedException {
return new Capacitance(value, unit);
}
public static Capacitance parseCapacitance(String value) {
for (CapacitanceUnit unit : CapacitanceUnit.values()) {
if (value.toLowerCase().endsWith(unit.toString().toLowerCase())) {
value = value.substring(0, value.length() - unit.toString().length() - 1).trim();
return new Capacitance(Double.parseDouble(value), unit);
}
}
throw new IllegalArgumentException("Could not parse capacitance: " + value);
}
}
@@ -1,24 +0,0 @@
package org.diylc.core.measures;
public enum CapacitanceUnit implements Unit {
pF(1, "pF"), nF(1e3, "nF"), uF(1e6, "\u03bcF"), mF(1e9, "mF"), F(1e12, "F");
double factor;
String display;
private CapacitanceUnit(double factor, String display) {
this.factor = factor;
this.display = display;
}
@Override
public double getFactor() {
return factor;
}
@Override
public String toString() {
return display;
}
}
@@ -1,31 +0,0 @@
package org.diylc.core.measures;
public class Inductance extends AbstractMeasure<InductanceUnit> {
private static final long serialVersionUID = 1L;
public Inductance() {
super();
// TODO Auto-generated constructor stub
}
public Inductance(Double value, InductanceUnit unit) {
super(value, unit);
// TODO Auto-generated constructor stub
}
@Override
public Inductance clone() throws CloneNotSupportedException {
return new Inductance(value, unit);
}
public static Inductance parseCapacitance(String value) {
for (InductanceUnit unit : InductanceUnit.values()) {
if (value.toLowerCase().endsWith(unit.toString().toLowerCase())) {
value = value.substring(0, value.length() - unit.toString().length() - 1).trim();
return new Inductance(Double.parseDouble(value), unit);
}
}
throw new IllegalArgumentException("Could not parse inductance: " + value);
}
}
@@ -1,24 +0,0 @@
package org.diylc.core.measures;
public enum InductanceUnit implements Unit {
pH(1, "pH"), nH(1e3, "nH"), uH(1e6, "\u03bcH"), mH(1e9, "mH"), H(1e12, "H");
double factor;
String display;
private InductanceUnit(double factor, String display) {
this.factor = factor;
this.display = display;
}
@Override
public double getFactor() {
return factor;
}
@Override
public String toString() {
return display;
}
}
@@ -1,78 +0,0 @@
package org.diylc.core.measures;
import java.awt.Color;
import org.diylc.common.ResistorColorCode;
public class Resistance extends AbstractMeasure<ResistanceUnit> {
private static final long serialVersionUID = 1L;
private static final Color[] COLOR_DIGITS = new Color[] { Color.black, Color.decode("#8B4513"),
Color.red, Color.orange, Color.yellow, Color.decode("#76EE00"), Color.blue,
Color.decode("#91219E"), Color.lightGray, Color.white };
private static final Color[] COLOR_MULTIPLIER = new Color[] { Color.lightGray.brighter(),
Color.decode("#FFB90F"), Color.black, Color.decode("#8B4513"), Color.red, Color.orange,
Color.yellow, Color.decode("#76EE00"), Color.blue };
public Resistance() {
super();
// TODO Auto-generated constructor stub
}
public Resistance(Double value, ResistanceUnit multiplier) {
super(value, multiplier);
// TODO Auto-generated constructor stub
}
@Override
public Resistance clone() throws CloneNotSupportedException {
return new Resistance(value, unit);
}
public Color[] getColorCode(ResistorColorCode resistorColorCode) {
Color[] bands;
double base = getValue() * getUnit().getFactor();
int multiplier = 0;
while (base > (resistorColorCode == ResistorColorCode._4_BAND ? 99 : 999)) {
multiplier += 1;
base /= 10;
}
while (base < (resistorColorCode == ResistorColorCode._4_BAND ? 10 : 100)) {
multiplier -= 1;
base *= 10;
}
if (multiplier > 6 || multiplier < -2) {
// Out of range.
return new Color[] {};
}
switch (resistorColorCode) {
case _4_BAND:
bands = new Color[3];
bands[0] = COLOR_DIGITS[(int) Math.round(base / 10)];
bands[1] = COLOR_DIGITS[(int) Math.round(base % 10)];
bands[2] = COLOR_MULTIPLIER[multiplier + 2];
break;
case _5_BAND:
bands = new Color[4];
bands[0] = COLOR_DIGITS[(int) Math.round(base / 100)];
bands[1] = COLOR_DIGITS[(int) Math.round(base / 10 % 10)];
bands[2] = COLOR_DIGITS[(int) Math.round(base % 10)];
bands[3] = COLOR_MULTIPLIER[multiplier + 2];
break;
default:
bands = new Color[] {};
}
return bands;
}
public static Resistance parseResistance(String value) {
for (ResistanceUnit unit : ResistanceUnit.values()) {
if (value.toLowerCase().endsWith(unit.toString().toLowerCase())) {
value = value.substring(0, value.length() - unit.toString().length() - 1).trim();
return new Resistance(Double.parseDouble(value), unit);
}
}
throw new IllegalArgumentException("Could not parse resistance: " + value);
}
}
@@ -1,24 +0,0 @@
package org.diylc.core.measures;
public enum ResistanceUnit implements Unit {
R(1, "\u03a9"), K(1e3, "K"), M(1e6, "M");
double factor;
String display;
private ResistanceUnit(double factor, String display) {
this.factor = factor;
this.display = display;
}
@Override
public double getFactor() {
return factor;
}
@Override
public String toString() {
return display;
}
}
@@ -1,47 +0,0 @@
package org.diylc.core.measures;
import org.diylc.utils.Constants;
public class Size extends AbstractMeasure<SizeUnit> implements Comparable<Size> {
private static final long serialVersionUID = 1L;
public Size() {
super();
// TODO Auto-generated constructor stub
}
public Size(Double value, SizeUnit unit) {
super(value, unit);
// TODO Auto-generated constructor stub
}
public int convertToPixels() {
// double factor = getUnit().getFactor() / SizeUnit.in.getFactor();
// int grids = (int) (factor * getValue() * Constants.GRIDS_PER_INCH);
// double remainder = (factor * getValue() * Constants.GRIDS_PER_INCH) - grids;
// return (int) Math.round(Constants.PIXELS_PER_INCH / Constants.GRIDS_PER_INCH
// * (grids + remainder));
return (int) (getValue() * getUnit().getFactor() / SizeUnit.in.getFactor() * Constants.PIXELS_PER_INCH);
}
@Override
public Size clone() throws CloneNotSupportedException {
return new Size(value, unit);
}
public static Size parseSize(String value) {
for (SizeUnit unit : SizeUnit.values()) {
if (value.toLowerCase().endsWith(unit.toString().toLowerCase())) {
value = value.substring(0, value.length() - unit.toString().length() - 1).trim();
return new Size(Double.parseDouble(value), unit);
}
}
throw new IllegalArgumentException("Could not parse size: " + value);
}
@Override
public int compareTo(Size o) {
return new Double(value * unit.getFactor()).compareTo(o.getValue() * o.getUnit().getFactor());
}
}
@@ -1,17 +0,0 @@
package org.diylc.core.measures;
public enum SizeUnit implements Unit {
mm(1d), cm(10d), m(1e4d), in(25.4d), ft(25.4d * 12), yd(9144d);
double factor;
private SizeUnit(double factor) {
this.factor = factor;
}
@Override
public double getFactor() {
return factor;
}
}
@@ -1,6 +0,0 @@
package org.diylc.core.measures;
public interface Unit {
double getFactor();
}
@@ -1,60 +0,0 @@
package org.diylc.images;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.Icon;
import javax.swing.ImageIcon;
/**
* Loads image resources as Icons.
*
* @author Branislav Stojkovic
*/
public enum IconLoader {
Delete("delete.png"), Add("add.png"), FolderOut("folder_out.png"), Garbage("garbage.png"), DiskBlue(
"disk_blue.png"), SaveAs("save_as.png"), Exit("exit.png"), DocumentPlainYellow(
"document_plain_yellow.png"), PhotoScenery("photo_scenery.png"), LightBulbOn(
"lightbulb_on.png"), LightBulbOff("lightbulb_off.png"), NotebookAdd("notebook_add.png"), FormGreen(
"form_green.png"), Gears("gears.png"), About("about.png"), WindowColors(
"window_colors.png"), WindowGear("window_gear.png"), NavigateCheck("navigate_check.png"), Undo(
"undo.png"), Error("error.png"), Warning("warning.png"), ZoomSmall("zoom_small.png"), MoveSmall(
"move_small.png"), Print("print.png"), PDF("pdf.png"), Excel("excel.png"), CSV(
"csv.png"), HTML("html.png"), Image("image.png"), Cut("cut.png"), Copy("copy.png"), Paste(
"paste.png"), Selection("selection.png"), BOM("bom.png"), BlackBoard("blackboard.png"), IdCard(
"id_card.png"), IdCardAdd("id_card_add.png"), Chest("chest.png"), Upload("upload.png"), Wrench(
"wrench.png"), Group("group.png"), Ungroup("ungroup.png"), TraceMask("trace_mask.png"), Faq(
"faq.png"), Component("component.png"), Plugin("plugin.png"), Manual("manual.png"), Donate(
"donate.png"), Bug("bug.png"), IconLarge("icon_large.png"), IconMedium(
"icon_medium.png"), IconSmall("icon_small.png"), DocumentEdit("document_edit.png"), EditComponent(
"edit_component.png"), Size("size.png"), Front("front.png"), Back("back.png");
protected String name;
private IconLoader(String name) {
this.name = name;
}
public Icon getIcon() {
java.net.URL imgURL = getClass().getResource(name);
if (imgURL != null) {
return new ImageIcon(imgURL, name);
} else {
System.err.println("Couldn't find file: " + name);
return null;
}
}
public Image getImage() {
BufferedImage img = null;
try {
img = ImageIO.read(getClass().getResourceAsStream(name));
} catch (IOException e) {
System.err.println("Couldn't find file: " + name);
}
return img;
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 875 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 729 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 749 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 736 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 707 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 714 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 993 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 537 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 863 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 850 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 708 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 960 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 901 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 728 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 595 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 781 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 914 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 876 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 853 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 596 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 765 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 696 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 597 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 845 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 928 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 697 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 892 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 751 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 834 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 857 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 990 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 842 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 910 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 875 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 694 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 773 B

Some files were not shown because too many files have changed in this diff Show More