Commit 1ace848c authored by Riegel's avatar Riegel
Browse files

Add disabling of empty FeatureTabs to GUI

parent c0b61e70
Pipeline #10273 passed with stage
in 1 minute and 13 seconds
...@@ -137,6 +137,7 @@ public class CityDoctorController { ...@@ -137,6 +137,7 @@ public class CityDoctorController {
mainWindow.getLod4Btn().setDisable(false); mainWindow.getLod4Btn().setDisable(false);
mainWindow.getWorldBtn().setDisable(false); mainWindow.getWorldBtn().setDisable(false);
mainWindow.getSaveBtn().setDisable(false); mainWindow.getSaveBtn().setDisable(false);
setupFeatureTabs();
buildTrees(); buildTrees();
}); });
} finally { } finally {
...@@ -144,6 +145,18 @@ public class CityDoctorController { ...@@ -144,6 +145,18 @@ public class CityDoctorController {
} }
} }
private void setupFeatureTabs(){
mainWindow.setDisableOfFeatureTab(FeatureType.BUILDING, model.getBuildings().isEmpty());
mainWindow.setDisableOfFeatureTab(FeatureType.VEGETATION, model.getVegetation().isEmpty());
mainWindow.setDisableOfFeatureTab(FeatureType.TRANSPORTATION, model.getTransportation().isEmpty());
mainWindow.setDisableOfFeatureTab(FeatureType.TUNNEL, model.getTunnels().isEmpty());
mainWindow.setDisableOfFeatureTab(FeatureType.BRIDGE, model.getBridges().isEmpty());
mainWindow.setDisableOfFeatureTab(FeatureType.WATER, model.getWater().isEmpty());
mainWindow.setDisableOfFeatureTab(FeatureType.LAND, model.getLand().isEmpty());
mainWindow.setDisableOfFeatureTab(FeatureType.CITY_FURNITURE, model.getCityFurniture().isEmpty());
mainWindow.setDisableOfFeatureTab(FeatureType.GENERIC_CITY_OBJECT, model.getGenericCityObjects().isEmpty());
}
public void buildTrees() { public void buildTrees() {
resetFeatureChunks(); resetFeatureChunks();
buildBuildings(model); buildBuildings(model);
......
...@@ -645,7 +645,7 @@ public class MainWindow extends Application { ...@@ -645,7 +645,7 @@ public class MainWindow extends Application {
selectedTab = FeatureType.TRANSPORTATION; selectedTab = FeatureType.TRANSPORTATION;
break; break;
case 3: case 3:
selectedTab = FeatureType.TRANSPORTATION; selectedTab = FeatureType.TUNNEL;
break; break;
case 4: case 4:
selectedTab = FeatureType.BRIDGE; selectedTab = FeatureType.BRIDGE;
...@@ -668,6 +668,54 @@ public class MainWindow extends Application { ...@@ -668,6 +668,54 @@ public class MainWindow extends Application {
}); });
} }
public void setDisableOfFeatureTab(FeatureType featureType, boolean value){
switch (featureType) {
case BUILDING:
buildingsTab.setDisable(value);
break;
case VEGETATION:
vegetationTab.setDisable(value);
break;
case TRANSPORTATION:
transportationTab.setDisable(value);
break;
case TUNNEL:
tunnelTab.setDisable(value);
break;
case BRIDGE:
bridgeTab.setDisable(value);
break;
case WATER:
waterTab.setDisable(value);
break;
case LAND:
terrainTab.setDisable(value);
break;
case CITY_FURNITURE:
cityFurnitureTab.setDisable(value);
break;
case GENERIC_CITY_OBJECT:
otherObjectsTab.setDisable(value);
break;
default:
throw new IllegalArgumentException("Unknown feature type: " + featureType);
}
}
public void activateAllTabs(){
buildingsTab.setDisable(false);
vegetationTab.setDisable(false);
transportationTab.setDisable(false);
tunnelTab.setDisable(false);
bridgeTab.setDisable(false);
waterTab.setDisable(false);
terrainTab.setDisable(false);
cityFurnitureTab.setDisable(false);
otherObjectsTab.setDisable(false);
}
public void resetSearchBar() { public void resetSearchBar() {
searchField.setText(""); searchField.setText("");
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment