Skip to content

Commit

Permalink
Resize buttons. Fix direction getting buttons.
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmcd25 committed Apr 19, 2017
1 parent 22b8d2c commit 68a65f8
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 16 deletions.
Binary file modified hospitalDB/db.lck
Binary file not shown.
Binary file modified hospitalDB/log/log.ctrl
Binary file not shown.
Binary file modified hospitalDB/log/log1.dat
Binary file not shown.
Binary file modified hospitalDB/log/logmirror.ctrl
Binary file not shown.
2 changes: 1 addition & 1 deletion src/controllers/DirectionsViewController.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private void initialize() {
for(JFXButton b: mapController.getFloorButtons()) {
b.setOnAction(event -> {
mapController.clearOverlay();
mapController.setFloor(Integer.parseInt(b.getText().substring(0,1)));
mapController.setFloor(Integer.parseInt(b.getText()));
mapController.drawPath(path);
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/admin/ManageMapViewController.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ private void initialize() {
mapContainer.getChildren().add(adminMapController.getRoot());

for(JFXButton b: adminMapController.getMapController().getFloorButtons()) {
b.setOnAction(event -> setFloor(b.getText()));
b.setOnAction(event -> setFloor(Utils.strForNum(Integer.parseInt(b.getText())) + " Floor"));
}

// floors.getItems().addAll(floorList);
Expand Down
33 changes: 20 additions & 13 deletions src/controllers/map/MapController.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.jfoenix.controls.JFXButton;
import controllers.AbstractController;
import controllers.IClickableController;
import core.Utils;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
Expand Down Expand Up @@ -100,10 +101,14 @@ public void clearOverlay() {
overlay.getChildren().add(canvas);
}

public void enableAllButtons() {
enableButtons(new ArrayList<>(Arrays.asList("1st Floor", "2nd Floor", "3rd Floor", "4th Floor", "5th Floor", "6th Floor", "7th Floor")));
}

public void enableButtons(ArrayList<String> floors) {
floorVBox.getChildren().clear();
for(JFXButton b : this.floorButtons) {
if(floors.contains(b.getText())) {
if(floors.contains(Utils.strForNum(Integer.parseInt(b.getText())) + " Floor")) {
floorVBox.getChildren().add(b);
}
}
Expand Down Expand Up @@ -198,33 +203,35 @@ private void replaceAllNodes(Collection<Node> nodes){
}

private void addFloorButtons() {
ArrayList<String> floorList = new ArrayList<String>(Arrays.asList("1st Floor", "2nd Floor","3rd Floor", "4th Floor", "5th Floor", "6th Floor", "7th Floor"));
ArrayList<String> floorList = new ArrayList<String>(Arrays.asList("1", "2","3", "4", "5", "6", "7"));
int wid = 36;

this.zoomOut = new JFXButton();
zoomOut.setText("-");
zoomOut.setOnAction(event -> sceneGestures.zoomOut());
zoomOut.setPrefWidth(wid);
zoomOut.getStylesheets().add("@../../views/style.css");
zoomOut.getStyleClass().add("floor-button");
floorVBox.getChildren().add(zoomOut);

for(String s : floorList) {
JFXButton floor = new JFXButton();
floor.setText(s);
floor.setOnAction(event -> setFloor(floorList.indexOf(s) + 1));
floor.setPrefWidth(115);
floor.setPrefWidth(wid);
floor.getStylesheets().add("@../../views/style.css");
floor.getStyleClass().add("content-button");
floor.getStyleClass().add("floor-button");
floorVBox.getChildren().add(floor);
floorButtons.add(floor);
}

this.zoomIn = new JFXButton();
zoomIn.setText("+");
zoomIn.setOnAction(event -> sceneGestures.zoomIn());
zoomIn.setMinWidth(wid);
zoomIn.getStylesheets().add("@../../views/style.css");
zoomIn.getStyleClass().add("content-button");
zoomIn.getStyleClass().add("floor-button");
floorVBox.getChildren().add(zoomIn);

this.zoomOut = new JFXButton();
zoomOut.setText("-");
zoomOut.setOnAction(event -> sceneGestures.zoomOut());
zoomOut.getStylesheets().add("@../../views/style.css");
zoomOut.getStyleClass().add("content-button");
floorVBox.getChildren().add(zoomOut);

floorVBox.toFront();
}

Expand Down
13 changes: 13 additions & 0 deletions src/controllers/mapView/DrawerController.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package controllers.mapView;

import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXHamburger;
import com.jfoenix.controls.JFXTextField;
import controllers.AbstractController;
Expand Down Expand Up @@ -204,6 +205,17 @@ private void findPath() {
drawPath.accept(path);
// show the directions
showDirections(path.getDirections());
mapController.setFloor(path.getStart().getFloor());
// bind actions
for(JFXButton b: mapController.getFloorButtons()) {
b.setOnAction(event -> {
mapController.clearOverlay();
mapController.setFloor(Integer.parseInt(b.getText()));
mapController.drawPath(path);
});
}
mapController.enableButtons(path.getFloorsSpanning());

} catch (PathNotFoundException | NearestNotFoundException | FloorNotReachableException e) {
e.printStackTrace();
}
Expand Down Expand Up @@ -244,6 +256,7 @@ private void setDirectionsHeader() {
@FXML
private void showSearch() {
setStart(KioskMain.getDir().getTheKiosk());
mapController.enableAllButtons();
//setEnd(null);
start.requestFocus();
end.requestFocus();
Expand Down
2 changes: 1 addition & 1 deletion src/views/Map.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@

<AnchorPane fx:id="root" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1">
<ImageView fx:id="mapView" fitHeight="850.0" fitWidth="1000.0" pickOnBounds="true" preserveRatio="true" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
<VBox fx:id="floorVBox" alignment="CENTER_RIGHT" spacing="10.0" AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="200.0" />
<VBox fx:id="floorVBox" alignment="CENTER_RIGHT" AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="200.0" />
</AnchorPane>
7 changes: 7 additions & 0 deletions src/views/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
-fx-text-fill: white;
}

.floor-button{
-fx-font-size: 14px;
-fx-background-color: white;
-fx-padding: 11, 16, 11, 16;
-fx-text-fill: black;
}

/*main background color*/
.background {
-fx-background-color: #FAFAFA;
Expand Down

0 comments on commit 68a65f8

Please sign in to comment.