public MatrixPane(final Paint BACKGROUND, final MatrixItemSeries<T> SERIES) { getStylesheets().add(XYPane.class.getResource("chart.css").toExternalForm()); aspectRatio = PREFERRED_HEIGHT / PREFERRED_WIDTH; keepAspect = false; _chartBackground = BACKGROUND; series = SERIES; matrixGradient = ColorMapping.BLUE_CYAN_GREEN_YELLOW_RED.getGradient(); scaleX = 1; scaleY = 1; scaleZ = 1; _lowerBoundX = 0; _upperBoundX = 100; _lowerBoundY = 0; _upperBoundY = 100; _lowerBoundZ = 0; _upperBoundZ = 100; initGraphics(); registerListeners(); }
public void updatePaint() { /* Update the color */ /* Set a special paint for multi-state intervals */ if (fInterval.isMultiState()) { Paint multiStatePaint = fWidget.getDebugOptions().multiStatePaint.get(); fBaseColor = multiStatePaint; fSelectedColor = multiStatePaint; } else { fBaseColor = JfxColorFactory.getColorFromDef(fInterval.getColorDefinition().get()); fSelectedColor = JfxColorFactory.getDerivedColorFromDef(fInterval.getColorDefinition().get()); } setFill(fBaseColor); /* Update the line thickness */ LineThickness lt = fInterval.getLineThickness().get(); double height = getHeightFromThickness(lt); setHeight(height); /* We need to adjust the y position too */ setY(computeY(height)); }
public ObjectProperty<Paint> chartBackgroundProperty() { if (null == chartBackground) { chartBackground = new ObjectPropertyBase<Paint>(_chartBackground) { @Override protected void invalidated() { redraw(); } @Override public Object getBean() { return XYPane.this; } @Override public String getName() { return "chartBackground"; } }; _chartBackground = null; } return chartBackground; }
/** * Creates the title and description text. * @return Returns a VBox containing the data. */ public VBox createText(){ final VBox layout = new VBox(15.0f); layout.setAlignment(Pos.CENTER_LEFT); layout.setPadding(new Insets(10,10,10,10)); layout.setMaxWidth(300.0f); lblTitle = new Label(this.title); lblTitle.setTextFill(javafx.scene.paint.Paint.valueOf("#ff0000")); lblTitle.setFont( javafx.scene.text.Font.font(FONT_NAME, FontWeight.EXTRA_BOLD,FONT_SIZE) ); txtDescription = new Text(this.description); txtDescription.setFill(Paint.valueOf("#ffffff")); txtDescription.setFont( javafx.scene.text.Font.font(FONT_NAME, FontWeight.BOLD,12.0f) ); txtDescription.setBoundsType(TextBoundsType.LOGICAL_VERTICAL_CENTER); layout.getChildren().add(lblTitle); layout.getChildren().add(txtDescription); return layout; }
@FXML void stopAction(ActionEvent event) { double val = Double.valueOf(offset_textfield.getText()); setOffset(val); showHUD(); // Called when moving a gradient stop : // - update gradient preview accordingly // - update model final PaintPickerController paintPicker = gradientPicker.getPaintPickerController(); final Mode mode = paintPicker.getMode(); final Paint value = gradientPicker.getValue(mode); gradientPicker.updatePreview(value); // Update model paintPicker.setPaintProperty(value); }
public CycleView(final List<Node> nodes, final int cycleIndex, final double hueInterval) { Paint p = Color.hsb(cycleIndex * hueInterval, 0.75, 0.70, 0.25); setFill(p); setStroke(p); setStrokeWidth(20); setStrokeLineJoin(StrokeLineJoin.ROUND); setStrokeType(StrokeType.OUTSIDE); updateHull(nodes, HULL_ALGORITHM); final ChangeListener<Number> listener = (_0, _1, _2) -> { updateHull(nodes, HULL_ALGORITHM); }; for (Node n : nodes) { n.translateXProperty().addListener(listener); n.translateYProperty().addListener(listener); } }
public static SVGGlyph getGlyph(String name, Paint fill) { String path; switch (name) { case "repeat": path = repeat; break; case "check_circle": path = check_circle; break; case "check_circle_o": path = check_circle_o; break; case "save": path = save; break; case "download": path = download; break; default: path = plane; } return new SVGGlyph(-1, name, path, fill); }
private static Paint getPaint(IPixel p) { switch (p.getColor()) { case 0: return (Color.RED); case 1: return (Color.LIME); case 2: return (Color.BLUE); case 3: return (Color.GRAY); case 4: return (Color.BLACK); case 5: return (Color.WHITE); default: throw new IllegalStateException("Invalid color code " + p.getColor() + "."); } }
public void setLegendTextFill(final Series<X, Y> SERIES, final Paint FILL) { if (getData().isEmpty()) { return; } if (!getData().contains(SERIES)) { return; } int seriesIndex = getData().indexOf(SERIES); if (seriesIndex == -1) { return; } Legend legend = (Legend) getLegend(); if (null == legend) { return; } LegendItem item = legend.getItems().get(seriesIndex); if (null == item) { return; } String itemText = item.getText(); for (Node node : legend.lookupAll(".chart-legend-item")) { if (node instanceof Label) { Label label = (Label) node; if (label.getText().equals(itemText)) { label.setTextFill(FILL); } } } }
private void drawStone(DrawCoords position, StoneColour colour, double radius) { GraphicsContext context = getGraphicsContext(); if ( colour == BLACK ) context.setFill(javafx.scene.paint.Paint.valueOf("#000000")); else context.setFill(Paint.valueOf("#FFFFFF")); drawCircle(position, radius); }
public ObjectProperty<Paint> majorVGridLinePaintProperty() { if (null == majorVGridLinePaint) { majorVGridLinePaint = new ObjectPropertyBase<Paint>(_majorVGridLinePaint) { @Override protected void invalidated() { drawGrid(); } @Override public Object getBean() { return Grid.this; } @Override public String getName() { return "majorVGridLinePaint"; } }; _majorVGridLinePaint = null; } return majorVGridLinePaint; }
/** * Handle changes to the input fields */ public void handleChange() { // Check the input fields: if (!this.name.getText().trim().isEmpty() && !this.weighting.getText().trim().isEmpty() && !this.deadline.getEditor().getText().trim().isEmpty() && !this.deadline.getValue().isBefore(LocalDate.now()) && this.taskType.getSelectionModel().getSelectedIndex() != -1) this.submit.setDisable(false); // ================= // Process requirements and dependencies: if (this.task != null) { this.task.replaceDependencies(this.dependencies.getItems()); this.task.replaceRequirements(this.requirements.getItems()); if (!this.task.isCheckedComplete() && this.task.canCheckComplete()) { this.canComplete.setText("Can be completed."); this.canComplete.setTextFill(Paint.valueOf("green")); this.canComplete.setVisible(true); this.markComplete.setDisable(false); } else if (!this.task.canCheckComplete()) { this.task.setComplete(false); this.canComplete.setText("Cannot be completed at this point."); this.canComplete.setTextFill(Paint.valueOf("red")); this.canComplete.setVisible(true); this.markComplete.setDisable(true); } } // ================= }
public LineThicknessMenuButton(TimeGraphWidget widget, ConfigOption<LineThickness> option, ReadOnlyProperty<? extends Paint> colorSource) { fOption = option; fColorSource = colorSource; ToggleGroup tg = new ToggleGroup(); List<LineThicknessMenuButtonItem> items = Arrays.stream(LineThickness.values()) .map(lt -> { LineThicknessMenuButtonItem rmi = new LineThicknessMenuButtonItem(lt); rmi.setGraphic(getRectangleForThickness(lt)); rmi.setToggleGroup(tg); LineThickness currentThickness = option.get(); rmi.setSelected(lt == currentThickness); rmi.setOnAction(e -> { option.set(lt); LineThicknessMenuButton.this.setGraphic(getRectangleForThickness(lt)); repaintAllRectangles(widget); }); return rmi; }) .collect(Collectors.toList()); /* Initial value shown in the button */ setGraphic(getRectangleForThickness(option.get())); getItems().addAll(items); }
private Collection<Arrow> prepareArrows(TimeGraphTreeRender treeRender, TimeGraphArrowRender arrowRender, Paint arrowStroke) { final double entryHeight = TimeGraphWidget.ENTRY_HEIGHT; Collection<Arrow> arrows = arrowRender.getArrows().stream() .map(timeGraphArrow -> { TimeGraphTreeElement startTreeElem = timeGraphArrow.getStartEvent().getTreeElement(); TimeGraphTreeElement endTreeElem = timeGraphArrow.getEndEvent().getTreeElement(); long startTimestamp = timeGraphArrow.getStartEvent().getTimestamp(); long endTimestamp = timeGraphArrow.getEndEvent().getTimestamp(); // FIXME Build and use a hashmap instead for indexes int startIndex = treeRender.getAllTreeElements().indexOf(startTreeElem); int endIndex = treeRender.getAllTreeElements().indexOf(endTreeElem); if (startIndex == -1 || endIndex == -1) { /* We shouldn't have received this... */ return null; } double startX = getWidget().timestampToPaneXPos(startTimestamp); double endX = getWidget().timestampToPaneXPos(endTimestamp); double startY = startIndex * entryHeight + entryHeight / 2; double endY = endIndex * entryHeight + entryHeight / 2; Arrow arrow = new Arrow(startX, startY, endX, endY); arrow.setStroke(arrowStroke); return arrow; }) .filter(Objects::nonNull) .collect(Collectors.toList()); return arrows; }
private Path createSegment(final double START_ANGLE, final double END_ANGLE, final double INNER_RADIUS, final double OUTER_RADIUS, final Paint FILL, final Color STROKE, final TreeNode NODE) { double startAngleRad = Math.toRadians(START_ANGLE + 90); double endAngleRad = Math.toRadians(END_ANGLE + 90); boolean largeAngle = Math.abs(END_ANGLE - START_ANGLE) > 180.0; double x1 = centerX + INNER_RADIUS * Math.sin(startAngleRad); double y1 = centerY - INNER_RADIUS * Math.cos(startAngleRad); double x2 = centerX + OUTER_RADIUS * Math.sin(startAngleRad); double y2 = centerY - OUTER_RADIUS * Math.cos(startAngleRad); double x3 = centerX + OUTER_RADIUS * Math.sin(endAngleRad); double y3 = centerY - OUTER_RADIUS * Math.cos(endAngleRad); double x4 = centerX + INNER_RADIUS * Math.sin(endAngleRad); double y4 = centerY - INNER_RADIUS * Math.cos(endAngleRad); MoveTo moveTo1 = new MoveTo(x1, y1); LineTo lineTo2 = new LineTo(x2, y2); ArcTo arcTo3 = new ArcTo(OUTER_RADIUS, OUTER_RADIUS, 0, x3, y3, largeAngle, true); LineTo lineTo4 = new LineTo(x4, y4); ArcTo arcTo1 = new ArcTo(INNER_RADIUS, INNER_RADIUS, 0, x1, y1, largeAngle, false); Path path = new Path(moveTo1, lineTo2, arcTo3, lineTo4, arcTo1); path.setFill(FILL); path.setStroke(STROKE); String tooltipText = new StringBuilder(NODE.getItem().getName()).append("\n").append(String.format(Locale.US, formatString, NODE.getItem().getValue())).toString(); Tooltip.install(path, new Tooltip(tooltipText)); path.setOnMousePressed(new WeakEventHandler<>(e -> NODE.getTreeRoot().fireTreeNodeEvent(new TreeNodeEvent(NODE, EventType.NODE_SELECTED)))); return path; }
public final MatrixItemSeries build() { final MatrixItemSeries SERIES = new MatrixItemSeries(); if (properties.keySet().contains("itemsArray")) { SERIES.setItems(((ObjectProperty<MatrixItem[]>) properties.get("itemsArray")).get()); } if(properties.keySet().contains("itemsList")) { SERIES.setItems(((ObjectProperty<List<MatrixItem>>) properties.get("itemsList")).get()); } for (String key : properties.keySet()) { if ("name".equals(key)) { SERIES.setName(((StringProperty) properties.get(key)).get()); } else if ("fill".equals(key)) { SERIES.setFill(((ObjectProperty<Paint>) properties.get(key)).get()); } else if ("stroke".equals(key)) { SERIES.setStroke(((ObjectProperty<Paint>) properties.get(key)).get()); } else if ("symbolFill".equals(key)) { SERIES.setSymbolFill(((ObjectProperty<Color>) properties.get(key)).get()); } else if ("symbolStroke".equals(key)) { SERIES.setSymbolStroke(((ObjectProperty<Color>) properties.get(key)).get()); } else if ("symbol".equals(key)) { SERIES.setSymbol(((ObjectProperty<Symbol>) properties.get(key)).get()); } else if ("chartType".equals(key)) { SERIES.setChartType(((ObjectProperty<ChartType>) properties.get(key)).get()); } else if ("symbolsVisible".equals(key)) { SERIES.setSymbolsVisible(((BooleanProperty) properties.get(key)).get()); } else if ("symbolSize".equals(key)) { SERIES.setSymbolSize(((DoubleProperty) properties.get(key)).get()); } else if ("strokeWidth".equals(key)) { SERIES.setStrokeWidth(((DoubleProperty) properties.get(key)).get()); } } return SERIES; }
public Composition(int sceneWidth, int sceneHeight, double frameRate, Paint background) { this.sceneWidth = sceneWidth; this.sceneHeight = sceneHeight; this.background = background; virtualHeight = 1080; factor = virtualHeight / (double) sceneHeight; virtualWidth = (int) (sceneWidth * factor); timeline = new TimeLine(frameRate); scene = newScene(); }
public static void show(Resolution resolution, Paint background, Supplier<Parent> overlay) { size = resolution; root = overlay; fill = background; launch(); }
/** * Creates the title of the Toast. * @return Returns a Horizontal Box (HBox). */ private HBox createTitle(){ final HBox layout = new HBox(); layout.setAlignment(Pos.CENTER_LEFT); layout.setPadding(new Insets(10,5,10,5)); this.getTitle().setTextFill(Paint.valueOf(TEXT_COLOR)); this.getTitle().setFont( Font.font(FONT_NAME, FontWeight.EXTRA_BOLD,FONT_SIZE) ); this.getTitle().setMaxWidth( 150.0f ); layout.getChildren().add(this.getTitle()); return layout; }
/** * Creates the Toast body. * @return Returns a Horizontal-Box (HBox). */ private HBox createBody(){ final HBox layout = new HBox(10); layout.setAlignment(Pos.CENTER_LEFT); layout.setPadding(new Insets(10,5,10,5)); this.msg.setTextFill(Paint.valueOf(TEXT_COLOR)); this.msg.setMaxWidth(320.0f); this.msg.setFont( Font.font(FONT_NAME, FontWeight.EXTRA_BOLD,FONT_SIZE) ); layout.getChildren().add(getIcon()); layout.getChildren().add(msg); return layout; }
public ObjectProperty<Paint> mediumHGridLinePaintProperty() { if (null == mediumHGridLinePaint) { mediumHGridLinePaint = new ObjectPropertyBase<Paint>(_mediumHGridLinePaint) { @Override protected void invalidated() { drawGrid(); } @Override public Object getBean() { return Grid.this; } @Override public String getName() { return "mediumHGridLinePaint"; } }; _mediumHGridLinePaint = null; } return mediumHGridLinePaint; }
/** * Sets the appearance of an IO button. * @return Returns an I/O button. */ public Circle createIOButton(){ Circle channel = new Circle(5.0f); channel.setFill(Paint.valueOf(BACKGROUND_COLOR)); channel.setStroke(Paint.valueOf(FOREGROUND_COLOR)); channel.setStrokeWidth(2.0f); channel.setLayoutY(getMinHeight()/2); channel.setEffect( new DropShadow() ); return channel; }
public void setMinorVGridLinePaint(final Paint PAINT) { if (null == minorVGridLinePaint) { _minorVGridLinePaint = PAINT; drawGrid(); } else { minorVGridLinePaint.set(PAINT); } }
public NestedBarChart(final List<ChartItemSeries<ChartItem>> SERIES, final Paint BACKGROUND) { width = PREFERRED_WIDTH; height = PREFERRED_HEIGHT; size = PREFERRED_HEIGHT; series = FXCollections.observableArrayList(SERIES); _order = Order.DESCENDING; _chartBackground = BACKGROUND; clickHandler = e -> checkForClick(e); listeners = new CopyOnWriteArrayList<>(); initGraphics(); registerListeners(); }
public ObjectProperty<Paint> strokeProperty() { if (null == stroke) { stroke = new ObjectPropertyBase<Paint>(_stroke) { @Override protected void invalidated() { refresh(); } @Override public Object getBean() { return Series.this; } @Override public String getName() { return "stroke"; } }; _stroke = null; } return stroke; }
public NotificationController(String title, String body, Image img, Paint rectangleFill, Notification notification) { initTrayNotification(title, body, notification); setImage(img); setRectangleFill(rectangleFill); }
public static Label createIconLabel(GlyphIcons icon, String iconSize, String text, ContentDisplay contentDisplay, Paint colour, String style) { Text iconLabel = GlyphsDude.createIcon(icon, iconSize); iconLabel.setFill(colour); Label label = new Label(text); label.setTextFill(colour); label.setStyle(style); label.setGraphic(iconLabel); label.setContentDisplay(contentDisplay); return label; }
public void setMediumHGridLinePaint(final Paint PAINT) { if (null == mediumHGridLinePaint) { _mediumHGridLinePaint = PAINT; drawGrid(); } else { mediumHGridLinePaint.set(PAINT); } }
public ObjectProperty<Paint> majorHGridLinePaintProperty() { if (null == majorHGridLinePaint) { majorHGridLinePaint = new ObjectPropertyBase<Paint>(_majorHGridLinePaint) { @Override protected void invalidated() { drawGrid(); } @Override public Object getBean() { return Grid.this; } @Override public String getName() { return "majorHGridLinePaint"; } }; _majorHGridLinePaint = null; } return majorHGridLinePaint; }
public static Label createIconLabel(GlyphIcons icon, String iconSize, String text, ContentDisplay contentDisplay, Paint iconColour, Paint textColour, String style) { Text iconLabel = GlyphsDude.createIcon(icon, iconSize); iconLabel.setFill(iconColour); Label label = new Label(text); label.setTextFill(textColour); label.setStyle(style); label.setGraphic(iconLabel); label.setContentDisplay(contentDisplay); return label; }
@FXML private void clickSendButton(){ String rating, showName, episodeId, season, episode; showName = shownameField.getText().replace(" ", "."); season = seasonField.getText(); episode = episodeField.getText(); /*Get user rating*/ RadioButton chk = (RadioButton)userRating.getSelectedToggle(); rating = chk.getText(); /*Form MyShows query*/ new Shows().searchByFile(formSearchString(showName, season, episode)); episodeId = new Shows().getEpisodeId(); System.out.println(episodeId); String rateResponce = new Manage().rateEpisode(episodeId,rating); switch(rateResponce){ case "ok": sendStatus.setTextFill(Paint.valueOf("GREEN")); sendStatus.setText("Отправлено!"); break; case "fail": sendStatus.setText("Ошибка"); sendStatus.setTextFill(Paint.valueOf("RED")); break; } //System.out.println(episodeId); new Manage().rateEpisode(episodeId,rating); }
private HBox connexionStatusInformation( ) { final HBox container = new HBox( ); container.setAlignment( Pos.CENTER ); container.setSpacing( 10 ); final ProgressIndicator indicator = new ProgressIndicator( ); indicator.setPrefSize( 20, 20 ); indicator.visibleProperty( ).bind( _model.loadingProperty( ) ); final Label connectionInformation = new Label( ); connectionInformation.setTextAlignment( TextAlignment.CENTER ); connectionInformation.setWrapText( true ); connectionInformation.textProperty( ).bind( _model.loadingInformationProperty( ) ); connectionInformation.visibleProperty( ).bind( _model.loadingInformationProperty( ).isEmpty( ).not( ) ); connectionInformation.textFillProperty( ).bind( Bindings.<Paint>createObjectBinding( ( ) -> { if ( _model.loadingProperty( ).get( ) ) return Paint.valueOf( "black" ); return _model.isLoadingFailure( ) ? Paint.valueOf( "red" ) : Paint.valueOf( "green" ); }, _model.loadingFailureProperty( ), _model.loadingProperty( ) ) ); connectionInformation.minHeightProperty( ).bind( createIntegerBinding( ( ) -> { if ( _model.loadingInformationProperty( ).isEmpty( ).get( ) ) { return 0; } else { return 50; } }, _model.loadingInformationProperty( ) ) ); connectionInformation.maxHeightProperty( ).bind( connectionInformation.minHeightProperty( ) ); container.getChildren( ).addAll( indicator, connectionInformation ); return container; }
private void displayNotification() { Image gmrLogo = new Image(getClass().getResourceAsStream("GMRLogo.png")); notification = new TrayNotification("It's your turn", "It's your turn in " + playerGames.size() + " games", Notifications.SUCCESS); notification.setRectangleFill(Paint.valueOf("#565656")); notification.setImage(gmrLogo); notification.setAnimation(Animations.POPUP); notification.showAndDismiss(Duration.seconds(15)); }
@FXML public void refreshAll(){ list.clear(); table.setItems(list); errormsg.setTextFill(Paint.valueOf("red")); errormsg.setText(""); animename.setText(""); location.setText(""); }
@FXML public void refreshAll(){ list.clear(); table.setItems(list); errormsg.setTextFill(Paint.valueOf("red")); errormsg.setText(""); url.setText(""); path.setText(""); }
public void setGridLinePaint(final Paint PAINT) { setMajorHGridLinePaint(PAINT); setMediumHGridLinePaint(PAINT); setMinorHGridLinePaint(PAINT); setMajorVGridLinePaint(PAINT); setMediumVGridLinePaint(PAINT); setMinorVGridLinePaint(PAINT); }
public YPane(final Paint BACKGROUND, final YSeries<T>... SERIES) { getStylesheets().add(YPane.class.getResource("chart.css").toExternalForm()); aspectRatio = PREFERRED_HEIGHT / PREFERRED_WIDTH; keepAspect = false; _chartBackground = BACKGROUND; listOfSeries = FXCollections.observableArrayList(SERIES); _thresholdY = 100; _thresholdYVisible = false; _thresholdYColor = Color.RED; _lowerBoundY = 0; _upperBoundY = 100; valid = isChartTypeValid(); initGraphics(); registerListeners(); }
public ObjectProperty<Paint> chartBackgroundProperty() { if (null == chartBackground) { chartBackground = new ObjectPropertyBase<Paint>(_chartBackground) { @Override protected void invalidated() { redraw(); } @Override public Object getBean() { return YPane.this; } @Override public String getName() { return "chartBackground"; } }; _chartBackground = null; } return chartBackground; }
public void setSeriesColor(final XYChart.Series<X, Y> SERIES, final Paint STROKE, final Paint FILL, final Background SYMBOL_BACKGROUND, final Paint LEGEND_SYMBOL_FILL) { if (getData().isEmpty()) { return; } if (!getData().contains(SERIES)) { return; } if (null != FILL) { ((Path) ((Group) SERIES.getNode()).getChildren().get(0)).setFill(FILL); } if (null != STROKE) { ((Path) ((Group) SERIES.getNode()).getChildren().get(1)).setStroke(STROKE); } if (null != SYMBOL_BACKGROUND) { setSymbolFill(SERIES, SYMBOL_BACKGROUND); } if (null != LEGEND_SYMBOL_FILL) { setLegendSymbolFill(SERIES, LEGEND_SYMBOL_FILL); } }
private KeyValue createKeyValue(NodeModel nodeModel, KeyValueModel keyValueModel) { Optional<DoubleProperty> doubleProperty = ModelFunctions.getDoubleProperty(nodeModel.getNode(), keyValueModel.getField()); if (doubleProperty.isPresent()) { return new KeyValue(doubleProperty.get(), (double) keyValueModel.getValue(), keyValueModel.getInterpolator().toFxInterpolator()); } Optional<ObjectProperty<Paint>> paintProperty = ModelFunctions.getPaintProperty(nodeModel.getNode(), keyValueModel.getField()); if (paintProperty.isPresent()) { return new KeyValue(paintProperty.get(), (Paint) keyValueModel.getValue(), keyValueModel.getInterpolator().toFxInterpolator()); } throw new UnsupportedOperationException(); }