package nl.tudelft.lifetiles.graph.controller;

import java.util.ArrayList;
import java.util.List;

import nl.tudelft.lifetiles.graph.view.Tile;
import nl.tudelft.lifetiles.graph.view.TileView;
import nl.tudelft.lifetiles.graph.view.VertexView;
import javafx.scene.Group;
import javafx.scene.paint.Color;

/**
 * The TileControllers controls what from the model has to be displayed on the
 * screen by given only that info the view.
 *
 */
public class TileController {
    /**
     * the model.
     */
    private Tile modelVar;
    /**
     * The view.
     */
    private TileView viewVar;

    /**
     * Creates a TileController which controls the dataflow.
     *
     * @param view
     *            - the view that draws everything
     * @param model
     *            - the model that holds the data
     */
    public TileController(final TileView view, final Tile model) {
        this.viewVar = view;
        this.modelVar = model;
    }

    /**
     * Change the Colour of a Vertex.
     *
     * @param color
     *            - new color
     * @param v
     *            - to be changed vertex
     */
    public final void changeColour(final Color color, final VertexView v) {
        List<Object> args = new ArrayList<Object>();
        args.add(v);
        args.add(color);
        setChangedProperty("COLOR_CHANGED", args);
    }

    /**
     * Creates a drawable object of the graph from the model.
     *
     * @return Group object to be drawn on the screen
     */
    public final Group drawGraph() {
        return viewVar.drawGraph(modelVar.getGraph());
    }

    /**
     * set a certain changed property with the arguments.
     *
     * @param propertyName
     *            - Name of the property
     * @param args
     *            - Arguments for the function that needs to be called.
     */
    public final void setChangedProperty(final String propertyName,
            final List<Object> args) {

        if (propertyName.equals("COLOR_CHANGED")) {
            viewVar.changeVertexColor((VertexView) args.get(0),
                    (Color) args.get(1));
        }
    }

}

@@ -93,16 +93,76 @@
 .List;%0A%0A
+import javafx.scene.Group;%0Aimport javafx.scene.paint.Color;%0A
 import n
@@ -301,68 +301,8 @@
 iew;
-%0Aimport javafx.scene.Group;%0Aimport javafx.scene.paint.Color;
 %0A%0A/*
@@ -696,26 +696,24 @@
 *           
- -
  the view th
@@ -769,18 +769,16 @@
         
- -
  the mod
@@ -1032,18 +1032,16 @@
         
- -
  new col
@@ -1076,18 +1076,16 @@
         
- -
  to be c
@@ -1694,18 +1694,16 @@
         
- -
  Name of
@@ -1756,10 +1756,8 @@
     
- -
  Arg

Fix javadoc.