Meeting fixes and new TODO
This commit is contained in:
parent
67b313aabf
commit
d915e04832
@ -7,6 +7,8 @@ import java.util.Calendar;
|
|||||||
import javax.swing.JScrollPane;
|
import javax.swing.JScrollPane;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.GregorianCalendar;
|
||||||
import javax.swing.table.DefaultTableModel;
|
import javax.swing.table.DefaultTableModel;
|
||||||
import javax.swing.JTable;
|
import javax.swing.JTable;
|
||||||
import javax.swing.ListSelectionModel;
|
import javax.swing.ListSelectionModel;
|
||||||
@ -208,7 +210,7 @@ public class GUI_ViewBuses {
|
|||||||
else busData[i][3] = "%0";
|
else busData[i][3] = "%0";
|
||||||
busData[i][4] = vehicles.get(i).getTripTime();
|
busData[i][4] = vehicles.get(i).getTripTime();
|
||||||
if (vehicles.get(i).isArrivedToDest())
|
if (vehicles.get(i).isArrivedToDest())
|
||||||
busData[i][5] = vehicles.get(i).getTimeOfArrival().toString();//Formula of time
|
busData[i][5] = getShortTime(vehicles.get(i).getTimeOfArrival());
|
||||||
else busData[i][5] = "NOT Arrived";
|
else busData[i][5] = "NOT Arrived";
|
||||||
}
|
}
|
||||||
table.setModel(new DefaultTableModel(busData ,busColNames));
|
table.setModel(new DefaultTableModel(busData ,busColNames));
|
||||||
@ -222,4 +224,10 @@ public class GUI_ViewBuses {
|
|||||||
lblDate.setText(currenttimeManager.getCurrentTime().toString());
|
lblDate.setText(currenttimeManager.getCurrentTime().toString());
|
||||||
updateTable();
|
updateTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getShortTime(Date time) {
|
||||||
|
Calendar cal = new GregorianCalendar();
|
||||||
|
cal.setTime(time);
|
||||||
|
return String.format("%02d:%02d", cal.get(Calendar.HOUR), cal.get(Calendar.MINUTE));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,10 +48,15 @@ public class MakkahCity {
|
|||||||
private static JLabel lblBusesArrivedInTheLastHourValue;
|
private static JLabel lblBusesArrivedInTheLastHourValue;
|
||||||
private static JLabel lblAverageTripForLastHourValue;
|
private static JLabel lblAverageTripForLastHourValue;
|
||||||
private static JButton btnPause;
|
private static JButton btnPause;
|
||||||
|
private static JLabel lblAverageTimeForTheTrip;
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
//TODO: View camp >> View Report
|
||||||
|
//TODO: History view
|
||||||
|
//TODO: Arrival dates (Arafat, Mina)
|
||||||
|
//TODO: fix state errors
|
||||||
t.start();
|
t.start();
|
||||||
//Gen Camp
|
//Gen Camp
|
||||||
campPerDistrict[District.ALMANSOOR.ordinal()] = new ArrayList<>();
|
campPerDistrict[District.ALMANSOOR.ordinal()] = new ArrayList<>();
|
||||||
@ -320,7 +325,7 @@ public class MakkahCity {
|
|||||||
lblAvgTime.setFont(new Font("Rockwell", Font.PLAIN, 16));
|
lblAvgTime.setFont(new Font("Rockwell", Font.PLAIN, 16));
|
||||||
lblAvgTime.setBounds(287, 694, 208, 29);
|
lblAvgTime.setBounds(287, 694, 208, 29);
|
||||||
|
|
||||||
JLabel lblAverageTimeForTheTrip = new JLabel("-:--");
|
lblAverageTimeForTheTrip = new JLabel("-:--");
|
||||||
lblAverageTimeForTheTrip.setForeground(Color.WHITE);
|
lblAverageTimeForTheTrip.setForeground(Color.WHITE);
|
||||||
lblAverageTimeForTheTrip.setFont(new Font("Rockwell", Font.PLAIN, 16));
|
lblAverageTimeForTheTrip.setFont(new Font("Rockwell", Font.PLAIN, 16));
|
||||||
lblAverageTimeForTheTrip.setBounds(512, 701, 101, 14);
|
lblAverageTimeForTheTrip.setBounds(512, 701, 101, 14);
|
||||||
@ -1240,15 +1245,27 @@ public class MakkahCity {
|
|||||||
lblBusesArrivedInTheLastHourValue.setText(NumberOfBussPerHour);
|
lblBusesArrivedInTheLastHourValue.setText(NumberOfBussPerHour);
|
||||||
|
|
||||||
lblAverageTripForLastHourValue.setText(avgTimeOfTrip());
|
lblAverageTripForLastHourValue.setText(avgTimeOfTrip());
|
||||||
|
lblAverageTimeForTheTrip.setText(getAvgTripForAllDis());
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO Avg for All the Dist
|
//TODO Avg for All the Dist
|
||||||
public static void getAvgTripForAllDis() {
|
public static String getAvgTripForAllDis() {
|
||||||
for (int i = 0; i < campPerDistrict.length; i++) {
|
int sum = 0;
|
||||||
getAvgTimeOfTrip(District.values()[i]);
|
int counter = 1;
|
||||||
}
|
for (Campaign campaign : listOfCampaigns) {
|
||||||
//lblAverageTripForLastHourValue.setText();
|
for (Vehicle vehicle : campaign.getVehicles()) {
|
||||||
|
if (vehicle.isArrivedToDest()) {
|
||||||
|
long minutes = (vehicle.getTimeOfArrival().getTime() - vehicle.getTimeStartedMoving().getTime())/60000;
|
||||||
|
sum+= minutes;
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}//Make the following a method since it is the same other method
|
||||||
|
sum = sum /counter;
|
||||||
|
int hours = sum / 60;
|
||||||
|
int minutes = sum % 60;
|
||||||
|
if (hours == 0 && minutes == 0) return " n/a";
|
||||||
|
return String.format("%2d:%02d", hours,minutes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user