mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
improve auto-generated keywords
This commit is contained in:
@@ -33,11 +33,12 @@ public class ComponentType {
|
||||
private boolean rotatable;
|
||||
private IAutoCreator autoCreator;
|
||||
private KeywordPolicy keywordPolicy;
|
||||
private String keywordTag;
|
||||
|
||||
public ComponentType(String name, String description, CreationMethod creationMethod, String category,
|
||||
String namePrefix, String author, Icon icon, Class<? extends IDIYComponent<?>> instanceClass, double zOrder,
|
||||
boolean flexibleZOrder, boolean stretchable, BomPolicy bomPolicy, boolean autoEdit, boolean rotatable,
|
||||
IAutoCreator autoCreator, KeywordPolicy keywordPolicy) {
|
||||
IAutoCreator autoCreator, KeywordPolicy keywordPolicy, String keywordTag) {
|
||||
super();
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
@@ -55,6 +56,7 @@ public class ComponentType {
|
||||
this.rotatable = rotatable;
|
||||
this.autoCreator = autoCreator;
|
||||
this.keywordPolicy = keywordPolicy;
|
||||
this.keywordTag = keywordTag;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
@@ -120,6 +122,10 @@ public class ComponentType {
|
||||
public KeywordPolicy getKeywordPolicy() {
|
||||
return keywordPolicy;
|
||||
}
|
||||
|
||||
public String getKeywordTag() {
|
||||
return keywordTag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
@@ -80,6 +80,19 @@ public @interface ComponentDescriptor {
|
||||
*/
|
||||
boolean rotatable() default true;
|
||||
|
||||
/**
|
||||
* Defines if and how a component should appear in auto-generated project keywords. See
|
||||
* {@link KeywordPolicy} for more info.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
KeywordPolicy keywordPolicy() default KeywordPolicy.NEVER_SHOW;
|
||||
|
||||
/**
|
||||
* Only used if {@link KeywordPolicy} is set to {@link KeywordPolicy#SHOW_TAG}.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String keywordTag() default "";
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,25 @@
|
||||
package org.diylc.core.annotations;
|
||||
|
||||
public enum KeywordPolicy {
|
||||
SHOW_TYPE_NAME, SHOW_VALUE, NEVER_SHOW,
|
||||
/**
|
||||
* The component is represented with its type.
|
||||
*/
|
||||
SHOW_TYPE_NAME,
|
||||
/**
|
||||
* The component is represented with its value.
|
||||
*/
|
||||
SHOW_VALUE,
|
||||
/**
|
||||
* The component is not important enough and will not be shown in the keywords.
|
||||
*/
|
||||
NEVER_SHOW,
|
||||
/**
|
||||
* The component is represented with the value of {@link ComponentDescriptor#keywordTag()}
|
||||
*/
|
||||
SHOW_TAG,
|
||||
/**
|
||||
* The component is represented with both the value of {@link ComponentDescriptor#keywordTag()}
|
||||
* and the actual component value
|
||||
*/
|
||||
SHOW_TAG_AND_VALUE,
|
||||
}
|
||||
|
||||
@@ -8,22 +8,14 @@ import java.net.NetworkInterface;
|
||||
import java.net.URL;
|
||||
import java.nio.channels.Channels;
|
||||
import java.nio.channels.ReadableByteChannel;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
import org.diylc.common.ComponentType;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.Project;
|
||||
import org.diylc.core.annotations.KeywordPolicy;
|
||||
import org.diylc.plugins.cloud.model.CommentEntity;
|
||||
import org.diylc.plugins.cloud.model.IServiceAPI;
|
||||
import org.diylc.plugins.cloud.model.ProjectEntity;
|
||||
import org.diylc.plugins.cloud.model.UserEntity;
|
||||
import org.diylc.presenter.ComponentProcessor;
|
||||
|
||||
import com.diyfever.httpproxy.PhpFlatProxy;
|
||||
import com.diyfever.httpproxy.ProxyFactory;
|
||||
@@ -299,26 +291,6 @@ public class CloudPresenter {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public String extractKeywords(Project project) {
|
||||
Set<String> words = new HashSet<String>();
|
||||
for (IDIYComponent<?> c : project.getComponents()) {
|
||||
ComponentType cType =
|
||||
ComponentProcessor.getInstance().extractComponentTypeFrom((Class<? extends IDIYComponent<?>>) c.getClass());
|
||||
if (cType.getKeywordPolicy() == KeywordPolicy.SHOW_TYPE_NAME)
|
||||
words.add(cType.getName().toLowerCase());
|
||||
if (cType.getKeywordPolicy() == KeywordPolicy.SHOW_VALUE && c.getValueForDisplay() != null
|
||||
&& c.getValueForDisplay().trim().length() > 0)
|
||||
words.add(c.getValueForDisplay().trim().toLowerCase());
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String w : words)
|
||||
sb.append(w).append(",");
|
||||
if (sb.length() > 0)
|
||||
sb.deleteCharAt(sb.length() - 1);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private String getMachineId() {
|
||||
if (machineId == null) {
|
||||
try {
|
||||
|
||||
@@ -3,7 +3,6 @@ package org.diylc.presenter;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Image;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.Desktop.Action;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
@@ -76,6 +75,7 @@ public class ComponentProcessor {
|
||||
boolean rotatable;
|
||||
IAutoCreator autoCreator = null;
|
||||
KeywordPolicy keywordPolicy;
|
||||
String keywordTag;
|
||||
if (clazz.isAnnotationPresent(ComponentDescriptor.class)) {
|
||||
ComponentDescriptor annotation = clazz.getAnnotation(ComponentDescriptor.class);
|
||||
name = annotation.name();
|
||||
@@ -91,7 +91,8 @@ public class ComponentProcessor {
|
||||
autoEdit = annotation.autoEdit();
|
||||
rotatable = annotation.rotatable();
|
||||
keywordPolicy = annotation.keywordPolicy();
|
||||
} else {
|
||||
keywordTag = annotation.keywordTag();
|
||||
} else { // default
|
||||
name = clazz.getSimpleName();
|
||||
description = "";
|
||||
creationMethod = CreationMethod.SINGLE_CLICK;
|
||||
@@ -105,6 +106,7 @@ public class ComponentProcessor {
|
||||
autoEdit = true;
|
||||
rotatable = true;
|
||||
keywordPolicy = KeywordPolicy.NEVER_SHOW;
|
||||
keywordTag = null;
|
||||
}
|
||||
if (clazz.isAnnotationPresent(AutoCreator.class)) {
|
||||
AutoCreator annotation = clazz.getAnnotation(AutoCreator.class);
|
||||
@@ -132,7 +134,7 @@ public class ComponentProcessor {
|
||||
}
|
||||
ComponentType componentType =
|
||||
new ComponentType(name, description, creationMethod, category, namePrefix, author, icon, clazz, zOrder,
|
||||
flexibleZOrder, stretchable, bomPolicy, autoEdit, rotatable, autoCreator, keywordPolicy);
|
||||
flexibleZOrder, stretchable, bomPolicy, autoEdit, rotatable, autoCreator, keywordPolicy, keywordTag);
|
||||
componentTypeMap.put(clazz.getName(), componentType);
|
||||
return componentType;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class InstantiationManager {
|
||||
|
||||
private static final ComponentType clipboardType = new ComponentType("Clipboard contents",
|
||||
"Components from the clipboard", CreationMethod.SINGLE_CLICK, "Multi", "", "", null, null, 0, false, false, null,
|
||||
false, true, null, KeywordPolicy.NEVER_SHOW);
|
||||
false, true, null, KeywordPolicy.NEVER_SHOW, null);
|
||||
|
||||
public InstantiationManager() {}
|
||||
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package org.diylc.utils;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.diylc.common.ComponentType;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.Project;
|
||||
import org.diylc.core.annotations.KeywordPolicy;
|
||||
import org.diylc.presenter.ComponentProcessor;
|
||||
|
||||
public class KeywordExtractor {
|
||||
|
||||
private static KeywordExtractor instance;
|
||||
|
||||
public static KeywordExtractor getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new KeywordExtractor();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
private KeywordExtractor() {}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public String extractKeywords(Project project) {
|
||||
Set<String> words = new HashSet<String>();
|
||||
for (IDIYComponent<?> c : project.getComponents()) {
|
||||
ComponentType cType =
|
||||
ComponentProcessor.getInstance().extractComponentTypeFrom((Class<? extends IDIYComponent<?>>) c.getClass());
|
||||
if (cType.getKeywordPolicy() == KeywordPolicy.SHOW_TYPE_NAME)
|
||||
words.add(cType.getName().toLowerCase());
|
||||
if ((cType.getKeywordPolicy() == KeywordPolicy.SHOW_VALUE || cType.getKeywordPolicy() == KeywordPolicy.SHOW_TAG_AND_VALUE)
|
||||
&& c.getValueForDisplay() != null && c.getValueForDisplay().trim().length() > 0)
|
||||
words.add(c.getValueForDisplay().trim().toLowerCase());
|
||||
if ((cType.getKeywordPolicy() == KeywordPolicy.SHOW_TAG || cType.getKeywordPolicy() == KeywordPolicy.SHOW_TAG_AND_VALUE)
|
||||
&& cType.getKeywordTag() != null && cType.getKeywordTag().length() > 0)
|
||||
words.add(cType.getKeywordTag().trim().toLowerCase());
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String w : words)
|
||||
sb.append(w).append(",");
|
||||
if (sb.length() > 0)
|
||||
sb.deleteCharAt(sb.length() - 1);
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,8 @@ import org.diylc.utils.Constants;
|
||||
@ComponentDescriptor(name = "Marshall Style Perf Board", category = "Boards", author = "Branislav Stojkovic",
|
||||
zOrder = IDIYComponent.BOARD, instanceNamePrefix = "Board",
|
||||
description = "Perforated board as found on some Marshall and Trainwreck amps",
|
||||
bomPolicy = BomPolicy.SHOW_ONLY_TYPE_NAME, autoEdit = false, keywordPolicy = KeywordPolicy.SHOW_TYPE_NAME)
|
||||
bomPolicy = BomPolicy.SHOW_ONLY_TYPE_NAME, autoEdit = false, keywordPolicy = KeywordPolicy.SHOW_TAG,
|
||||
keywordTag = "Perf Board")
|
||||
public class MarshallPerfBoard extends AbstractBoard {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -20,7 +20,8 @@ import org.diylc.utils.Constants;
|
||||
|
||||
@ComponentDescriptor(name = "Perf Board w/ Pads", category = "Boards", author = "Branislav Stojkovic",
|
||||
zOrder = IDIYComponent.BOARD, instanceNamePrefix = "Board", description = "Perforated board with solder pads",
|
||||
bomPolicy = BomPolicy.SHOW_ONLY_TYPE_NAME, autoEdit = false, keywordPolicy = KeywordPolicy.SHOW_TYPE_NAME)
|
||||
bomPolicy = BomPolicy.SHOW_ONLY_TYPE_NAME, autoEdit = false, keywordPolicy = KeywordPolicy.SHOW_TAG,
|
||||
keywordTag = "Perf Board")
|
||||
public class PerfBoard extends AbstractBoard {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -14,13 +14,14 @@ import org.diylc.core.VisibilityPolicy;
|
||||
import org.diylc.core.annotations.BomPolicy;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
import org.diylc.core.annotations.KeywordPolicy;
|
||||
import org.diylc.core.measures.Size;
|
||||
import org.diylc.core.measures.SizeUnit;
|
||||
|
||||
@ComponentDescriptor(name = "Copper Trace", author = "Branislav Stojkovic", category = "Connectivity",
|
||||
creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "Trace",
|
||||
description = "Straight copper trace", zOrder = IDIYComponent.TRACE, bomPolicy = BomPolicy.NEVER_SHOW,
|
||||
autoEdit = false)
|
||||
autoEdit = false, keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "PCB")
|
||||
public class CopperTrace extends AbstractLeadedComponent<Void> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -12,12 +12,14 @@ import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.annotations.BomPolicy;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
import org.diylc.core.annotations.KeywordPolicy;
|
||||
import org.diylc.core.measures.Size;
|
||||
import org.diylc.core.measures.SizeUnit;
|
||||
|
||||
@ComponentDescriptor(name = "Curved Trace", author = "Branislav Stojkovic", category = "Connectivity",
|
||||
instanceNamePrefix = "Trace", description = "Curved copper trace with two control points",
|
||||
zOrder = IDIYComponent.TRACE, bomPolicy = BomPolicy.NEVER_SHOW, autoEdit = false)
|
||||
zOrder = IDIYComponent.TRACE, bomPolicy = BomPolicy.NEVER_SHOW, autoEdit = false,
|
||||
keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "PCB")
|
||||
public class CurvedTrace extends AbstractCurvedComponent<Void> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.diylc.core.annotations.AutoCreator;
|
||||
import org.diylc.core.annotations.BomPolicy;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
import org.diylc.core.annotations.KeywordPolicy;
|
||||
import org.diylc.core.annotations.PositiveMeasureValidator;
|
||||
import org.diylc.core.measures.Size;
|
||||
import org.diylc.core.measures.SizeUnit;
|
||||
@@ -23,10 +24,11 @@ import org.diylc.utils.Constants;
|
||||
@AutoCreator(creatorClass = SolderPadAutoCreator.class)
|
||||
@ComponentDescriptor(name = "Solder Pad", category = "Connectivity", author = "Branislav Stojkovic",
|
||||
description = "Copper solder pad, round or square", instanceNamePrefix = "Pad", stretchable = false,
|
||||
zOrder = IDIYComponent.TRACE + 0.1, bomPolicy = BomPolicy.NEVER_SHOW, autoEdit = false)
|
||||
zOrder = IDIYComponent.TRACE + 0.1, bomPolicy = BomPolicy.NEVER_SHOW, autoEdit = false,
|
||||
keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "PCB")
|
||||
public class SolderPad extends AbstractComponent<Void> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public static Size SIZE = new Size(0.09d, SizeUnit.in);
|
||||
public static Size HOLE_SIZE = new Size(0.8d, SizeUnit.mm);
|
||||
|
||||
@@ -27,13 +27,15 @@ import org.diylc.core.Theme;
|
||||
import org.diylc.core.VisibilityPolicy;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
import org.diylc.core.annotations.KeywordPolicy;
|
||||
import org.diylc.core.measures.Size;
|
||||
import org.diylc.core.measures.SizeUnit;
|
||||
import org.diylc.utils.Constants;
|
||||
|
||||
@ComponentDescriptor(name = "Humbucker Pickup", category = "Guitar", author = "Branislav Stojkovic",
|
||||
description = "PAF-style humbucker guitar pickup", stretchable = false, zOrder = IDIYComponent.COMPONENT,
|
||||
instanceNamePrefix = "PKP", autoEdit = false)
|
||||
instanceNamePrefix = "PKP", autoEdit = false, keywordPolicy = KeywordPolicy.SHOW_TAG,
|
||||
keywordTag = "Guitar Wiring Diagram")
|
||||
public class HumbuckerPickup extends AbstractTransparentComponent<String> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -25,13 +25,15 @@ import org.diylc.core.Theme;
|
||||
import org.diylc.core.VisibilityPolicy;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
import org.diylc.core.annotations.KeywordPolicy;
|
||||
import org.diylc.core.measures.Size;
|
||||
import org.diylc.core.measures.SizeUnit;
|
||||
import org.diylc.utils.Constants;
|
||||
|
||||
@ComponentDescriptor(name = "Lever Switch", category = "Guitar", author = "Branislav Stojkovic",
|
||||
description = "Strat-style lever switch", stretchable = false, zOrder = IDIYComponent.COMPONENT,
|
||||
instanceNamePrefix = "SW")
|
||||
instanceNamePrefix = "SW", keywordPolicy = KeywordPolicy.SHOW_TAG,
|
||||
keywordTag = "Guitar Wiring Diagram")
|
||||
public class LeverSwitch extends AbstractTransparentComponent<String> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -28,13 +28,15 @@ import org.diylc.core.Theme;
|
||||
import org.diylc.core.VisibilityPolicy;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
import org.diylc.core.annotations.KeywordPolicy;
|
||||
import org.diylc.core.measures.Size;
|
||||
import org.diylc.core.measures.SizeUnit;
|
||||
import org.diylc.utils.Constants;
|
||||
|
||||
@ComponentDescriptor(name = "Strat Single Coil Pickup", category = "Guitar", author = "Branislav Stojkovic",
|
||||
description = "Strat-style single coil guitar pickup", stretchable = false, zOrder = IDIYComponent.COMPONENT,
|
||||
instanceNamePrefix = "PKP", autoEdit = false)
|
||||
instanceNamePrefix = "PKP", autoEdit = false, keywordPolicy = KeywordPolicy.SHOW_TAG,
|
||||
keywordTag = "Guitar Wiring Diagram")
|
||||
public class SingleCoilPickup extends AbstractTransparentComponent<String> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.diylc.core.CreationMethod;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
import org.diylc.core.annotations.KeywordPolicy;
|
||||
import org.diylc.core.annotations.PositiveMeasureValidator;
|
||||
import org.diylc.core.measures.Capacitance;
|
||||
import org.diylc.core.measures.Size;
|
||||
@@ -16,7 +17,8 @@ import org.diylc.core.measures.SizeUnit;
|
||||
|
||||
@ComponentDescriptor(name = "Capacitor (schematic symbol)", author = "Branislav Stojkovic", category = "Schematics",
|
||||
creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "C",
|
||||
description = "Capacitor schematic symbol with an optional polarity sign", zOrder = IDIYComponent.COMPONENT)
|
||||
description = "Capacitor schematic symbol with an optional polarity sign", zOrder = IDIYComponent.COMPONENT,
|
||||
keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "Schematic")
|
||||
public class CapacitorSymbol extends AbstractSchematicLeadedSymbol<Capacitance> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.diylc.core.CreationMethod;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
import org.diylc.core.annotations.KeywordPolicy;
|
||||
import org.diylc.core.annotations.PositiveMeasureValidator;
|
||||
import org.diylc.core.measures.Current;
|
||||
import org.diylc.core.measures.Inductance;
|
||||
@@ -18,7 +19,8 @@ import org.diylc.core.measures.SizeUnit;
|
||||
|
||||
@ComponentDescriptor(name = "Inductor (schematic symbol)", author = "Branislav Stojkovic", category = "Schematics",
|
||||
creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "L",
|
||||
description = "Inductor schematic symbol", zOrder = IDIYComponent.COMPONENT)
|
||||
description = "Inductor schematic symbol", zOrder = IDIYComponent.COMPONENT,
|
||||
keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "Schematic")
|
||||
public class InductorSymbol extends AbstractSchematicLeadedSymbol<Inductance> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -10,11 +10,13 @@ import java.awt.geom.Rectangle2D;
|
||||
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.KeywordPolicy;
|
||||
import org.diylc.components.semiconductors.AbstractTransistorSymbol;
|
||||
|
||||
@ComponentDescriptor(name = "Potentiometer Symbol", author = "MCbx", category = "Schematics",
|
||||
instanceNamePrefix = " VR", description = "Potentiometer symbol", stretchable = false,
|
||||
zOrder = IDIYComponent.COMPONENT, rotatable = true)
|
||||
zOrder = IDIYComponent.COMPONENT, rotatable = true, keywordPolicy = KeywordPolicy.SHOW_TAG,
|
||||
keywordTag = "Schematic")
|
||||
public class PotentiometerSymbol extends AbstractTransistorSymbol {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.diylc.core.CreationMethod;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
import org.diylc.core.annotations.KeywordPolicy;
|
||||
import org.diylc.core.measures.PowerUnit;
|
||||
import org.diylc.core.measures.Resistance;
|
||||
import org.diylc.core.measures.Size;
|
||||
@@ -16,7 +17,8 @@ import org.diylc.core.measures.SizeUnit;
|
||||
|
||||
@ComponentDescriptor(name = "Resistor (schematic symbol)", author = "Branislav Stojkovic", category = "Schematics",
|
||||
creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "R",
|
||||
description = "Resistor schematic symbol", zOrder = IDIYComponent.COMPONENT)
|
||||
description = "Resistor schematic symbol", zOrder = IDIYComponent.COMPONENT,
|
||||
keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "Schematic")
|
||||
public class ResistorSymbol extends AbstractSchematicLeadedSymbol<Resistance> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -15,7 +15,8 @@ import org.diylc.core.annotations.KeywordPolicy;
|
||||
|
||||
@ComponentDescriptor(name = "BJT Symbol", author = "Branislav Stojkovic", category = "Schematics",
|
||||
instanceNamePrefix = "Q", description = "Bipolar junction transistor schematic symbol", stretchable = false,
|
||||
zOrder = IDIYComponent.COMPONENT, rotatable = true, keywordPolicy = KeywordPolicy.SHOW_VALUE)
|
||||
zOrder = IDIYComponent.COMPONENT, rotatable = true, keywordPolicy = KeywordPolicy.SHOW_TAG_AND_VALUE,
|
||||
keywordTag = "Schematic")
|
||||
public class BJTSymbol extends AbstractTransistorSymbol {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -7,12 +7,13 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.core.CreationMethod;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.KeywordPolicy;
|
||||
import org.diylc.core.measures.Size;
|
||||
import org.diylc.core.measures.SizeUnit;
|
||||
|
||||
@ComponentDescriptor(name = "Diode (schematic symbol)", author = "Branislav Stojkovic", category = "Schematics",
|
||||
creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "D", description = "Diode schematic symbol",
|
||||
zOrder = IDIYComponent.COMPONENT)
|
||||
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "Schematic")
|
||||
public class DiodeSymbol extends AbstractDiodeSymbol {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -33,7 +33,8 @@ import org.diylc.utils.Constants;
|
||||
|
||||
@ComponentDescriptor(name = "IC Symbol", author = "Branislav Stojkovic", category = "Schematics",
|
||||
instanceNamePrefix = "IC", description = "IC symbol with 3 or 5 contacts", stretchable = false,
|
||||
zOrder = IDIYComponent.COMPONENT, rotatable = false, keywordPolicy = KeywordPolicy.SHOW_VALUE)
|
||||
zOrder = IDIYComponent.COMPONENT, rotatable = false, keywordPolicy = KeywordPolicy.SHOW_TAG_AND_VALUE,
|
||||
keywordTag = "Schematic")
|
||||
public class ICSymbol extends AbstractTransparentComponent<String> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -13,7 +13,8 @@ import org.diylc.core.annotations.KeywordPolicy;
|
||||
|
||||
@ComponentDescriptor(name = "JFET Symbol", author = "Branislav Stojkovic", category = "Schematics",
|
||||
instanceNamePrefix = "Q", description = "JFET transistor schematic symbol", stretchable = false,
|
||||
zOrder = IDIYComponent.COMPONENT, rotatable = true, keywordPolicy = KeywordPolicy.SHOW_VALUE)
|
||||
zOrder = IDIYComponent.COMPONENT, rotatable = true, keywordPolicy = KeywordPolicy.SHOW_TAG_AND_VALUE,
|
||||
keywordTag = "Schematic")
|
||||
public class JFETSymbol extends AbstractTransistorSymbol {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -8,10 +8,11 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.core.CreationMethod;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.KeywordPolicy;
|
||||
|
||||
@ComponentDescriptor(name = "LED (schematic symbol)", author = "Branislav Stojkovic", category = "Schematics",
|
||||
creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "D", description = "Diode schematic symbol",
|
||||
zOrder = IDIYComponent.COMPONENT)
|
||||
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "Schematic")
|
||||
public class LEDSymbol extends DiodeSymbol {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -13,7 +13,8 @@ import org.diylc.core.annotations.KeywordPolicy;
|
||||
|
||||
@ComponentDescriptor(name = "MOSFET Symbol", author = "Branislav Stojkovic", category = "Schematics",
|
||||
instanceNamePrefix = "Q", description = "MOSFET transistor schematic symbol", stretchable = false,
|
||||
zOrder = IDIYComponent.COMPONENT, rotatable = true, keywordPolicy = KeywordPolicy.SHOW_VALUE)
|
||||
zOrder = IDIYComponent.COMPONENT, rotatable = true, keywordPolicy = KeywordPolicy.SHOW_TAG_AND_VALUE,
|
||||
keywordTag = "Schematic")
|
||||
public class MOSFETSymbol extends AbstractTransistorSymbol {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
+3
-1
@@ -7,12 +7,14 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.core.CreationMethod;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.KeywordPolicy;
|
||||
import org.diylc.core.measures.Size;
|
||||
import org.diylc.core.measures.SizeUnit;
|
||||
|
||||
@ComponentDescriptor(name = "Schottky diode (schematic symbol)", author = "Branislav Stojkovic",
|
||||
category = "Schematics", creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "D",
|
||||
description = "Schottky diode schematic symbol", zOrder = IDIYComponent.COMPONENT)
|
||||
description = "Schottky diode schematic symbol", zOrder = IDIYComponent.COMPONENT,
|
||||
keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "Schematic")
|
||||
public class SchottkyDiodeSymbol extends AbstractDiodeSymbol {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -7,12 +7,14 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.core.CreationMethod;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.KeywordPolicy;
|
||||
import org.diylc.core.measures.Size;
|
||||
import org.diylc.core.measures.SizeUnit;
|
||||
|
||||
@ComponentDescriptor(name = "Zener diode (schematic symbol)", author = "Branislav Stojkovic", category = "Schematics",
|
||||
creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "D",
|
||||
description = "Zener diode schematic symbol", zOrder = IDIYComponent.COMPONENT)
|
||||
description = "Zener diode schematic symbol", zOrder = IDIYComponent.COMPONENT,
|
||||
keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "Schematic")
|
||||
public class ZenerDiodeSymbol extends AbstractDiodeSymbol {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.plugins.cloud.presenter.CloudException;
|
||||
import org.diylc.plugins.cloud.presenter.CloudPresenter;
|
||||
import org.diylc.swingframework.ButtonDialog;
|
||||
import org.diylc.utils.KeywordExtractor;
|
||||
|
||||
public class UploadDialog extends ButtonDialog {
|
||||
|
||||
@@ -236,8 +237,8 @@ public class UploadDialog extends ButtonDialog {
|
||||
|
||||
private JTextField getKeywordsField() {
|
||||
if (keywordsField == null) {
|
||||
keywordsField = new JTextField();
|
||||
keywordsField.setText(cloudPresenter.extractKeywords(plugInPort.getCurrentProject()));
|
||||
keywordsField = new JTextField();
|
||||
keywordsField.setText(KeywordExtractor.getInstance().extractKeywords(plugInPort.getCurrentProject()));
|
||||
}
|
||||
return keywordsField;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user