added docs

This commit is contained in:
bancika
2011-01-02 13:25:00 +00:00
parent d4e42566a7
commit 4d3bee4ad8
5 changed files with 35 additions and 4 deletions
@@ -10,6 +10,13 @@ import java.util.List;
import com.diyfever.diylc.model.IComponentInstance; import com.diyfever.diylc.model.IComponentInstance;
/**
* Represents component selection as a {@link List} of
* {@link IComponentInstance} 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<IComponentInstance> implements Transferable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@@ -7,6 +7,12 @@ import java.lang.reflect.Method;
import com.diyfever.diylc.model.IComponentInstance; import com.diyfever.diylc.model.IComponentInstance;
import com.diyfever.diylc.model.VisibilityPolicy; import com.diyfever.diylc.model.VisibilityPolicy;
/**
* Entity bean that represents a control point. Has methods for reading/writing
* {@link Point} value from/to a component.
*
* @author Branislav Stojkovic
*/
public class ControlPointWrapper { public class ControlPointWrapper {
private String name; private String name;
@@ -28,11 +34,29 @@ public class ControlPointWrapper {
this.visibilityPolicy = visibilityPolicy; this.visibilityPolicy = visibilityPolicy;
} }
/**
* Reads value from the specified component by invoking it's
* <code>getter</code> method.
*
* @param component
* @throws IllegalArgumentException
* @throws IllegalAccessException
* @throws InvocationTargetException
*/
public void readFrom(IComponentInstance component) throws IllegalArgumentException, public void readFrom(IComponentInstance component) throws IllegalArgumentException,
IllegalAccessException, InvocationTargetException { IllegalAccessException, InvocationTargetException {
value = (Point) getter.invoke(component); value = (Point) getter.invoke(component);
} }
/**
* Writes the value into the specified component by invoking it's
* <code>setter</code> method.
*
* @param component
* @throws IllegalArgumentException
* @throws IllegalAccessException
* @throws InvocationTargetException
*/
public void writeTo(IComponentInstance component) throws IllegalArgumentException, public void writeTo(IComponentInstance component) throws IllegalArgumentException,
IllegalAccessException, InvocationTargetException { IllegalAccessException, InvocationTargetException {
setter.invoke(component, value); setter.invoke(component, value);
@@ -5,9 +5,9 @@ import java.awt.Dimension;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Point; import java.awt.Point;
import java.awt.geom.Area; import java.awt.geom.Area;
import java.util.EnumSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import javax.swing.Action; import javax.swing.Action;
import javax.swing.JComponent; import javax.swing.JComponent;
@@ -88,7 +88,7 @@ public interface IPlugInPort {
* *
* @param g2d * @param g2d
*/ */
void draw(Graphics2D g2d, EnumSet<DrawOption> drawProperties); void draw(Graphics2D g2d, Set<DrawOption> drawProperties);
/** /**
* Injects a custom GUI panels provided by the plug-in and desired position * Injects a custom GUI panels provided by the plug-in and desired position
@@ -167,7 +167,7 @@ public class ClipboardManager implements IPlugIn, ClipboardOwner {
.getData(ComponentSelection.listFlavor); .getData(ComponentSelection.listFlavor);
plugInPort.addComponents(cloner.deepClone(components), null); plugInPort.addComponents(cloner.deepClone(components), null);
} catch (Exception ex) { } catch (Exception ex) {
LOG.error(ex.getMessage()); LOG.error("Coule not paste.", ex);
} }
} }
} }
@@ -196,7 +196,7 @@ public class Presenter implements IPlugInPort {
} }
@Override @Override
public void draw(Graphics2D g2d, EnumSet<DrawOption> drawOptions) { public void draw(Graphics2D g2d, Set<DrawOption> drawOptions) {
if (currentProject == null) { if (currentProject == null) {
return; return;
} }