Java Code Examples for eu.hansolo.tilesfx.tools.Helper#enableNode()
The following examples show how to use
eu.hansolo.tilesfx.tools.Helper#enableNode() .
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: RadarChartTileSkin.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()); radarChart.setThresholdVisible(tile.isThresholdVisible()); } else if ("RECALC".equals(EVENT_TYPE)) { radarChart.setMinValue(tile.getMinValue()); radarChart.setMaxValue(tile.getMaxValue()); radarChart.setThreshold(tile.getThreshold()); radarChart.setUnit(tile.getUnit()); radarChart.setMode(tile.getRadarChartMode()); radarChart.setThresholdColor(tile.getThresholdColor()); radarChart.setGradientStops(tile.getGradientStops()); } }
Example 2
Source File: MapTileSkin.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()); webView.setMaxSize(size * 0.9, tile.isTextVisible() ? size * 0.68 : size * 0.795); webView.setPrefSize(size * 0.9, tile.isTextVisible() ? size * 0.68 : size * 0.795); } else if ("LOCATION".equals(EVENT_TYPE)) { tile.getCurrentLocation().addLocationEventListener(locationListener); updateLocation(); } else if ("TRACK".equals(EVENT_TYPE)) { addTrack(tile.getTrack()); } else if ("MAP_PROVIDER".equals(EVENT_TYPE)) { changeMapProvider(tile.getMapProvider()); } }
Example 3
Source File: SmoothAreaChartTileSkin.java From tilesfx with Apache License 2.0 | 6 votes |
@Override protected void handleEvents(final String EVENT_TYPE) { super.handleEvents(EVENT_TYPE); if (EventType.VISIBILITY.name().equals(EVENT_TYPE)) { Helper.enableNode(titleText, !tile.getTitle().isEmpty()); Helper.enableNode(valueText, tile.isValueVisible()); Helper.enableNode(unitFlow, !tile.getUnit().isEmpty()); Helper.enableNode(dataPointGroup, tile.getDataPointsVisible()); } else if (EventType.SERIES.name().equals(EVENT_TYPE)) { Helper.enableNode(fillPath, ChartType.AREA == tile.getChartType()); } else if (EventType.CLEAR_DATA.name().equals(EVENT_TYPE)) { Platform.runLater(() -> { tile.clearChartData(); fillPath.setVisible(false); strokePath.setVisible(false); Helper.enableNode(dataPointGroup, false); if (tile.getCustomDecimalFormatEnabled()) { valueText.setText(decimalFormat.format(minValue)); } else { valueText.setText(String.format(locale, formatString, minValue)); } }); handleData(); } }
Example 4
Source File: LedTileSkin.java From tilesfx with Apache License 2.0 | 6 votes |
@Override protected void initGraphics() { super.initGraphics(); titleText = new Text(); titleText.setFill(tile.getTitleColor()); Helper.enableNode(titleText, !tile.getTitle().isEmpty()); text = new Text(tile.getText()); text.setFill(tile.getUnitColor()); Helper.enableNode(text, tile.isTextVisible()); description = new Label(tile.getDescription()); description.setAlignment(tile.getDescriptionAlignment()); description.setWrapText(true); description.setTextFill(tile.getTextColor()); Helper.enableNode(description, !tile.getDescription().isEmpty()); ledBorder = new Circle(); led = new Circle(); hightlight = new Circle(); innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 0.07 * size, 0, 0, 0); led.setEffect(innerShadow); getPane().getChildren().addAll(titleText, text, description, ledBorder, led, hightlight); }
Example 5
Source File: CycleStepTileSkin.java From tilesfx with Apache License 2.0 | 6 votes |
@Override protected void initGraphics() { super.initGraphics(); chartItems = new ArrayList<>(); double sum = tile.getChartData().stream().mapToDouble(chartData -> chartData.getValue()).sum(); tile.getChartData().forEach(chartData -> chartItems.add(new ChartItem(chartData, sum))); chartBox = new VBox(0); chartBox.setFillWidth(true); chartBox.getChildren().addAll(chartItems); titleText = new Text(); titleText.setFill(tile.getTitleColor()); Helper.enableNode(titleText, !tile.getTitle().isEmpty()); text = new Text(tile.getText()); text.setFill(tile.getUnitColor()); Helper.enableNode(text, tile.isTextVisible()); getPane().getChildren().addAll(titleText, text, chartBox); }
Example 6
Source File: TurnoverTileSkin.java From tilesfx with Apache License 2.0 | 5 votes |
@Override protected void handleEvents(final String EVENT_TYPE) { super.handleEvents(EVENT_TYPE); if (EventType.VALUE.name().equals(EVENT_TYPE)) { handleCurrentValue(tile.getCurrentValue()); } else if (EventType.VISIBILITY.name().equals(EVENT_TYPE)) { Helper.enableNode(titleText, !tile.getTitle().isEmpty()); Helper.enableNode(text, tile.isTextVisible()); graphicContainer.setMaxSize(size * 0.9, tile.isTextVisible() ? size * 0.68 : size * 0.795); graphicContainer.setPrefSize(size * 0.9, tile.isTextVisible() ? size * 0.68 : size * 0.795); } }
Example 7
Source File: ClusterMonitorTileSkin.java From tilesfx with Apache License 2.0 | 5 votes |
@Override protected void initGraphics() { super.initGraphics(); updateHandler = e -> { switch(e.getType()) { case UPDATE : updateChart(); break; case FINISHED: updateChart(); break; } }; paneSizeListener = e -> updateChart(); dataItemMap = new HashMap<>(); chartPane = new VBox(); Collections.sort(tile.getChartData(), Comparator.comparing(ChartData::getName)); tile.getChartData().forEach(data -> { data.addChartDataEventListener(updateHandler); dataItemMap.put(data, new ChartItem(data, contentBounds, data.getFormatString())); chartPane.getChildren().add(dataItemMap.get(data)); }); titleText = new Text(); titleText.setFill(tile.getTitleColor()); Helper.enableNode(titleText, !tile.getTitle().isEmpty()); text = new Text(tile.getText()); text.setFill(tile.getUnitColor()); Helper.enableNode(text, tile.isTextVisible()); SVGPath svgPath = tile.getSVGPath(); if (null != svgPath) { svgPathPressedHandler = e -> tile.fireTileEvent(SVG_PRESSED_EVENT); graphicRegion = new Region(); graphicRegion.setShape(svgPath); getPane().getChildren().addAll(titleText, text, chartPane, graphicRegion); } else { getPane().getChildren().addAll(titleText, text, chartPane); } }
Example 8
Source File: SmoothAreaChartTileSkin.java From tilesfx with Apache License 2.0 | 5 votes |
private void handleData() { selectorTooltip.hide(); selector.setVisible(false); List<ChartData> data = tile.getChartData(); if (null == data || data.isEmpty() || data.size() < 2) { return; } if (!strokePath.isVisible() && !fillPath.isVisible()) { fillPath.setVisible(true); strokePath.setVisible(true); Helper.enableNode(dataPointGroup, tile.getDataPointsVisible()); } Optional<ChartData> lastDataEntry = data.stream().reduce((first, second) -> second); if (lastDataEntry.isPresent()) { if (tile.getCustomDecimalFormatEnabled()) { valueText.setText(decimalFormat.format(lastDataEntry.get().getValue())); } else { valueText.setText(String.format(locale, formatString, lastDataEntry.get().getValue())); } tile.setValue(lastDataEntry.get().getValue()); resizeDynamicText(); } dataSize = data.size(); maxValue = data.stream().max(Comparator.comparing(c -> c.getValue())).get().getValue(); hStepSize = width / (dataSize - 1); vStepSize = (height * 0.5) / maxValue; points.clear(); for (int i = 0 ; i < dataSize ; i++) { points.add(new Point((i) * hStepSize, height - data.get(i).getValue() * vStepSize)); } drawChart(points); }
Example 9
Source File: PlusMinusTileSkin.java From tilesfx with Apache License 2.0 | 5 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()); Helper.enableNode(description, !tile.getDescription().isEmpty()); } }
Example 10
Source File: HighLowTileSkin.java From tilesfx with Apache License 2.0 | 5 votes |
@Override protected void redraw() { super.redraw(); titleText.setText(tile.getTitle()); text.setText(tile.getText()); deviationText.setText(String.format(locale, "%." + tile.getTickLabelDecimals() + "f", calculateDeviation())); if (tile.getUnit().contains("/")) { String[] units = tile.getUnit().split("/"); upperUnitText.setText(units[0]); unitText.setText(units[1]); Helper.enableNode(fractionLine, true); } else { upperUnitText.setText(" "); unitText.setText(tile.getUnit()); Helper.enableNode(fractionLine, false); } description.setText(tile.getDescription()); description.setAlignment(tile.getDescriptionAlignment()); resizeStaticText(); titleText.setFill(tile.getTitleColor()); text.setFill(tile.getTextColor()); valueText.setFill(tile.getValueColor()); upperUnitText.setFill(tile.getUnitColor()); fractionLine.setStroke(tile.getUnitColor()); unitText.setFill(tile.getUnitColor()); description.setTextFill(tile.getDescriptionColor()); deviationText.setFill(state.color); deviationUnitText.setFill(state.color); triangle.setFill(state.color); }
Example 11
Source File: DateTileSkin.java From tilesfx with Apache License 2.0 | 5 votes |
@Override protected void handleEvents(final String EVENT_TYPE) { super.handleEvents(EVENT_TYPE); if ("VISIBILITY".equals(EVENT_TYPE)) { Helper.enableNode(titleText, !titleText.getText().isEmpty()); Helper.enableNode(text, tile.isTextVisible()); Helper.enableNode(description, !description.getText().isEmpty()); } }
Example 12
Source File: TimeTileSkin.java From tilesfx with Apache License 2.0 | 5 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(timeText, tile.isValueVisible()); Helper.enableNode(description, !tile.getDescription().isEmpty()); } }
Example 13
Source File: FluidTileSkin.java From tilesfx with Apache License 2.0 | 5 votes |
@Override protected void redraw() { super.redraw(); titleText.setText(tile.getTitle()); text.setText(tile.getText()); if (tile.getCustomDecimalFormatEnabled()) { valueText.setText(decimalFormat.format(Helper.clamp(minValue, maxValue, tile.getCurrentValue()))); } else { valueText.setText(String.format(locale, formatString, Helper.clamp(minValue, maxValue, tile.getCurrentValue()))); } if (tile.getUnit().contains("/")) { String[] units = tile.getUnit().split("/"); upperUnitText.setText(units[0]); unitText.setText(units[1]); Helper.enableNode(fractionLine, true); } else { upperUnitText.setText(" "); unitText.setText(tile.getUnit()); Helper.enableNode(fractionLine, false); } resizeDynamicText(); resizeStaticText(); titleText.setFill(tile.getTitleColor()); valueText.setFill(tile.getValueColor()); upperUnitText.setFill(tile.getUnitColor()); fractionLine.setStroke(tile.getUnitColor()); unitText.setFill(tile.getUnitColor()); text.setFill(tile.getTextColor()); if (tile.isFillWithGradient() && !tile.getGradientStops().isEmpty()) { gradientLookup.setStops(tile.getGradientStops()); } }
Example 14
Source File: CustomTileSkin.java From tilesfx with Apache License 2.0 | 5 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()); graphicContainer.setMaxSize(size * 0.9, tile.isTextVisible() ? size * 0.68 : size * 0.795); graphicContainer.setPrefSize(size * 0.9, tile.isTextVisible() ? size * 0.68 : size * 0.795); } else if ("GRAPHIC".equals(EVENT_TYPE)) { if (null != tile.getGraphic()) graphicContainer.getChildren().setAll(tile.getGraphic()); } }
Example 15
Source File: FireSmokeTileSkin.java From tilesfx with Apache License 2.0 | 5 votes |
@Override protected void redraw() { super.redraw(); titleText.setText(tile.getTitle()); text.setText(tile.getText()); if (tile.getCustomDecimalFormatEnabled()) { valueText.setText(decimalFormat.format(Helper.clamp(minValue, maxValue, tile.getCurrentValue()))); } else { valueText.setText(String.format(locale, formatString, Helper.clamp(minValue, maxValue, tile.getCurrentValue()))); } if (tile.getUnit().contains("/")) { String[] units = tile.getUnit().split("/"); upperUnitText.setText(units[0]); unitText.setText(units[1]); Helper.enableNode(fractionLine, true); } else { upperUnitText.setText(" "); unitText.setText(tile.getUnit()); Helper.enableNode(fractionLine, false); } resizeDynamicText(); resizeStaticText(); titleText.setFill(tile.getTitleColor()); valueText.setFill(tile.getValueColor()); upperUnitText.setFill(tile.getUnitColor()); fractionLine.setStroke(tile.getUnitColor()); unitText.setFill(tile.getUnitColor()); text.setFill(tile.getTextColor()); }
Example 16
Source File: HighLowTileSkin.java From tilesfx with Apache License 2.0 | 5 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()); Helper.enableNode(description, !tile.getDescription().isEmpty()); } }
Example 17
Source File: SliderTileSkin.java From tilesfx with Apache License 2.0 | 5 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()); Helper.enableNode(description, !tile.getDescription().isEmpty()); } }
Example 18
Source File: FireSmokeTileSkin.java From tilesfx with Apache License 2.0 | 5 votes |
@Override protected void initGraphics() { super.initGraphics(); titleText = new Text(); titleText.setFill(tile.getTitleColor()); Helper.enableNode(titleText, !tile.getTitle().isEmpty()); valueText = new Text(); 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.CENTER); valueUnitFlow.setAlignment(Pos.BOTTOM_CENTER); valueUnitFlow.setMouseTransparent(true); text = new Text(tile.getText()); text.setFill(tile.getUnitColor()); Helper.enableNode(text, tile.isTextVisible()); smoke = new Smoke(); fire = new Fire(); getPane().getChildren().addAll(titleText, valueUnitFlow, fractionLine, text, smoke, fire); }
Example 19
Source File: ColorTileSkin.java From tilesfx with Apache License 2.0 | 4 votes |
@Override protected void initGraphics() { super.initGraphics(); gradientLookup = new GradientLookup(); if (tile.getSections().isEmpty()) { tile.setSections(new Section(0.00, 0.25, ColorSkin.GREEN), new Section(0.25, 0.50, ColorSkin.YELLOW), new Section(0.50, 0.75, ColorSkin.ORANGE), new Section(0.75, 1.00, ColorSkin.RED)); } tile.setBackgroundColor(tile.getSections().get(0).getColor()); titleText = new Text(); titleText.setFill(tile.getTitleColor()); Helper.enableNode(titleText, !tile.getTitle().isEmpty()); 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.CENTER); valueUnitFlow.setMouseTransparent(true); barBackground = new Rectangle(); barBackground.setFill(tile.getBarBackgroundColor()); bar = new Rectangle(); bar.setFill(tile.getForegroundColor()); getPane().getChildren().addAll(titleText, valueUnitFlow, fractionLine, barBackground, bar); }
Example 20
Source File: GaugeSparkLineTileSkin.java From tilesfx with Apache License 2.0 | 4 votes |
@Override protected void handleEvents(final String EVENT_TYPE) { super.handleEvents(EVENT_TYPE); if (EventType.VISIBILITY.name().equals(EVENT_TYPE)) { Helper.enableNode(titleText, !tile.getTitle().isEmpty()); Helper.enableNode(text, tile.isTextVisible()); Helper.enableNode(valueText, tile.isValueVisible()); Helper.enableNode(valueUnitFlow, !tile.getUnit().isEmpty()); Helper.enableNode(timeSpanText, !tile.isTextVisible()); Helper.enableNode(averageLine, tile.isAverageVisible()); Helper.enableNode(averageText, tile.isAverageVisible()); Helper.enableNode(stdDeviationArea, tile.isAverageVisible()); Helper.enableNode(minValueText, tile.getMinValueVisible()); Helper.enableNode(maxValueText, tile.getMaxValueVisible()); redraw(); } else if (EventType.AVERAGING.name().equals(EVENT_TYPE)) { noOfDatapoints = tile.getAveragingPeriod(); // To get smooth lines in the chart we need at least 4 values if (noOfDatapoints < 4) throw new IllegalArgumentException("Please increase the averaging period to a value larger than 3."); for (int i = 0; i < noOfDatapoints; i++) { dataList.add(minValue); } pathElements.clear(); pathElements.add(0, new MoveTo()); for (int i = 1 ; i < noOfDatapoints ; i++) { pathElements.add(i, new LineTo()); } sparkLine.getElements().setAll(pathElements); redraw(); } else if (EventType.HIGHLIGHT_SECTIONS.name().equals(EVENT_TYPE)) { boolean isHighlightSections = tile.isHighlightSections(); sectionCanvas.setVisible(!isHighlightSections); sectionCanvas.setManaged(!isHighlightSections); highlightSectionCanvas.setVisible(isHighlightSections); highlightSectionCanvas.setManaged(isHighlightSections); } else if (EventType.CLEAR_DATA.name().equals(EVENT_TYPE)) { dataList.clear(); handleCurrentValue(minValue); } else if (EventType.FINISHED.name().equals(EVENT_TYPE)) { double value = clamp(minValue, maxValue, tile.getValue()); handleCurrentValue(value); updateSparkline(value); } }