@Test public void getText() { ColorPicker colorPicker = (ColorPicker) getPrimaryStage().getScene().getRoot().lookup(".color-picker"); LoggingRecorder lr = new LoggingRecorder(); List<String> text = new ArrayList<>(); Platform.runLater(() -> { RFXColorPicker rfxColorPicker = new RFXColorPicker(colorPicker, null, null, lr); colorPicker.setValue(Color.rgb(234, 156, 44)); rfxColorPicker.focusLost(null); text.add(rfxColorPicker._getText()); }); new Wait("Waiting for color picker text.") { @Override public boolean until() { return text.size() > 0; } }; AssertJUnit.assertEquals("#ea9c2c", text.get(0)); }
@Override public void handle() { Pane root = new Pane(); Text splash = createText(); ColorPicker colorPicker = new ColorPicker(); Circle circle = new Circle(100,100,30); circle.setFill(colorPicker.getValue()); colorPicker.setOnAction(e -> circle.setFill(colorPicker.getValue())); Button okayButton = createButton(root, colorPicker); root.getChildren().addAll(circle, colorPicker, okayButton, splash); Scene scene = new Scene(root,400,200); scene.getStylesheets().setAll(CSS_LOCATION); stage.setScene(scene); stage.show(); }
private void initialize () { fonts = new ComboBox<>(); fonts.getItems().addAll(Font.getFamilies()); root.getChildren().add(GUIUtils.makeRow(new CustomText("Font"), fonts)); fontSize = new NumberTextField(); root.getChildren().add(GUIUtils.makeRow(new CustomText("Font Size"), fontSize)); color = new ColorPicker(); root.getChildren().add(GUIUtils.makeRow(new CustomText("Color"), color)); style = new ComboBox<>(); style.getItems().addAll(VoogaBundles.textStyles.keySet()); root.getChildren().add(GUIUtils.makeRow(new CustomText("Style"), style)); ButtonMaker maker = new ButtonMaker(); Button apply = maker.makeButton("Apply", e -> { establishStyle(); this.close(); }); Button cancel = maker.makeButton("Cancel", e -> this.close()); root.getChildren().add(GUIUtils.makeRow(apply, cancel)); }
public ColorPickerTableCell(TableColumn<T, Color> column , ColorCellFactory parent) { this.parent = parent; this.colorPicker = new ColorPicker(); this.colorPicker.getStyleClass().add("button"); this.colorPicker.setStyle("-fx-color-label-visible:false;"); this.colorPicker.editableProperty().bind(column.editableProperty()); this.colorPicker.disableProperty().bind(column.editableProperty().not()); this.colorPicker.setOnShowing(event -> { final TableView<T> tableView = getTableView(); tableView.getSelectionModel().clearSelection(); tableView.getSelectionModel().select(getTableRow().getIndex()); tableView.edit(getIndex(), column); }); this.colorPicker.valueProperty().addListener((observable, oldValue, newValue) -> { if (isEditing()) { commitEdit(newValue); parent.chage(getIndex()); } }); // 텍스트는 화면에 보여주지않음. setContentDisplay(ContentDisplay.GRAPHIC_ONLY); }
@Smoke @Test(timeout = 300000) @Covers(value = {"javafx.scene.control.ColorPicker.value.BEHAVIOR", "javafx.scene.control.ColorPicker.value.GET", "javafx.scene.control.ColorPicker.value.BIND", "javafx.scene.control.ColorPicker.value.DEFAULT", "javafx.scene.control.ColorPicker.value.SET"}, level = Covers.Level.FULL) public void colorPropertyTest() { assertTrue(new ColorPicker().getValue().equals(Color.WHITE)); setColor("aaeeaa"); checkCurrentColorValue(Color.web("#aaeeaa")); for (SettingType settingType : EnumSet.of(SettingType.BIDIRECTIONAL, SettingType.SETTER, SettingType.UNIDIRECTIONAL)) { for (Color color : predefinedColors) { setPropertyByChoiceBox(settingType, color, Properties.value); checkTextFieldText(Properties.value, color.toString()); } } }
/** * * @param stage * @throws Exception */ @Override public void start(Stage stage) throws Exception { VBox box = new VBox(); Scene scene = new Scene(box); ColorPicker picker = new ColorPicker(); picker.setId("picker id"); box.getChildren().add(picker); stage.setScene(scene); stage.setWidth(300); stage.setHeight(300); stage.show(); }
public ImageGenerator() { TextField[] fields = new TextField[] {(TextField) Components.imageSize[1], (TextField) Components.imageSize[2], (TextField) Components.shadowLength[1]}; for(TextField field : fields) { Validate.removeError(field); if(!Validate.isNumber(field)) { error = true; Validate.addError(field); } } if(error) return; this.width = Integer.parseInt(fields[0].getText()); this.height = Integer.parseInt(fields[1].getText()); this.length = Integer.parseInt(fields[2].getText()); javafx.scene.paint.Color color = ((ColorPicker) Components.backgroundColors[1]).getValue(); this.color = new Color((float) color.getRed(), (float) color.getGreen(), (float) color.getBlue()); this.fading = ((CheckBox) Components.fading[1]).isSelected(); this.opacity = (float) ((Slider) Components.shadowOpacity[1]).getValue() / 100; }
public static void init() { JFXHelper.runLater(() -> { Stage stage = new Stage(); stage.setTitle("ColorPicker"); Scene scene = new Scene(new HBox(20), 240, 30); HBox box = (HBox) scene.getRoot(); box.setPadding(new Insets(5, 5, 5, 5)); color_picker = new ColorPicker(); color_picker.setValue(Color.CORAL); color_picker.setOnAction(e -> { Color color = color_picker.getValue(); a = 1 - (float) color.getOpacity(); r = (float) color.getRed(); g = (float) color.getGreen(); b = (float) color.getBlue(); }); box.getChildren().addAll(color_picker); stage.setScene(scene); stage.show(); }); }
/** * Constructs a new {@link ThemeBuilderShortcutsPane}. * @param styling the {@link JavaFxStyle}. * @param shortcuts the {@link ThemeBuilderShortcutProperties}. */ ThemeBuilderShortcutsPane( JavaFxStyle styling, ThemeBuilderShortcutProperties shortcuts ){ this.shortcuts = shortcuts; this.registrations = new RegistrationManager(); styling.configureHalfWidthConstraints( this ); label = styling.createBoldLabel( LABEL_TEXT ); add( label, 0, 0 ); picker = new ColorPicker(); styling.configureColorPicker( picker, ( Color )null ); add( picker, 1, 0 ); this.registrations.apply( new ChangeListenerBindingImpl< Color >( picker.valueProperty(), shortcuts.shortcutColorProperty() ) ); styling.applyBasicPadding( this ); }
/** * General mechanism for adding {@link ColorPicker}s. * @param row the row to add the items on. * @param label the {@link Label} describing the {@link ColorPicker}. * @param picker the {@link ColorPicker}. * @param shortcut the {@link Button} providing the shortcut. * @param map the {@link ObservableMap} providing the {@link Color}. */ private void addItemConfiguration( int row, Label label, ColorPicker picker, Button shortcut, ObservableMap< BuildResultStatus, Color > map ) { add( label, 0, row ); styling.configureColorPicker( picker, map.get( status ) ); map.addListener( new StatusFilterPropertyUpdater( map, status, picker.valueProperty() ) ); picker.valueProperty().addListener( ( s, o, n ) -> map.put( status, n ) ); add( picker, 1, row ); shortcut.setMaxWidth( Double.MAX_VALUE ); shortcut.setOnAction( e -> picker.setValue( shortcuts.shortcutColorProperty().get() ) ); add( shortcut, 2, row ); }
private void assertThatElementsAreProvided( Label label, String labelText, ColorPicker picker, Button button, ObservableMap< BuildResultStatus, Color > map ){ assertThat( systemUnderTest.getChildren().contains( label ), is( true ) ); assertThat( label.getText(), is( labelText ) ); verify( styling ).createBoldLabel( labelText ); assertThat( systemUnderTest.getChildren().contains( picker ), is( true ) ); verify( styling ).configureColorPicker( picker, map.get( status ) ); assertThat( systemUnderTest.getChildren().contains( button ), is( true ) ); assertThat( button.getText(), is( StatusConfigurationPane.SHORTCUT_BUTTON_TEXT ) ); assertThat( button.getMaxWidth(), is( Double.MAX_VALUE ) ); }
private void initDraw(GraphicsContext gc){ colorPicker = new ColorPicker(); double canvasWidth = gc.getCanvas().getWidth(); double canvasHeight = gc.getCanvas().getHeight(); gc.setFill(Color.LIGHTGRAY); gc.setStroke(Color.BLACK); gc.setLineWidth(5); gc.fill(); gc.strokeRect( 0, //x of the upper left corner 0, //y of the upper left corner canvasWidth, //width of the rectangle canvasHeight); //height of the rectangle gc.setFill(colorPicker.getValue()); gc.setStroke(colorPicker.getValue()); gc.setLineWidth(1); }
private void updateColor() { final ColorPicker colorPicker = (ColorPicker) getSkinnable(); // update picker box color Circle colorCircle = new Circle(); colorCircle.setFill(colorPicker.getValue()); colorCircle.setLayoutX(colorBox.getWidth() / 4); colorCircle.setLayoutY(colorBox.getHeight() / 2); colorBox.getChildren().add(colorCircle); Timeline animateColor = new Timeline(new KeyFrame(Duration.millis(240), new KeyValue(colorCircle.radiusProperty(), 200, Interpolator.EASE_BOTH))); animateColor.setOnFinished((finish) -> { JFXNodeUtils.updateBackground(colorBox.getBackground(), colorBox, colorCircle.getFill()); colorBox.getChildren().remove(colorCircle); }); animateColor.play(); // update label color displayNode.setTextFill(colorPicker.getValue().grayscale().getRed() < 0.5 ? Color.valueOf( "rgba(255, 255, 255, 0.87)") : Color.valueOf("rgba(0, 0, 0, 0.87)")); if (colorLabelVisible.get()) { displayNode.setText(JFXNodeUtils.colorToHex(colorPicker.getValue())); } else { displayNode.setText(""); } }
public ColorTableCell(TableColumn<T, Color> column) { colorPicker = new ColorPicker(); colorPicker.editableProperty().bind(column.editableProperty()); colorPicker.disableProperty().bind(column.editableProperty().not()); colorPicker.setOnShowing(event -> { final TableView<T> tableView = getTableView(); tableView.getSelectionModel().select(getTableRow().getIndex()); tableView.edit(tableView.getSelectionModel().getSelectedIndex(), column); }); colorPicker.valueProperty().addListener((observable, oldValue, newValue) -> { if (isEditing()) { commitEdit(newValue); } }); setContentDisplay(ContentDisplay.GRAPHIC_ONLY); }
@Override public void start(Stage stage) throws Exception { this.stage = stage; configureScene(); configureStage(); Button btn = new Button("Sai Pradeep"); btn.getStyleClass().add("my-btn"); btn.setPrefSize(90, 28); final SimpleObjectProperty<ColorPalette> cp = new SimpleObjectProperty<>(); final ColorPicker p = new ColorPicker(); p.showingProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> paramObservableValue, Boolean paramT1, Boolean showing) { if(showing && cp.get()==null){ // /color-palette System.out.println("Showing the pop up."); System.out.println(p.lookup(".color-palette")); } } }); root.getChildren().add(p); }
@Override public Optional<Color> colorInput(String action, String question, Color _default) { Dialog<Color> dialog = new Dialog<>(); dialog.setTitle(action); dialog.setHeaderText(question); ColorPicker picker = new ColorPicker(_default); Button randomiser = new Button("Mix"); randomiser.setOnAction(e -> { Color current = picker.getValue(); Color shifted = Item.shiftColor(current); picker.setValue(shifted); }); HBox box = new HBox(); box.getChildren().addAll(picker, randomiser); dialog.getDialogPane().setContent(box); dialog.getDialogPane().getButtonTypes().addAll( ButtonType.OK, ButtonType.CANCEL); dialog.setResultConverter(buttonType -> { if (buttonType.equals(ButtonType.OK)) { return picker.getValue(); } else { return null; } }); return dialog.showAndWait(); }
public void addColorControl(final String title, final ObjectProperty<Paint> paintProperty) { final ColorPicker colorPicker = ColorPickerBuilder.create() .value((Color) paintProperty.get()).build(); paintProperty.bind(colorPicker.valueProperty()); final VBox box = new VBox(); final Text titleText = new Text(title); titleText.textProperty().bind(new StringBinding() { { super.bind(colorPicker.valueProperty()); } @Override protected String computeValue() { return title + " : " + colorPicker.getValue().toString(); } }); box.getChildren().addAll(titleText, colorPicker); getChildren().add(box); }
/** * When the user finishes picking the color for edges in the {@link ColorPicker}. * * @param actionEvent the {@link ActionEvent} */ @FXML void edgeColorDone(final ActionEvent actionEvent) { settings.addRunnable(() -> { final Color newValue = ((ColorPicker) actionEvent.getSource()).getValue(); graphVisualizer.getEdgeColorProperty().setValue(newValue); LOGGER.info("Edge color has now been set to " + newValue + "."); }); }
@Override public void beforeEach() { graphVisualizer = mock(GraphVisualizer.class); graphMovementCalculator = mock(GraphMovementCalculator.class); settings = mock(Settings.class); createContextOfTest(); basicSettingsViewController = new BasicSettingsViewController(); injectMembers(basicSettingsViewController); final SimpleDoubleProperty height = new SimpleDoubleProperty(); height.setValue(20); when(graphVisualizer.getNodeHeightProperty()).thenReturn(height); final SimpleDoubleProperty panning = new SimpleDoubleProperty(21); when(graphMovementCalculator.getPanningSensitivityProperty()).thenReturn(panning); final SimpleDoubleProperty zooming = new SimpleDoubleProperty(0.042); when(graphMovementCalculator.getZoomingSensitivityProperty()).thenReturn(zooming); final ObjectProperty<Color> color = new SimpleObjectProperty<>(Color.RED); when(graphVisualizer.getEdgeColorProperty()).thenReturn(color); colorPicker = mock(ColorPicker.class); when(colorPicker.getValue()).thenReturn(Color.YELLOW); slider = mock(Slider.class); when(slider.getValue()).thenReturn(42.42); mouseEvent = mock(MouseEvent.class); actionEvent = mock(ActionEvent.class); captor = ArgumentCaptor.forClass(Runnable.class); }
public static void reset() { add(Node.class, JavaFXElement.class); add(TextInputControl.class, JavaFXTextInputControlElement.class); add(HTMLEditor.class, JavaFXHTMLEditor.class); add(CheckBox.class, JavaFXCheckBoxElement.class); add(ToggleButton.class, JavaFXToggleButtonElement.class); add(Slider.class, JavaFXSliderElement.class); add(Spinner.class, JavaFXSpinnerElement.class); add(SplitPane.class, JavaFXSplitPaneElement.class); add(ProgressBar.class, JavaFXProgressBarElement.class); add(ChoiceBox.class, JavaFXChoiceBoxElement.class); add(ColorPicker.class, JavaFXColorPickerElement.class); add(ComboBox.class, JavaFXComboBoxElement.class); add(DatePicker.class, JavaFXDatePickerElement.class); add(TabPane.class, JavaFXTabPaneElement.class); add(ListView.class, JavaFXListViewElement.class); add(TreeView.class, JavaFXTreeViewElement.class); add(TableView.class, JavaFXTableViewElement.class); add(TreeTableView.class, JavaFXTreeTableViewElement.class); add(CheckBoxListCell.class, JavaFXCheckBoxListCellElement.class); add(ChoiceBoxListCell.class, JavaFXChoiceBoxListCellElement.class); add(ComboBoxListCell.class, JavaFXComboBoxListCellElemnt.class); add(CheckBoxTreeCell.class, JavaFXCheckBoxTreeCellElement.class); add(ChoiceBoxTreeCell.class, JavaFXChoiceBoxTreeCellElement.class); add(ComboBoxTreeCell.class, JavaFXComboBoxTreeCellElement.class); add(TableCell.class, JavaFXTableViewCellElement.class); add(CheckBoxTableCell.class, JavaFXCheckBoxTableCellElement.class); add(ChoiceBoxTableCell.class, JavaFXChoiceBoxTableCellElement.class); add(ComboBoxTableCell.class, JavaFXComboBoxTableCellElemnt.class); add(TreeTableCell.class, JavaFXTreeTableCellElement.class); add(CheckBoxTreeTableCell.class, JavaFXCheckBoxTreeTableCell.class); add(ChoiceBoxTreeTableCell.class, JavaFXChoiceBoxTreeTableCell.class); add(ComboBoxTreeTableCell.class, JavaFXComboBoxTreeTableCell.class); }
@Override public boolean marathon_select(String value) { ColorPicker colorPicker = (ColorPicker) getComponent(); if (!value.equals("")) { try { colorPicker.setValue(Color.valueOf(value)); Event.fireEvent(colorPicker, new ActionEvent()); return true; } catch (Throwable t) { throw new IllegalArgumentException("Invalid value for '" + value + "' for color-picker '"); } } return false; }
@Test public void selectColor() { ColorPicker colorPickerNode = (ColorPicker) getPrimaryStage().getScene().getRoot().lookup(".color-picker"); Platform.runLater(() -> colorpicker.marathon_select("#ff0000")); new Wait("Waiting for color to be set.") { @Override public boolean until() { return colorPickerNode.getValue().toString().equals("0xff0000ff"); } }; }
@Test public void selectColor() { ColorPicker colorPicker = (ColorPicker) getPrimaryStage().getScene().getRoot().lookup(".color-picker"); LoggingRecorder lr = new LoggingRecorder(); Platform.runLater(() -> { RFXColorPicker rfxColorPicker = new RFXColorPicker(colorPicker, null, null, lr); colorPicker.setValue(Color.rgb(234, 156, 44)); rfxColorPicker.focusLost(null); }); List<Recording> recordings = lr.waitAndGetRecordings(1); Recording recording = recordings.get(0); AssertJUnit.assertEquals("recordSelect", recording.getCall()); AssertJUnit.assertEquals("#ea9c2c", recording.getParameters()[0]); }
@Test public void colorChooserWithColorName() { ColorPicker colorPicker = (ColorPicker) getPrimaryStage().getScene().getRoot().lookup(".color-picker"); LoggingRecorder lr = new LoggingRecorder(); Platform.runLater(() -> { RFXColorPicker rfxColorPicker = new RFXColorPicker(colorPicker, null, null, lr); colorPicker.setValue(Color.RED); rfxColorPicker.focusLost(null); }); List<Recording> recordings = lr.waitAndGetRecordings(1); Recording recording = recordings.get(0); AssertJUnit.assertEquals("recordSelect", recording.getCall()); AssertJUnit.assertEquals("#ff0000", recording.getParameters()[0]); }
private Button createButton(Pane root, ColorPicker colorPicker) { Button okayButton = new Button(myResources.getString("OkayButton")); okayButton.setLayoutX(200); okayButton.setLayoutY(100); okayButton.setId("btnLogin"); okayButton.setOnAction(e -> { root.setBackground(new Background(new BackgroundFill(colorPicker.getValue(), CornerRadii.EMPTY, Insets.EMPTY))); stage.close(); }); return okayButton; }
@Override @FXThread protected void createComponents() { super.createComponents(); colorPicker = new ColorPicker(); colorPicker.valueProperty().addListener((observable, oldValue, newValue) -> change()); colorPicker.prefWidthProperty().bind(widthProperty().multiply(DEFAULT_FIELD_W_PERCENT)); FXUtils.addClassTo(colorPicker, CSSClasses.ABSTRACT_PARAM_CONTROL_COLOR_PICKER); FXUtils.addToPane(colorPicker, this); }
@Override @FXThread protected void reload() { super.reload(); final ColorPicker colorPicker = getColorPicker(); colorPicker.setValue(UIUtils.from(getPropertyValue())); }
@Override @FXThread protected void changeImpl() { final ColorPicker colorPicker = getColorPicker(); setPropertyValue(UIUtils.from(colorPicker.getValue())); super.changeImpl(); }
@Override @FXThread protected void createComponents(@NotNull final HBox container) { super.createComponents(container); colorPicker = new ColorPicker(); colorPicker.valueProperty().addListener((observable, oldValue, newValue) -> updateValue()); colorPicker.prefWidthProperty().bind(widthProperty().multiply(CONTROL_WIDTH_PERCENT)); FXUtils.addToPane(colorPicker, container); FXUtils.addClassTo(colorPicker, CSSClasses.ABSTRACT_PARAM_CONTROL_COLOR_PICKER); }
@Override @FXThread public void changeControlWidthPercent(final double controlWidthPercent) { super.changeControlWidthPercent(controlWidthPercent); final ColorPicker colorPicker = getColorPicker(); colorPicker.prefWidthProperty().unbind(); colorPicker.prefWidthProperty().bind(widthProperty().multiply(controlWidthPercent)); }
/** * Updating value. */ @FXThread private void updateValue() { if (isIgnoreListener()) return; final ColorPicker colorPicker = getColorPicker(); final ColorRGBA newColor = UIUtils.from(colorPicker.getValue()); final ColorRGBA oldValue = getPropertyValue(); changed(newColor, oldValue == null ? null : oldValue.clone()); }
@Override protected ColorPicker createEditableControl() { final ColorPicker colorPicker = new ColorPicker(); colorPicker.prefWidthProperty().bind(widthProperty().multiply(0.35)); colorPicker.valueProperty().addListener((observable, oldValue, newValue) -> processChange(newValue)); FXUtils.addClassTo(colorPicker, CSSClasses.ABSTRACT_PARAM_CONTROL_COLOR_PICKER); return colorPicker; }
@Override public void reload() { final ColorInfluencerControl control = getControl(); final ColorInfluencer influencer = control.getInfluencer(); final ColorRGBA newColor = influencer.getColor(getIndex()); final float red = min(newColor.getRed(), 1F); final float green = min(newColor.getGreen(), 1F); final float blue = min(newColor.getBlue(), 1F); final float alpha = min(newColor.getAlpha(), 1F); final ColorPicker colorPicker = getEditableControl(); colorPicker.setValue(new Color(red, green, blue, alpha)); super.reload(); }
/** * Adds a color picker. * * @param labelText The label text for the color picker * @param children Where to add * @return The picker */ private static ColorPicker addColorPicker (final String labelText, final ObservableList<Node> children) { final ColorPicker picker = new ColorPicker (); final Label label = new Label (labelText); label.setLabelFor (picker); children.add (label); children.add (picker); picker.setMinWidth (MIN_WIDTH_LEFT); return picker; }
@Override public Node createVisualisation(SimpleObjectProperty<Color> boundTo, boolean readonly) { ColorPicker colorPicker = new ColorPicker(); colorPicker.valueProperty().bindBidirectional(boundTo); colorPicker.setDisable(readonly); return colorPicker; }
HighlightingButtonCell(final TableView<Highlighting> table) { hBox = new HBox(); StackPane paddedFgLabel = new StackPane(); paddedFgLabel.setPadding(new Insets(1)); paddedFgLabel.getChildren().add(new Label("FG")); btnFgColor = new ColorPicker(Color.BLACK); //TODO obtain from main btnFgColor.setStyle("-fx-color-label-visible: false ;"); StackPane paddedFgButton = new StackPane(); paddedFgButton.setPadding(new Insets(1)); paddedFgButton.getChildren().add(btnFgColor); StackPane paddedBgLabel = new StackPane(); paddedBgLabel.setPadding(new Insets(1)); paddedBgLabel.getChildren().add(new Label("BG")); btnBgColor = new ColorPicker(Color.WHITE); //TODO obtain from main btnBgColor.setStyle("-fx-color-label-visible: false ;"); StackPane paddedBgButton = new StackPane(); paddedBgButton.setPadding(new Insets(1)); paddedBgButton.getChildren().add(btnBgColor); hBox.getChildren().add(paddedFgLabel); hBox.getChildren().add(paddedFgButton); hBox.getChildren().add(paddedBgLabel); hBox.getChildren().add(paddedBgButton); }
/** * Constructs a new {@link ColoursPanel}. * @param configuration the {@link BuildWallConfiguration} to configure. * @param styling the {@link BuildWallConfigurationStyle} to apply. * @param defaults the {@link ConfigurationPanelDefaults}. */ ColoursPanel( BuildWallConfiguration configuration, JavaFxStyle styling, ConfigurationPanelDefaults defaults ) { this.configuration = configuration; jobNameColourLabel = styling.createBoldLabel( "Job Name" ); add( jobNameColourLabel, 0, 0 ); jobNameColourPicker = new ColorPicker(); styling.configureColorPicker( jobNameColourPicker, configuration.jobNameColour() ); add( jobNameColourPicker, 1, 0 ); buildNumberColourLabel = styling.createBoldLabel( "Build Number" ); add( buildNumberColourLabel, 0, 1 ); buildNumberColourPicker = new ColorPicker(); styling.configureColorPicker( buildNumberColourPicker, configuration.buildNumberColour() ); add( buildNumberColourPicker, 1, 1 ); completionEstimateColourLabel = styling.createBoldLabel( "Build Time" ); add( completionEstimateColourLabel, 0, 2 ); completionEstimateColourPicker = new ColorPicker(); styling.configureColorPicker( completionEstimateColourPicker, configuration.completionEstimateColour() ); add( completionEstimateColourPicker, 1, 2 ); detailColourLabel = styling.createBoldLabel( "Detail" ); add( detailColourLabel, 0, 3 ); detailColourPicker = new ColorPicker(); styling.configureColorPicker( detailColourPicker, configuration.detailColour() ); add( detailColourPicker, 1, 3 ); defaults.configureColumnConstraints( this ); }
@Test public void shouldConfigureColorPickerWithProperty(){ ObjectProperty< Color > property = new SimpleObjectProperty<>( Color.BLACK ); ColorPicker picker = new ColorPicker( Color.RED ); systemUnderTest.configureColorPicker( picker, property ); assertThat( picker.getMaxWidth(), is( Double.MAX_VALUE ) ); assertThat( picker.getValue(), is( Color.BLACK ) ); property.set( Color.YELLOW ); assertThat( picker.getValue(), is( Color.YELLOW ) ); picker.setValue( Color.PURPLE ); assertThat( property.get(), is( Color.PURPLE ) ); }
@Test public void shouldConfigureColorPicker(){ ColorPicker picker = new ColorPicker( Color.RED ); systemUnderTest.configureColorPicker( picker, Color.BLACK ); assertThat( picker.getMaxWidth(), is( Double.MAX_VALUE ) ); assertThat( picker.getValue(), is( Color.BLACK ) ); }
private void assertThatElementsAreUpdated( ObservableMap< BuildResultStatus, Color > map, ColorPicker picker ) { map.put( status, Color.BLANCHEDALMOND ); assertThat( picker.getValue(), is( Color.BLANCHEDALMOND ) ); map.put( status, null ); assertThat( picker.getValue(), is( nullValue() ) ); }