/** * Initializes an FXLocalization object that manages the resource bundle of your app for switching between languages. * See also {@link ResourceBundle}. * * @param supportedLocales A list of the language locales supported by the client app. * @param basePath Base path used to load the resource bundles. * @param classLoader Class loader used to load the resource bundles. */ public FXLocalization(List<Locale> supportedLocales, String basePath, ClassLoader classLoader) { if(supportedLocales.isEmpty()) supportedLocales.add(Locale.getDefault()); this.supportedLocales = supportedLocales; this.basePath = basePath; this.classLoader = classLoader; languageDisplayNames = supportedLocales.stream() .map(loc -> loc.getDisplayLanguage(loc).toUpperCase()) .collect(Collectors.toList()); locale = new SimpleObjectProperty<>(getDefaultLocale()); locale.addListener((obs,o,n) -> Locale.setDefault(n)); }
@SuppressWarnings("unchecked") public UpdateDialog(List<CurseFullProject.CurseFile> files) { super(files); TableColumn<CurseFullProject.CurseFile, String> columnName = new TableColumn<>("Files"); columnName.setCellValueFactory(cell -> new SimpleStringProperty(cell.getValue().getFileName())); TableColumn<CurseFullProject.CurseFile, String> columnVersion = new TableColumn<>("Version"); columnVersion.setCellValueFactory(cell -> new SimpleStringProperty(cell.getValue().getGameVersion().stream().collect(Collectors.joining(", ")))); TableColumn<CurseFullProject.CurseFile, Date> columnDate = new TableColumn<>("Release Date"); columnDate.setCellValueFactory(cell -> new SimpleObjectProperty<>(cell.getValue().getDate())); table.getColumns().addAll(columnName, columnVersion, columnDate); setTitle("File Update Dialog"); dialogPane.setHeaderText("Please Choose a File Version"); dialogPane.getStyleClass().add("pack-update-dialog"); dialogPane.getButtonTypes().addAll(ButtonType.OK, ButtonType.CANCEL); }
public void beforeEach() { final GraphStore graphStore = mock(GraphStore.class); when(graphStore.getGfaFileProperty()).thenReturn(new SimpleObjectProperty<>()); searchQuery = mock(SearchQuery.class); query = new Query(graphStore); query.setSearchQuery(searchQuery); }
TabEntity() { this.tab = new Tab(); this.manager = new CodeAreaManager(new CodeArea()); this.codeArea = manager.getCodeArea(); this.file = new SimpleObjectProperty<>(); this.name = new SimpleStringProperty(); this.icon = new FontAwesomeIconView(); this.order = new SimpleIntegerProperty(nameOrder.next()); init(); CacheUtil.cache(MainFrameController.this, tab, () -> this); }
SimpleOption(T defaultValue, String describe) { this.property = new SimpleObjectProperty<>(); this.defaultValue = defaultValue; this.describe = describe; property.setValue(defaultValue); }
@SuppressWarnings("unchecked") public WizardStepBuilder addFileChooser(final String fieldName, final String fileChooseLabel, final String startDir, final FileChooser.ExtensionFilter... filters) { final WizardStep current = this.current; final HBox box = new HBox(); final JFXButton button = new JFXButton(fileChooseLabel); button.setStyle("-fx-text-fill: BLACK;-fx-font-size: 18px;-fx-opacity: 0.7;"); final FileChooser fileChooser = new FileChooser(); fileChooser.setTitle(fileChooseLabel); fileChooser.setInitialDirectory(new File(startDir)); fileChooser.getExtensionFilters().addAll(filters); this.current.getData().put(fieldName, new SimpleObjectProperty<File>()); button.setOnAction( e -> current.getData().get(fieldName).setValue(fileChooser.showOpenDialog(MineIDE.primaryStage))); final Label label = new Label(fieldName); GridPane.setHalignment(label, HPos.RIGHT); GridPane.setHalignment(button, HPos.LEFT); this.current.add(label, 0, this.current.getData().size() - 1); final JFXTextField text = new JFXTextField(); text.setEditable(false); this.current.getData().get(fieldName).addListener( (ChangeListener<File>) (observable, oldValue, newValue) -> text.setText(newValue.getAbsolutePath())); box.getChildren().addAll(text, button); this.current.add(box, 1, this.current.getData().size() - 1); return this; }
public static <F, T> ObservableValue<T> nestValue(ObservableValue<F> pf, Function<F, ObservableValue<T>> func) { ObservableValue<T> current = func.apply(pf.getValue()); Property<T> nestProp = new SimpleObjectProperty<>(); nestProp.bind(current); pf.addListener((ob, o, n) -> { ObservableValue<T> pt = func.apply(n); nestProp.unbind(); nestProp.bind(pt); }); return nestProp; }
private void initKey() { commandColumn.setCellValueFactory(cdf -> new SimpleStringProperty(cdf.getValue().getDescribe())); bindingColumn.setCellValueFactory(cdf -> CacheUtil.cache(OptionsController.this, cdf.getValue(), () -> new SimpleObjectProperty<>(cdf.getValue().get()))); // bindingColumn.setCellValueFactory(cdf -> new SimpleObjectProperty<>(cdf.getValue().get())); bindingColumn.setEditable(true); bindingColumn.setCellFactory(column -> new KeyEditField()); keyTable.getItems().setAll(Options.KEY.getChildren(KeyCombination.class)); onSubmit.add(() -> keyTable.getItems().forEach(key -> key.set(bindingColumn.getCellData(key)))); }
public AnimatedIcon() { iconFill = new SimpleObjectProperty<>(Color.ORANGE); line1 = new Line(4, 8, 28, 8); line1.setStrokeWidth(3); line1.strokeProperty().bind(iconFill); line1.setManaged(false); line1.setStrokeLineCap(StrokeLineCap.ROUND); line2 = new Line(4, 16, 28, 16); line2.setStrokeWidth(3); line2.strokeProperty().bind(iconFill); line2.setManaged(false); line2.setStrokeLineCap(StrokeLineCap.ROUND); line3 = new Line(4, 24, 28, 24); line3.setStrokeWidth(3); line3.strokeProperty().bind(iconFill); line3.setManaged(false); line3.setStrokeLineCap(StrokeLineCap.ROUND); getChildren().addAll(line1, line2, line3); setPrefWidth(32); setPrefHeight(32); setMinWidth(USE_PREF_SIZE); setMinHeight(USE_PREF_SIZE); setMaxWidth(USE_PREF_SIZE); setMaxHeight(USE_PREF_SIZE); }
/** * add the given property * * @param canValue * @param property */ public <T> void addCanProperty(CANValue<T> canValue, SimpleObjectProperty<T> property) { CANProperty<CANValue<T>, T> canProperty = new CANProperty<CANValue<T>, T>( canValue, property); getCanProperties().put(canValue.canInfo.getName(), canProperty); }
@Test public void testProblems() { JsonElement testjson = JsonTableParser.jsonFromResource(testfile, ConstraintSpecificationValidatorTest.class); List<CodeIoVariable> codeIoVariables = JsonTableParser.codeIoVariablesFromJson(testjson); List<Type> typeContext = Arrays.asList(TypeInt.INT, TypeBool.BOOL); FreeVariableList freeVars = JsonTableParser.freeVariableSetFromJson(testjson); ConstraintSpecification testSpec = JsonTableParser.constraintTableFromJson(testjson); FreeVariableListValidator validator = new FreeVariableListValidator( new SimpleObjectProperty<>(typeContext), freeVars ); ConstraintSpecificationValidator recognizer = new ConstraintSpecificationValidator( new SimpleObjectProperty<>(typeContext), new SimpleObjectProperty<>(codeIoVariables), validator.validFreeVariablesProperty(), testSpec ); List<Class<?>> expectedProblems = JsonTableParser.expectedSpecProblemsFromJson(testjson); System.out.println("Expecting problems: " + expectedProblems.stream().map(Class::getSimpleName).collect(Collectors.toList())); System.out.println("Actual Problems: "); recognizer.problemsProperty().get().forEach(System.out::println); assertEquals("Problem list emptiness: ", expectedProblems.isEmpty(), recognizer.problemsProperty().get().isEmpty()); assertTrue( expectedProblems.stream().allMatch(aClass -> recognizer.problemsProperty().get().stream().anyMatch(aClass::isInstance))); }
/** * Initializes the ScrabbleGame with all the needed information * * @param language The language to be used during the game * @param players The players * @param bag The bag * @param board The board */ protected void initializeScrabbleGame(LanguageInterface language, List<PlayerInterface> players, PlayerInterface currentPlayer, BagInterface bag, BoardInterface board) { this.consecutiveTurnsSkipped = 0; this.language = language; this.board = board; this.players = new ArrayList<>(players); this.currentPlayer = new SimpleObjectProperty<>(currentPlayer); this.bag = bag; this.checkIfArtificialIntelligenceShouldPlay(); }
public void toggleDeclaration(final MouseEvent mouseEvent) { final Circle circle = new Circle(0); circle.setCenterX(component.get().getWidth() - (toggleDeclarationButton.getWidth() - mouseEvent.getX())); circle.setCenterY(-1 * mouseEvent.getY()); final ObjectProperty<Node> clip = new SimpleObjectProperty<>(circle); declaration.clipProperty().bind(clip); final Transition rippleEffect = new Transition() { private final double maxRadius = Math.sqrt(Math.pow(getComponent().getWidth(), 2) + Math.pow(getComponent().getHeight(), 2)); { setCycleDuration(Duration.millis(500)); } protected void interpolate(final double fraction) { if (getComponent().isDeclarationOpen()) { circle.setRadius(fraction * maxRadius); } else { circle.setRadius(maxRadius - fraction * maxRadius); } clip.set(circle); } }; final Interpolator interpolator = Interpolator.SPLINE(0.785, 0.135, 0.15, 0.86); rippleEffect.setInterpolator(interpolator); rippleEffect.play(); getComponent().declarationOpenProperty().set(!getComponent().isDeclarationOpen()); }
public ReadOnlyObjectProperty<ObservableList<PrawnFile.Run>> shrimpRunsProperty() { return new SimpleObjectProperty<>(shrimpRuns); }
public final B pixelOnColor(final Color COLOR) { properties.put("pixelOnColor", new SimpleObjectProperty(COLOR)); return (B)this; }
public final B maxSize(final double WIDTH, final double HEIGHT) { properties.put("maxSize", new SimpleObjectProperty<>(new Dimension2D(WIDTH, HEIGHT))); return (B)this; }
public final B zoneId(final ZoneId ID) { properties.put("zoneId", new SimpleObjectProperty<>(ID)); return (B)this; }
public final B strokeColor(final Color COLOR) { properties.put("strokeColor", new SimpleObjectProperty<>(COLOR)); return (B)this; }
/** * Create a new instance of {@link GraphDimensionsCalculator}. * * @param graphStore the {@link GraphStore} who's {@link org.dnacronym.hygene.parser.GfaFile} is observed */ @Inject @SuppressWarnings({"PMD.AvoidInstantiatingObjectsInLoops", "squid:S1188", "squid:S3776"}) public GraphDimensionsCalculator(final GraphStore graphStore) { observableQueryNodes = FXCollections.observableArrayList(); readOnlyObservableNodes = new ReadOnlyListWrapper<>(observableQueryNodes); centerNodeIdProperty = new SimpleIntegerProperty(1); radiusProperty = new SimpleIntegerProperty(DEFAULT_RADIUS); nodeCountProperty = new SimpleIntegerProperty(1); centerNodeIdProperty.addListener((observable, oldValue, newValue) -> { if (newValue.intValue() < 1) { centerNodeIdProperty.set(1); return; } if (newValue.intValue() >= getNodeCountProperty().intValue() - 1) { centerNodeIdProperty.set(nodeCountProperty.intValue() - 2); return; } centerPointQuery.query(centerNodeIdProperty.get(), radiusProperty.get()); }); radiusProperty.addListener((observable, oldValue, newValue) -> { if (centerPointQuery == null) { return; } centerPointQuery.query(centerNodeIdProperty.get(), radiusProperty.get()); }); viewPointProperty = new SimpleLongProperty(2000); viewPointProperty.addListener((observable, oldValue, newValue) -> { if (newValue.longValue() < 0) { viewPointProperty.set(0); return; } final int sentinelId = getGraphProperty().get().getNodeArrays().length - 1; final long sentinelEndPosition = getGraphProperty().get().getRealEndXPosition(sentinelId); if (newValue.longValue() > sentinelEndPosition) { viewPointProperty.set(sentinelEndPosition); return; } centerNodeIdProperty.set(getGraphProperty().get().getNodeAtPosition(newValue.longValue())); calculate(subgraph); }); viewRadiusProperty = new SimpleIntegerProperty(1); viewRadiusProperty.addListener((observable, oldValue, newValue) -> { calculate(subgraph); radiusProperty.set(((newValue.intValue() + FafospLayerer.LAYER_WIDTH - 1) / FafospLayerer.LAYER_WIDTH) / 2); }); nodeHeightProperty = new SimpleDoubleProperty(1); laneHeightProperty = new SimpleDoubleProperty(1); laneCountProperty = new SimpleIntegerProperty(1); graphProperty = new SimpleObjectProperty<>(); graphStore.getGfaFileProperty().addListener((observable, oldValue, newValue) -> setGraph(newValue.getGraph())); HygeneEventBus.getInstance().register(this); }
public final B padding(final Insets INSETS) { properties.put("padding", new SimpleObjectProperty<>(INSETS)); return (B)this; }
public final B items(final MatrixItem... ITEMS) { properties.put("itemsArray", new SimpleObjectProperty<>(ITEMS)); return (B)this; }
public SimpleObjectProperty<Component> componentProperty() { return component; }
public final B locale(final Locale LOCALE) { properties.put("locale", new SimpleObjectProperty<>(LOCALE)); return (B)this; }
public final B colorMapping(final ColorMapping COLOR_MAPPING) { properties.put("colorMapping", new SimpleObjectProperty<>(COLOR_MAPPING)); return (B)this; }
public final B items(final XYItem... ITEMS) { properties.put("itemsArray", new SimpleObjectProperty<>(ITEMS)); return (B)this; }
public final B prefSize(final double WIDTH, final double HEIGHT) { properties.put("prefSize", new SimpleObjectProperty<>(new Dimension2D(WIDTH, HEIGHT))); return (B)this; }
public final B chartType(final ChartType TYPE) { properties.put("chartType", new SimpleObjectProperty<>(TYPE)); return (B)this; }
public final B category(final Category CATEGORY) { properties.put("category", new SimpleObjectProperty<>(CATEGORY)); return (B)this; }
public final B brightTextColor(final Color COLOR) { properties.put("brightTextColor", new SimpleObjectProperty(COLOR)); return (B)this; }
public final B pressedColor(final Color COLOR) { properties.put("pressedColor", new SimpleObjectProperty<>(COLOR)); return (B)this; }
public final B stroke(final Color COLOR) { properties.put("stroke", new SimpleObjectProperty(COLOR)); return (B)this; }
public final B tickLabelFormat(final TickLabelFormat FORMAT) { properties.put("tickLabelFormat", new SimpleObjectProperty<>(FORMAT)); return (B)this; }
public final B streamFillMode(final StreamFillMode MODE) { properties.put("streamFillMode", new SimpleObjectProperty<>(MODE)); return (B)this; }
public final B mousePressHandler(final EventHandler<MouseEvent> HANDLER) { properties.put("mousePressHandler", new SimpleObjectProperty(HANDLER)); return (B)this; }
public final B streamColor(final Color COLOR) { properties.put("streamColor", new SimpleObjectProperty(COLOR)); return (B)this; }
public final B pixelOffColor(final Color COLOR) { properties.put("pixelOffColor", new SimpleObjectProperty(COLOR)); return (B)this; }
public final B items(final XYZItem... ITEMS) { properties.put("itemsArray", new SimpleObjectProperty<>(ITEMS)); return (B)this; }
public final B textColor(final Color COLOR) { properties.put("textColor", new SimpleObjectProperty<>(COLOR)); return (B)this; }
public final B symbolFill(final Color FILL) { properties.put("symbolFill", new SimpleObjectProperty<>(FILL)); return (B)this; }