move section handling to base component interface

do analysis in background thread
This commit is contained in:
Branislav Stojkovic
2019-03-09 18:01:42 +01:00
parent 1c1ec2fcf5
commit 7af919b303
8 changed files with 98 additions and 59 deletions
@@ -291,5 +291,11 @@ public abstract class AbstractComponent<T> implements IDIYComponent<T> {
@Override
public String getInternalLinkName(int index1, int index2) {
return null;
}
}
@Override
public String getSectionName(int pointIndex) {
return null;
}
}
@@ -24,7 +24,7 @@ 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;
@@ -128,7 +128,13 @@ public interface IDIYComponent<T> extends Serializable {
* @param index2
* @return name of the internal linked formed by the two control points, null if they do not form an internal link
*/
String getInternalLinkName(int index1, int index2);
String getInternalLinkName(int index1, int index2);
/**
* @param pointIndex name of the internal section containing the specified point, or null if the component does not have internal sections.
* @return
*/
String getSectionName(int pointIndex);
/**
* Draws the component onto the {@link Graphics2D}.
@@ -48,7 +48,8 @@ public class Node implements Comparable<Node> {
}
public String getDisplayName() {
return component.getControlPointNodeName(pointIndex);
String section = component.getSectionName(pointIndex);
return (section == null ? "" : section + ".") + component.getControlPointNodeName(pointIndex);
}
@Override