Skip to content

Commit

Permalink
Merge pull request #111 from gonuke/add_archedocs
Browse files Browse the repository at this point in the history
Looks good Paul!

Thanks!
  • Loading branch information
FlanFlanagan committed Jun 7, 2015
2 parents 4b56459 + b4cea1c commit 1828368
Show file tree
Hide file tree
Showing 11 changed files with 70 additions and 70 deletions.
4 changes: 2 additions & 2 deletions cyclist/src/edu/utexas/cycic/Clones.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ static void addClone(String name, final facilityNode parent, Boolean parentChild

// Adding the facility menu //
final Menu menu1 = new Menu((String) clone.name);
MenuItem facForm = new MenuItem("Facility Form");
MenuItem facForm = new MenuItem("Configure");
MenuItem delete = new MenuItem("Delete");
delete.setOnAction(new EventHandler<ActionEvent>(){
public void handle(ActionEvent e){
Expand Down Expand Up @@ -125,7 +125,7 @@ public void handle(MouseEvent event){

Dragboard db = clone.startDragAndDrop(TransferMode.COPY);
ClipboardContent content = new ClipboardContent();
content.put( DnD.TOOL_FORMAT, "Facility Form");
content.put( DnD.TOOL_FORMAT, "Configure");
db.setContent(content);

// DnDIcon.getInstance().show(icon, title);
Expand Down
2 changes: 2 additions & 0 deletions cyclist/src/edu/utexas/cycic/Cycic.java
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ public void handle(DragEvent event){
if(DataArrays.simFacilities.get(i).facilityName.equalsIgnoreCase(facility.facilityType)){
facility.facilityStructure = DataArrays.simFacilities.get(i).facStruct;
facility.niche = DataArrays.simFacilities.get(i).niche;
facility.doc = DataArrays.simFacilities.get(i).doc;
facility.archetype = DataArrays.simFacilities.get(i).facilityArch;
}
}
Expand Down Expand Up @@ -415,6 +416,7 @@ public void handle(ActionEvent event){
if(DataArrays.simFacilities.get(i).facilityName.equalsIgnoreCase(facility.facilityType)){
facility.facilityStructure = DataArrays.simFacilities.get(i).facStruct;
facility.niche = DataArrays.simFacilities.get(i).niche;
facility.doc = DataArrays.simFacilities.get(i).doc;
facility.archetype = DataArrays.simFacilities.get(i).facilityArch;
}
}
Expand Down
14 changes: 11 additions & 3 deletions cyclist/src/edu/utexas/cycic/CycicCircles.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import edu.utah.sci.cyclist.core.controller.CyclistController;
import edu.utexas.cycic.tools.FormBuilderTool;
import edu.utexas.cycic.FormBuilder;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.control.Alert;
Expand Down Expand Up @@ -87,7 +88,14 @@ public void handle(ActionEvent event) {
}
};
facForm.setOnAction(circleAction);


MenuItem helpDialog = new MenuItem("Facility Documentation");
helpDialog.setOnAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent e){
FormBuilder.showHelpDialog(parent.doc);
}
});

circle.image.setLayoutX(circle.getCenterX()-60);
circle.image.setLayoutY(circle.getCenterY()-60);

Expand Down Expand Up @@ -137,7 +145,7 @@ public void handle(ActionEvent e){
circle.setOpacity(100); }
});

circle.menu.getItems().addAll(facForm, changeNiche, delete, showImage, hideImage);
circle.menu.getItems().addAll(facForm, helpDialog, changeNiche, delete, showImage, hideImage);

// Piece of test code for changing the look of the facility circles.
//circle.image.setImage(new Image("reactor.png"));
Expand Down Expand Up @@ -275,7 +283,7 @@ public void handle(MouseEvent event){
Dragboard db = circle.startDragAndDrop(TransferMode.COPY);
//Dragboard db = circle.startDragAndDrop(TransferMode.NONE);
ClipboardContent content = new ClipboardContent();
content.put(DnD.TOOL_FORMAT, "Facility Form");
content.put(DnD.TOOL_FORMAT, "Configure");
db.setContent(content);
Line line = new Line();
Cycic.pane.getChildren().add(line);
Expand Down
9 changes: 9 additions & 0 deletions cyclist/src/edu/utexas/cycic/DataArrays.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ public static void retrieveSchema(String rawMetadata) {
node.facAnnotations = anno.toString();
node.facilityArch = spec;
node.niche = anno.getString("niche", "facility");
node.doc = anno.getString("doc", "facility");
JsonObject facVars = anno.getJsonObject("vars");
ArrayList<Object> facArray = new ArrayList<Object>();
node.facStruct = XMLReader.nodeBuilder(facVars, facArray, XMLReader.readSchema_new(schema));
Expand All @@ -124,6 +125,7 @@ public static void retrieveSchema(String rawMetadata) {
regionStructure rNode = new regionStructure();
rNode.regionAnnotations = anno.toString();
rNode.regionArch = spec;
rNode.doc = anno.getString("doc","region");
JsonObject regionVars = anno.getJsonObject("vars");
ArrayList<Object> regionArray = new ArrayList<Object>();
rNode.regionStruct = XMLReader.nodeBuilder(regionVars,regionArray, XMLReader.readSchema_new(schema));
Expand All @@ -135,6 +137,7 @@ public static void retrieveSchema(String rawMetadata) {
institutionStructure iNode = new institutionStructure();
iNode.institArch = spec;
iNode.institAnnotations = anno.toString();
iNode.doc = anno.getString("doc","institution");
JsonObject instVars = anno.getJsonObject("vars");
ArrayList<Object> instArray = new ArrayList<Object>();
iNode.institStruct = XMLReader.nodeBuilder(instVars, instArray, XMLReader.readSchema_new(schema));
Expand Down Expand Up @@ -185,6 +188,7 @@ class facilityStructure {
String facilityName;
String facilityArch;
String niche;
String doc;
ArrayList<Object> facStruct = new ArrayList<Object>();
String facSchema;
String facAnnotations;
Expand Down Expand Up @@ -214,6 +218,7 @@ void setStruct(ArrayList<Object> struct){
*/
class regionStructure {
String regionName;
String doc;
String regionArch;
String regionSchema;
String regionAnnotations;
Expand Down Expand Up @@ -246,6 +251,7 @@ class institutionStructure {
String institArch;
String institSchema;
String institAnnotations;
String doc;
ArrayList<Object> institStruct = new ArrayList<Object>();


Expand Down Expand Up @@ -337,6 +343,7 @@ class regionNode{
String type = new String();
String entity;
String archetype;
String doc;
ArrayList<Object> regionStruct = new ArrayList<Object>();
ArrayList<Object> regionData = new ArrayList<Object>();
ArrayList<String> institutions = new ArrayList<String>();
Expand All @@ -355,6 +362,7 @@ class instituteNode{
String type;
String entity;
String archetype;
String doc;
ArrayList<Object> institStruct = new ArrayList<Object>();
ArrayList<Object> institData = new ArrayList<Object>();
Map<String, Integer> availFacilities = new HashMap<String, Integer>();
Expand Down Expand Up @@ -387,6 +395,7 @@ class facilityNode{
FacilityCircle cycicCircle = new FacilityCircle();
FacilityCircle sorterCircle = new FacilityCircle();
protected String niche;
protected String doc;
public String archetype;
}

Expand Down
58 changes: 22 additions & 36 deletions cyclist/src/edu/utexas/cycic/FormBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,25 @@ public void handle(ActionEvent e) {
return button;
}

public static void showHelpDialog(String help) {
Dialog dg = new Dialog();
ButtonType loginButtonType = new ButtonType("Ok", ButtonData.OK_DONE);
dg.setContentText(help);
dg.getDialogPane().getButtonTypes().addAll(loginButtonType, ButtonType.CANCEL);
dg.show();
}

public static EventHandler<MouseEvent> helpDialogHandler(String help) {
return new EventHandler<MouseEvent>() {
public void handle(MouseEvent e){
if(e.getClickCount() == 2){
showHelpDialog(help);
}
}
};
}


/**
* This function builds an input form from the data structures associated
* with a facility.
Expand All @@ -178,18 +197,7 @@ public void formBuilder(GridPane grid, ArrayList<Object> facArray, ArrayList<Obj
name.setText((String) facArray.get(0));
}
name.setTooltip(new Tooltip((String)facArray.get(7)));
String help = (String) facArray.get(8);
name.setOnMouseClicked(new EventHandler<MouseEvent>(){
public void handle(MouseEvent e){
if(e.getClickCount() == 2){
Dialog dg = new Dialog();
ButtonType loginButtonType = new ButtonType("Ok", ButtonData.OK_DONE);
dg.setContentText(help);
dg.getDialogPane().getButtonTypes().addAll(loginButtonType, ButtonType.CANCEL);
dg.show();
}
}
});
name.setOnMouseClicked(FormBuilder.helpDialogHandler( (String) facArray.get(8)));
grid.add(name, columnNumber, rowNumber);
grid.add(orMoreAddButton(grid, (ArrayList<Object>) facArray, (ArrayList<Object>) dataArray), columnNumber+1, rowNumber);
rowNumber += 1;
Expand Down Expand Up @@ -217,18 +225,7 @@ public void handle(MouseEvent e){
name.setText((String) facArray.get(0));
}
name.setTooltip(new Tooltip((String)facArray.get(7)));
String help = (String) facArray.get(8);
name.setOnMouseClicked(new EventHandler<MouseEvent>(){
public void handle(MouseEvent e){
if(e.getClickCount() == 2){
Dialog dg = new Dialog();
ButtonType loginButtonType = new ButtonType("Ok", ButtonData.OK_DONE);
dg.setContentText(help);
dg.getDialogPane().getButtonTypes().addAll(loginButtonType, ButtonType.CANCEL);
dg.show();
}
}
});
name.setOnMouseClicked(FormBuilder.helpDialogHandler( (String) facArray.get(8)));
grid.add(name, columnNumber, rowNumber);
grid.add(orMoreAddButton(grid, (ArrayList<Object>) facArray, (ArrayList<Object>) dataArray), columnNumber+1, rowNumber);
rowNumber += 1;
Expand Down Expand Up @@ -288,18 +285,7 @@ public void handle(MouseEvent e){
name.setText((String) facArray.get(0));
}
name.setTooltip(new Tooltip((String) facArray.get(7)));
String help = (String) facArray.get(8);
name.setOnMouseClicked(new EventHandler<MouseEvent>(){
public void handle(MouseEvent e){
if(e.getClickCount() == 2){
Dialog dg = new Dialog();
ButtonType loginButtonType = new ButtonType("Ok", ButtonData.OK_DONE);
dg.setContentText(help);
dg.getDialogPane().getButtonTypes().addAll(loginButtonType, ButtonType.CANCEL);
dg.show();
}
}
});
name.setOnMouseClicked(FormBuilder.helpDialogHandler( (String) facArray.get(8)));
grid.add(name, columnNumber, rowNumber);
// Setting up the input type for the label
if (facArray.get(4) != null){
Expand Down
1 change: 1 addition & 0 deletions cyclist/src/edu/utexas/cycic/InstitutionCorralView.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public void handle(DragEvent event){
for (int i = 0; i < DataArrays.simInstitutions.size(); i++){
if(DataArrays.simInstitutions.get(i).institName.equalsIgnoreCase(institute.type)){
institute.institStruct = DataArrays.simInstitutions.get(i).institStruct;
institute.doc = DataArrays.simInstitutions.get(i).doc;
institute.archetype = DataArrays.simInstitutions.get(i).institArch;
}
}
Expand Down
10 changes: 9 additions & 1 deletion cyclist/src/edu/utexas/cycic/InstitutionShape.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@ public void handle(ActionEvent event){
}
});

MenuItem helpDialog = new MenuItem("Institution Documentation");
helpDialog.setOnAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent e){
FormBuilder.showHelpDialog(instit.doc);
}
});


EventHandler<ActionEvent> deleteEvent = new EventHandler<ActionEvent>() {
public void handle(ActionEvent deleteEvent) {
deleteInstitution(institution, instit);
Expand All @@ -118,7 +126,7 @@ public void handle(ActionEvent exitEvent) {
exit.setOnAction(exitEvent);

final Menu menu = new Menu("Options");
menu.getItems().addAll(regionForm, delete, exit);
menu.getItems().addAll(regionForm, helpDialog, delete, exit);

institution.menuBar.getMenus().add(menu);
institution.menuBar.setLayoutX(institution.getLayoutX());
Expand Down
1 change: 1 addition & 0 deletions cyclist/src/edu/utexas/cycic/RegionCorralView.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public void handle(DragEvent event){
for (int i = 0; i < DataArrays.simRegions.size(); i++){
if(DataArrays.simRegions.get(i).regionName.equalsIgnoreCase(region.type)){
region.regionStruct = DataArrays.simRegions.get(i).regionStruct;
region.doc = DataArrays.simRegions.get(i).doc;
region.archetype = DataArrays.simRegions.get(i).regionArch;
}
}
Expand Down
10 changes: 9 additions & 1 deletion cyclist/src/edu/utexas/cycic/RegionShape.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ public void handle(ActionEvent event){
}
});

MenuItem helpDialog = new MenuItem("Region Documentation");
helpDialog.setOnAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent e){
FormBuilder.showHelpDialog(region.doc);
}
});


EventHandler<ActionEvent> deleteEvent = new EventHandler<ActionEvent>() {
public void handle(ActionEvent deleteEvent) {
deleteRegion(rect, region);
Expand All @@ -102,7 +110,7 @@ public void handle(ActionEvent exitEvent) {
exit.setOnAction(exitEvent);

final Menu menu = new Menu("Options");
menu.getItems().addAll(regionForm, delete, exit);
menu.getItems().addAll(regionForm, helpDialog, delete, exit);

rect.menuBar.getMenus().add(menu);
rect.menuBar.setLayoutX(rect.getX());
Expand Down
27 changes: 2 additions & 25 deletions cyclist/src/edu/utexas/cycic/RegionView.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ public void handle(ActionEvent event){
*/
@SuppressWarnings("unchecked")
public void formBuilder(ArrayList<Object> facArray, ArrayList<Object> dataArray){
System.out.println(facArray);
if (facArray.size() == 0){
grid.add(new Label("This archetype has no form to fill out."), 0, 0);
return;
Expand All @@ -167,18 +166,7 @@ public void formBuilder(ArrayList<Object> facArray, ArrayList<Object> dataArray)
name.setText((String) facArray.get(0));
}
name.setTooltip(new Tooltip((String)facArray.get(7)));
String help = (String) facArray.get(8);
name.setOnMouseClicked(new EventHandler<MouseEvent>(){
public void handle(MouseEvent e){
if(e.getClickCount() == 2){
Dialog dg = new Dialog();
ButtonType loginButtonType = new ButtonType("Ok", ButtonData.OK_DONE);
dg.setContentText(help);
dg.getDialogPane().getButtonTypes().addAll(loginButtonType, ButtonType.CANCEL);
dg.show();
}
}
});
name.setOnMouseClicked(FormBuilder.helpDialogHandler( (String) facArray.get(8)));
grid.add(name, columnNumber, rowNumber);
grid.add(orMoreAddButton(grid, (ArrayList<Object>) facArray, (ArrayList<Object>) dataArray), columnNumber+1, rowNumber);
rowNumber += 1;
Expand Down Expand Up @@ -206,18 +194,7 @@ public void handle(MouseEvent e){
name.setText((String) facArray.get(0));
}
name.setTooltip(new Tooltip((String)facArray.get(7)));
String help = (String) facArray.get(8);
name.setOnMouseClicked(new EventHandler<MouseEvent>(){
public void handle(MouseEvent e){
if(e.getClickCount() == 2){
Dialog dg = new Dialog();
ButtonType loginButtonType = new ButtonType("Ok", ButtonData.OK_DONE);
dg.setContentText(help);
dg.getDialogPane().getButtonTypes().addAll(loginButtonType, ButtonType.CANCEL);
dg.show();
}
}
});
name.setOnMouseClicked(FormBuilder.helpDialogHandler( (String) facArray.get(8)));
grid.add(name, columnNumber, rowNumber);
grid.add(orMoreAddButton(grid, (ArrayList<Object>) facArray, (ArrayList<Object>) dataArray), columnNumber+1, rowNumber);
rowNumber += 1;
Expand Down
4 changes: 2 additions & 2 deletions cyclist/src/edu/utexas/cycic/SorterCircles.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ static FacilityCircle addNode(String name, final facilityNode parent, final faci

// Adding the menu and it's menu items.
final Menu menu1 = new Menu("Options");
MenuItem facForm = new MenuItem("Facility Form");
MenuItem facForm = new MenuItem("Configure");
MenuItem delete = new MenuItem("Delete");

delete.setOnAction(new EventHandler<ActionEvent>(){
Expand Down Expand Up @@ -159,7 +159,7 @@ public void handle(MouseEvent event){

Dragboard db = circle.startDragAndDrop(TransferMode.COPY);
ClipboardContent content = new ClipboardContent();
content.put( DnD.TOOL_FORMAT, "Facility Form");
content.put( DnD.TOOL_FORMAT, "Configure");
db.setContent(content);

event.consume();
Expand Down

0 comments on commit 1828368

Please sign in to comment.