eu.hansolo.tilesfx.tools.Country Java Examples
The following examples show how to use
eu.hansolo.tilesfx.tools.Country.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CountryTileSkin.java From tilesfx with Apache License 2.0 | 6 votes |
@Override protected void handleEvents(final String EVENT_TYPE) { super.handleEvents(EVENT_TYPE); if ("VISIBILITY".equals(EVENT_TYPE)) { Helper.enableNode(titleText, !tile.getTitle().isEmpty()); Helper.enableNode(text, tile.isTextVisible()); Helper.enableNode(valueText, tile.isValueVisible()); Helper.enableNode(unitFlow, !tile.getUnit().isEmpty()); countryContainer.setMaxSize(size * 0.9, tile.isTextVisible() ? size * 0.68 : size * 0.795); countryContainer.setPrefSize(size * 0.9, tile.isTextVisible() ? size * 0.68 : size * 0.795); } else if ("RECALC".equals(EVENT_TYPE)) { country = tile.getCountry(); if (null == country) { country = Country.DE; } countryPaths = Helper.getHiresCountryPaths().get(country.name()); countryPaths.forEach(path -> path.setFill(tile.getBarColor())); countryGroup.getChildren().setAll(countryPaths); text.setText(country.getDisplayName()); resize(); redraw(); } }
Example #2
Source File: WorldMapTileSkin.java From tilesfx with Apache License 2.0 | 5 votes |
@Override protected void registerListeners() { super.registerListeners(); countryPaths.forEach((name , pathList) -> { Country country = Country.valueOf(name); EventHandler<MouseEvent> clickHandler = e -> tile.fireTileEvent(new TileEvent(EventType.SELECTED_CHART_DATA, new ChartData(country.getName(), country.getValue(), country.getColor()))); pathList.forEach(path -> { handlerMap.put(path, clickHandler); path.addEventHandler(MouseEvent.MOUSE_PRESSED, clickHandler); }); }); tile.getPoiList().addListener(poiListener); tile.getChartData().addListener(chartDataListener); }
Example #3
Source File: WorldMapTileSkin.java From tilesfx with Apache License 2.0 | 5 votes |
private void setCountryFillAndStroke(final Country COUNTRY, final Color FILL, final Color STROKE) { List<CountryPath> paths = countryPaths.get(COUNTRY.getName()); for (CountryPath path : paths) { path.setFill(FILL); path.setStroke(STROKE); } }
Example #4
Source File: WorldMapTileSkin.java From tilesfx with Apache License 2.0 | 5 votes |
private void refresh() { Color fill = tile.getForegroundColor(); Color stroke = tile.getBackgroundColor(); countryPaths.forEach((name, pathList) -> { Country country = Country.valueOf(name); pathList.forEach(path -> { path.setFill(null == country.getColor() ? fill : country.getColor()); path.setStroke(stroke); path.setStrokeWidth(0.2); }); }); }
Example #5
Source File: CountryTileSkin.java From tilesfx with Apache License 2.0 | 4 votes |
@Override protected void initGraphics() { super.initGraphics(); //poiLocations = FXCollections.observableHashMap(); //chartDataLocations = FXCollections.observableHashMap(); //circleHandlerMap = new HashMap<>(); country = tile.getCountry(); if (null == country) { country = Country.DE; } clickHandler = event -> tile.fireTileEvent(new TileEvent(EventType.SELECTED_CHART_DATA, new ChartData(country.getName(), country.getValue(), country.getColor()))); countryPaths = Helper.getHiresCountryPaths().get(country.name()); countryMinX = Helper.MAP_WIDTH; countryMinY = Helper.MAP_HEIGHT; countryMaxX = 0; countryMaxY = 0; countryPaths.forEach(path -> { path.setFill(tile.getBarColor()); countryMinX = Math.min(countryMinX, path.getBoundsInParent().getMinX()); countryMinY = Math.min(countryMinY, path.getBoundsInParent().getMinY()); countryMaxX = Math.max(countryMaxX, path.getBoundsInParent().getMaxX()); countryMaxY = Math.max(countryMaxY, path.getBoundsInParent().getMaxY()); }); /* tile.getPoiList() .forEach(poi -> { String tooltipText = new StringBuilder(poi.getName()).append("\n") .append(poi.getInfo()) .toString(); Circle circle = new Circle(3, poi.getColor()); circle.setOnMousePressed(e -> poi.fireLocationEvent(new LocationEvent(poi))); Tooltip.install(circle, new Tooltip(tooltipText)); poiLocations.put(poi, circle); }); */ titleText = new Text(); titleText.setFill(tile.getTitleColor()); Helper.enableNode(titleText, !tile.getTitle().isEmpty()); text = new Text(tile.getCountry().getDisplayName()); text.setFill(tile.getTextColor()); Helper.enableNode(text, tile.isTextVisible()); countryGroup = new Group(); countryGroup.getChildren().setAll(countryPaths); countryContainer = new StackPane(); countryContainer.setMinSize(size * 0.9, tile.isTextVisible() ? size * 0.72 : size * 0.795); countryContainer.setMaxSize(size * 0.9, tile.isTextVisible() ? size * 0.72 : size * 0.795); countryContainer.setPrefSize(size * 0.9, tile.isTextVisible() ? size * 0.72 : size * 0.795); countryContainer.getChildren().setAll(countryGroup); valueText = new Text(String.format(locale, formatString, ((tile.getValue() - minValue) / range * 100))); valueText.setFill(tile.getValueColor()); valueText.setTextOrigin(VPos.BASELINE); Helper.enableNode(valueText, tile.isValueVisible()); upperUnitText = new Text(""); upperUnitText.setFill(tile.getUnitColor()); Helper.enableNode(upperUnitText, !tile.getUnit().isEmpty()); fractionLine = new Line(); unitText = new Text(tile.getUnit()); unitText.setFill(tile.getUnitColor()); Helper.enableNode(unitText, !tile.getUnit().isEmpty()); unitFlow = new VBox(upperUnitText, unitText); unitFlow.setAlignment(Pos.CENTER_RIGHT); valueUnitFlow = new HBox(valueText, unitFlow); valueUnitFlow.setAlignment(Pos.BOTTOM_RIGHT); valueUnitFlow.setMouseTransparent(true); valueUnitFlow.setMouseTransparent(true); getPane().getChildren().addAll(titleText, countryContainer, valueUnitFlow, fractionLine, text); //getPane().getChildren().addAll(poiLocations.values()); }
Example #6
Source File: WorldMapTileSkin.java From tilesfx with Apache License 2.0 | 4 votes |
private void setFillAndStroke() { countryPaths.keySet().forEach(name -> { Country country = Country.valueOf(name); setCountryFillAndStroke(country, null == country.getColor() ? tile.getForegroundColor() : country.getColor(), tile.getBackgroundColor()); }); }
Example #7
Source File: TileBuilder.java From tilesfx with Apache License 2.0 | 4 votes |
public final B country(final Country COUNTRY) { properties.put("country", new SimpleObjectProperty(COUNTRY)); return (B)this; }