package com.kovaciny.primexmodel;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;


public class PrimexModel {
	/*
	 * This section sets up notifying observers about changes.
	 */
	public static final String LINE_SPEED_CHANGE_EVENT = "PrimexModel.SPEED_CHANGE";
		
	// Create PropertyChangeSupport to manage listeners and fire events.
	private final PropertyChangeSupport propChangeSupport = new PropertyChangeSupport(this);
	  
	// Provide delegating methods to add / remove listeners to / from the support class.  
	public void addPropertyChangeListener(PropertyChangeListener l) {
	    propChangeSupport.addPropertyChangeListener(l);
	}

	public void removePropertyChangeListener(PropertyChangeListener l) {
	    propChangeSupport.removePropertyChangeListener(l);
	}

	/*
	 * This section holds the different objects and their relation to each other, getters and setters.
	 */
	
	
	private ProductionLine mPline = new ProductionLine(22,5,5,"blah","blah");
	
	public void changeCurrentLineSpeed(double setpoint){
		if (mPline.getLineSpeed() != setpoint) {
			double oldspeed = mPline.getLineSpeed();
			double newspeed = mPline.setLineSpeed(setpoint, 1);
			propChangeSupport.firePropertyChange(LINE_SPEED_CHANGE_EVENT, oldspeed, newspeed);
		}
	}
	
	public double getCurrentLineSpeed(){
		return mPline.getLineSpeed();
	}
	
	  /*// Simple example of how to fire an event when the value of 'foo' is changed.
	  protected void setFoo(int foo) {
	    if (this.foo != foo) {
	      // Remember previous value, assign new value and then fire event.
	      int oldFoo = this.foo;
	      this.foo = foo;
	      propChangeSupport.firePropertyChange("foo", oldFoo, this.foo);
	    }
	  }*/

}

@@ -115,16 +115,45 @@
 pport;%0D%0A
+import java.util.ArrayList;%0D%0A
 %0D%0A%0D%0Apubl
@@ -968,19 +968,16 @@
  */%0D%0A%09%0D%0A
-%09%0D%0A
 %09private
@@ -977,16 +977,26 @@
 private 
+ArrayList%3C
 Producti
@@ -1005,59 +1005,166 @@
 Line
+%3E
  
-mP
 line
- = new ProductionLine(22,5,5,%22blah%22,%22blah%22);
+sList;%0D%0A%09private ProductionLine mSelectedLine;%0D%0A%09private ArrayList%3CSkid%3E skidsList;%0D%0A%09private Skid mSelectedSkid;%0D%0A%09private Product mSelectedProduct;%0D%0A%09
 %0D%0A%09%0D
@@ -1226,18 +1226,25 @@
 %0A%09%09if (m
-Pl
+SelectedL
 ine.getL
@@ -1288,26 +1288,33 @@
 oldspeed = m
-Pl
+SelectedL
 ine.getLineS
@@ -1344,18 +1344,25 @@
 peed = m
-Pl
+SelectedL
 ine.setL
@@ -1537,404 +1537,40 @@
 rn m
-Pline.getLineSpeed();%0D%0A%09%7D%0D%0A%09%0D%0A%09  /*// Simple example of how to fire an event when the value of 'foo' is changed.%0D%0A%09  protected void setFoo(int foo) %7B%0D%0A%09    if (this.foo != foo) %7B%0D%0A%09      // Remember previous value, assign new value and then fire event.%0D%0A%09      int oldFoo = this.foo;%0D%0A%09      this.foo = foo;%0D%0A%09      propChangeSupport.firePropertyChange(%22foo%22, oldFoo, this.foo);%0D%0A%09    %7D%0D%0A%09  %7D*/%0D%0A
+SelectedLine.getLineSpeed();%0D%0A%09%7D
 %0D%0A%7D%0D

Add some data members