refactored component framework

This commit is contained in:
bancika
2011-01-04 20:55:35 +00:00
parent 73da0f4a9b
commit a88f0d0a45
31 changed files with 309 additions and 317 deletions
@@ -8,17 +8,17 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.diylc.core.IComponentInstance;
import org.diylc.core.IDIYComponent;
/**
* Represents component selection as a {@link List} of
* {@link IComponentInstance} objects. Implements {@link Transferable}, so it is
* {@link IDIYComponent} objects. Implements {@link Transferable}, so it is
* suitable for clipboard usage.
*
* @author Branislav Stojkovic
*/
public class ComponentSelection extends ArrayList<IComponentInstance> implements Transferable {
public class ComponentSelection extends ArrayList<IDIYComponent> implements Transferable {
private static final long serialVersionUID = 1L;
@@ -28,7 +28,7 @@ public class ComponentSelection extends ArrayList<IComponentInstance> implements
super();
}
public ComponentSelection(Collection<IComponentInstance> selectedComponents) {
public ComponentSelection(Collection<IDIYComponent> selectedComponents) {
super(selectedComponents);
}
@@ -4,7 +4,7 @@ import java.awt.Point;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.diylc.core.IComponentInstance;
import org.diylc.core.IDIYComponent;
import org.diylc.core.VisibilityPolicy;
@@ -44,7 +44,7 @@ public class ControlPointWrapper {
* @throws IllegalAccessException
* @throws InvocationTargetException
*/
public void readFrom(IComponentInstance component) throws IllegalArgumentException,
public void readFrom(IDIYComponent component) throws IllegalArgumentException,
IllegalAccessException, InvocationTargetException {
value = (Point) getter.invoke(component);
}
@@ -58,7 +58,7 @@ public class ControlPointWrapper {
* @throws IllegalAccessException
* @throws InvocationTargetException
*/
public void writeTo(IComponentInstance component) throws IllegalArgumentException,
public void writeTo(IDIYComponent component) throws IllegalArgumentException,
IllegalAccessException, InvocationTargetException {
setter.invoke(component, value);
}
@@ -2,8 +2,8 @@ package org.diylc.common;
import java.awt.Rectangle;
import org.diylc.core.IComponentType;
import org.diylc.core.Project;
import org.diylc.presenter.ComponentType;
/**
@@ -44,7 +44,7 @@ public enum EventType {
REPAINT,
/**
* Called when new component slot has been changed. The only parameter is
* {@link IComponentType} and may be null.
* {@link ComponentType} and may be null.
*/
SLOT_CHANGED,
/**
@@ -15,9 +15,9 @@ import javax.swing.SwingConstants;
import javax.swing.JPopupMenu.Separator;
import org.diylc.core.ComponentLayer;
import org.diylc.core.IComponentInstance;
import org.diylc.core.IComponentType;
import org.diylc.core.IDIYComponent;
import org.diylc.core.Project;
import org.diylc.presenter.ComponentType;
import com.diyfever.gui.simplemq.IMessageListener;
import com.diyfever.gui.simplemq.MessageDispatcher;
@@ -76,13 +76,13 @@ public interface IPlugInPort {
void loadProject(Project project, boolean freshStart);
/**
* Returns all available {@link IComponentType}s classified by category.
* Returns all available {@link ComponentType}s classified by category.
* Result is a {@link Map} between category name to a {@link List} of all
* {@link IComponentType}s that share that category name.
* {@link ComponentType}s that share that category name.
*
* @return
*/
Map<String, List<IComponentType>> getComponentTypes();
Map<String, List<ComponentType>> getComponentTypes();
/**
* Draws project on the provided {@link Graphics2D}.
@@ -175,7 +175,7 @@ public interface IPlugInPort {
*
* @return
*/
Area getComponentArea(IComponentInstance component);
Area getComponentArea(IDIYComponent component);
/**
* Notification that drag has been started from the specified point.
@@ -218,7 +218,7 @@ public interface IPlugInPort {
* @param components
* @param preferredPoint
*/
void addComponents(List<IComponentInstance> components, Point preferredPoint);
void addComponents(List<IDIYComponent> components, Point preferredPoint);
/**
* Checks if a certain layer is locked for editing.
@@ -288,5 +288,5 @@ public interface IPlugInPort {
* Sets the new component slot. Specified component type will be used to
* instantiate new component.
*/
void setNewComponentSlot(IComponentType componentType);
void setNewComponentSlot(ComponentType componentType);
}
@@ -3,7 +3,7 @@ package org.diylc.common;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.diylc.core.IComponentInstance;
import org.diylc.core.IDIYComponent;
/**
@@ -31,12 +31,12 @@ public class PropertyWrapper implements Cloneable {
this.defaultable = defaultable;
}
public void readFrom(IComponentInstance component) throws IllegalArgumentException,
public void readFrom(IDIYComponent component) throws IllegalArgumentException,
IllegalAccessException, InvocationTargetException {
this.value = getter.invoke(component);
}
// public void readUniqueFrom(IComponentInstance component)
// public void readUniqueFrom(IDIYComponent component)
// throws IllegalArgumentException, IllegalAccessException,
// InvocationTargetException {
// Object newValue = getter.invoke(component);
@@ -45,7 +45,7 @@ public class PropertyWrapper implements Cloneable {
// }
// }
public void writeTo(IComponentInstance component) throws IllegalArgumentException,
public void writeTo(IDIYComponent component) throws IllegalArgumentException,
IllegalAccessException, InvocationTargetException {
setter.invoke(component, value);
}