Skip to content

Commit

Permalink
cleanup; test comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mfansler committed Feb 28, 2015
1 parent c1f275e commit 5e78b5b
Show file tree
Hide file tree
Showing 15 changed files with 179 additions and 159 deletions.
17 changes: 15 additions & 2 deletions docs/testDocument.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Our first iteration aimed to include object creation, editing, resizing, copy/pa

Features Left Out
-----------------
During the first iteration, we were unable to implement object editing, object resizing, and copy-paste operation. These features proved to be a bit more involved than initially thought, and were thus unable to be implemented in a meaningful manner for this iteration. However the infrastructure is in place such that iteration two should be able to accomodate these features.
During the first iteration, we were unable to implement object editing, object resizing, and copy-paste operation. These features proved to be a bit more involved than initially thought, and were thus unable to be implemented in a meaningful manner for this iteration. However the infrastructure is in place such that iteration two should be able to accomodate these features. Keyboard commands and menu items were originally intended to be in the first iteration, but did not reach the deadline.

Test Cases
----------
Expand Down Expand Up @@ -42,4 +42,17 @@ Status:Passed
Status:Failed
Reason for Failure: Pane not properly coded to allow updating of object model.
Objects do not update on changes.


Relations
11) Create association by dragging between two class objects while in Create Association mode.
Status: Passed
12) Create dependency by dragging between two class objects while in Create Dependency mode.
Status: Passed
13) Delete relation by clicking on relation while in Delete mode.
Status: Effective Failure
Reason for Failure: For deletion to occur, the user must click exactly on the line, which is impractical.
A means of expanding the clickable area for lines must be identified in future iterations.
14) Dragging of objects that have relations properly drags associated relations.
Status: Passed
15) Deletion of objects with relations results in deletion of associated relations.
Status: Passed
9 changes: 7 additions & 2 deletions src/edu/millersville/cs/bitsplease/GUIController.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
import edu.millersville.cs.bitsplease.model.*;
import edu.millersville.cs.bitsplease.view.*;


/**
* Controls the state of the GUI, listens to user events, and coordinates
* the propagation of responses throughout the rest of the application.
*/
public class GUIController implements ChangeListener<Toggle>, EventHandler<MouseEvent> {

private UMLEditorPane editorPane;
Expand Down Expand Up @@ -89,15 +94,15 @@ public void setCurrentEditorAction(EditorAction newEditorAction) {
editorPane.getToolBarPane().setSelectedEditorAction(newEditorAction);
}

// EVENT HANDLERS

@Override
public void changed(ObservableValue<? extends Toggle> observable,
Toggle oldValue, Toggle newValue) {
if (newValue != null) {
currentEditorAction = (EditorAction) newValue.getUserData();
}
}

// EVENT HANDLERS

/**
* Provides MouseEvent handling for DocumentViewPane
Expand Down
7 changes: 2 additions & 5 deletions src/edu/millersville/cs/bitsplease/model/UMLClassSymbol.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

import javafx.geometry.Point2D;



public class UMLClassSymbol extends UMLObjectSymbol {

private String[] classAttributes = new String[10];
Expand Down Expand Up @@ -204,14 +202,13 @@ public void setOrigin(Point2D p){
}

public void setX(double x){

setOrigin(new Point2D(x, getY()));
}

public void setY(double y){

setOrigin(new Point2D(getX(), y));
}


public void setHeight(double h){
super.setHeight(h);
}
Expand Down
264 changes: 132 additions & 132 deletions src/edu/millersville/cs/bitsplease/model/UMLDocument.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,147 +10,147 @@
import javafx.geometry.Point2D;

public class UMLDocument {

private ArrayList<UMLSymbol> objectList;
private String fileName;
private UMLObjectSymbol selectedObject;

private ArrayList<UMLSymbol> objectList;
private String fileName;
private UMLObjectSymbol selectedObject;

public UMLDocument(){
this.objectList = new ArrayList<UMLSymbol>();
this.fileName = "Untitled Document";
}

public UMLDocument(String file){
this.objectList = new ArrayList<UMLSymbol>();
this.fileName = file;
}

public UMLDocument(ArrayList<UMLSymbol> objects){
this.objectList = objects;
this.fileName = "Untitled Document";
}

public UMLDocument(ArrayList<UMLSymbol> objects, String file){
this.objectList = objects;
this.fileName = file;
}

/**
* Accessor Methods
*/

/**
*
* @return List of UMLSymbols currently held by the UMLDocument object
*/
public ArrayList<UMLSymbol> getObjectList(){
return this.objectList;
}

public String getFileName(){
return this.fileName;
}

/**
* Filters object list and returns a new ArrayList of UMLObjectSymbol instances
* @return ArrayList<UMLObjectSymbol> objects List of all UMLObjectSymbol instances within the UMLDocument
*/
public ArrayList<UMLObjectSymbol> getObjects(){
public UMLDocument(){
this.objectList = new ArrayList<UMLSymbol>();
this.fileName = "Untitled Document";
}

ArrayList<UMLObjectSymbol> objects = new ArrayList<UMLObjectSymbol>();
public UMLDocument(String file){
this.objectList = new ArrayList<UMLSymbol>();
this.fileName = file;
}

for(UMLSymbol obj:this.objectList){
if(obj instanceof UMLObjectSymbol){
objects.add((UMLObjectSymbol)obj);
}
public UMLDocument(ArrayList<UMLSymbol> objects){
this.objectList = objects;
this.fileName = "Untitled Document";
}

public UMLDocument(ArrayList<UMLSymbol> objects, String file){
this.objectList = objects;
this.fileName = file;
}

/**
* Accessor Methods
*/

/**
*
* @return List of UMLSymbols currently held by the UMLDocument object
*/
public ArrayList<UMLSymbol> getObjectList(){
return this.objectList;
}
return objects;
}

/**
* Method to filter list of UMLSymbols to return
* all instances of UMLRelationSymbols held by a UMLDocument.
* @return ArrayList<UMLObjectSymbol> relations: List of all UMLRelationSymbol instances in UMLDocument.
*/
public ArrayList<UMLRelationSymbol> getRelations(){

ArrayList<UMLRelationSymbol> relations = new ArrayList<UMLRelationSymbol>();
public String getFileName(){
return this.fileName;
}

for(UMLSymbol rel:this.objectList){
if(rel instanceof UMLRelationSymbol){
relations.add((UMLRelationSymbol) rel);
/**
* Filters object list and returns a new ArrayList of UMLObjectSymbol instances
* @return ArrayList<UMLObjectSymbol> objects List of all UMLObjectSymbol instances within the UMLDocument
*/
public ArrayList<UMLObjectSymbol> getObjects(){

ArrayList<UMLObjectSymbol> objects = new ArrayList<UMLObjectSymbol>();

for(UMLSymbol obj:this.objectList){
if(obj instanceof UMLObjectSymbol){
objects.add((UMLObjectSymbol)obj);
}
}
return objects;
}
return relations;
}

/**
*
* @return currently selected UMLSymbol
*/
public UMLObjectSymbol getSelectedObject(){
return this.selectedObject;
}

/**
*
* @param fileName plaintext name of UMLDocument
*/
public void setFileName(String fileName){
this.fileName = fileName;
}

/**
* Assign a list of UMLSymbols to current UMLDocument object
* @param obj list of UMLSymbols to assign to current UMLDocument object
*/
public void setObjectList(ArrayList<UMLSymbol> obj){
this.objectList = obj;
}

/******************************************
* List operations
******************************************/
/**
*
* @param relationType Type of relation to assign to newly created relation
* @param source UMLObjectSymbol from which the relation originates
* @param target UMLObjectSymbol to which the relation points
*/
public void addRelation(UMLRelationType relationType,
UMLObjectSymbol source, UMLObjectSymbol target){

objectList.add(new UMLRelationSymbol(source, target, relationType));
}

public void addRelation(UMLRelationSymbol relation) {
objectList.add(relation);
}

/**
* Add a UMLObjectSymbol to the UMLDocument
* @param origin point at which to instantiate object symbol
* @param height height of instantiated object symbol.
* @param width width of instantiated object symbol.
*/
public void addObject(Point2D origin, double height, double width){
/**
* Method to filter list of UMLSymbols to return
* all instances of UMLRelationSymbols held by a UMLDocument.
* @return ArrayList<UMLObjectSymbol> relations: List of all UMLRelationSymbol instances in UMLDocument.
*/
public ArrayList<UMLRelationSymbol> getRelations(){

ArrayList<UMLRelationSymbol> relations = new ArrayList<UMLRelationSymbol>();

for(UMLSymbol rel:this.objectList){
if(rel instanceof UMLRelationSymbol){
relations.add((UMLRelationSymbol) rel);
}
}
return relations;
}

objectList.add(new UMLObjectSymbol(origin, height, width));
}
/**
* Remove UMLSymbol from UMLDocuments symbol list at specified index.
* @param i index at which to remove UMLSymbol.
*/
public void removeSymbol(int i){
objectList.remove(i);
}

public void addClass(double x, double y, int prefWidth, int prefHeight) {
objectList.add(new UMLClassSymbol(new Point2D(x, y), prefWidth, prefHeight));
}

public void addClass(UMLClassSymbol umlClassSymbol) {
objectList.add(umlClassSymbol);
}
/**
*
* @return currently selected UMLSymbol
*/
public UMLObjectSymbol getSelectedObject(){
return this.selectedObject;
}

/**
*
* @param fileName plaintext name of UMLDocument
*/
public void setFileName(String fileName){
this.fileName = fileName;
}

/**
* Assign a list of UMLSymbols to current UMLDocument object
* @param obj list of UMLSymbols to assign to current UMLDocument object
*/
public void setObjectList(ArrayList<UMLSymbol> obj){
this.objectList = obj;
}

/******************************************
* List operations
******************************************/
/**
*
* @param relationType Type of relation to assign to newly created relation
* @param source UMLObjectSymbol from which the relation originates
* @param target UMLObjectSymbol to which the relation points
*/
public void addRelation(UMLRelationType relationType,
UMLObjectSymbol source, UMLObjectSymbol target){

objectList.add(new UMLRelationSymbol(source, target, relationType));
}

public void addRelation(UMLRelationSymbol relation) {
objectList.add(relation);
}

/**
* Add a UMLObjectSymbol to the UMLDocument
* @param origin point at which to instantiate object symbol
* @param height height of instantiated object symbol.
* @param width width of instantiated object symbol.
*/
public void addObject(Point2D origin, double height, double width){

objectList.add(new UMLObjectSymbol(origin, height, width));
}
/**
* Remove UMLSymbol from UMLDocuments symbol list at specified index.
* @param i index at which to remove UMLSymbol.
*/
public void removeSymbol(int i){
objectList.remove(i);
}

public void addClass(double x, double y, int prefWidth, int prefHeight) {
objectList.add(new UMLClassSymbol(new Point2D(x, y), prefWidth, prefHeight));
}

public void addClass(UMLClassSymbol umlClassSymbol) {
objectList.add(umlClassSymbol);
}

}
3 changes: 0 additions & 3 deletions src/edu/millersville/cs/bitsplease/model/UMLObjectSymbol.java
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,4 @@ public void setSelectedStatus(boolean status){
this.isSelected = status;
}




}
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ public UMLRelationSymbol(UMLObjectSymbol sourceObject,
this.relationType = UMLRelationType.ASSOCIATION;
}



/********************************************************************/
// Getters & Setters

Expand Down Expand Up @@ -91,7 +89,6 @@ public UMLObjectSymbol getTargetObject() {
public void setTargetObject(UMLObjectSymbol targetObject) {
this.targetObject = targetObject;
}


public Event dispatchEvent(Event event, EventDispatchChain tail){
return event;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* @since February 25, 2015
* @version 0.1.0
*/

package edu.millersville.cs.bitsplease.view;

import java.util.function.Predicate;
Expand Down
Loading

0 comments on commit 5e78b5b

Please sign in to comment.