List of usage examples for javafx.beans.property SimpleStringProperty SimpleStringProperty
public SimpleStringProperty(String initialValue)
From source file:poe.trade.assist.Main.java
@Override public void start(Stage stage) { // try { // fh = new FileHandler("D:\\MxDownload\\POE\\poe.trade.assist\\assist.log"); // } catch (IOException e) { // e.printStackTrace(); // }// w w w . j a v a 2s . co m // logger.addHandler(fh); // SimpleFormatter formatter = new SimpleFormatter(); // fh.setFormatter(formatter); // logger.info("Init application."); BorderPane root = new BorderPane(); config = Config.load(); config.get(Config.SEARCH_FILE).ifPresent(searchFileTextField::setText); searchFileTextField.setPromptText("Search CSV File URL or blank"); searchFileTextField.setTooltip(new Tooltip( "Any url to a valid poe.trade.assist CSV search file. Can be googlespreadsheet URL. If left blank, will load search.csv file instead")); searchFileTextField.setMinWidth(330); HBox.setHgrow(searchFileTextField, Priority.ALWAYS); List<Search> searchList = loadSearchListFromFile(); AutoSearchService autoSearchService = new AutoSearchService( Boolean.parseBoolean(config.get(Config.AUTO_ENABLE).get()), Float.parseFloat(config.get(Config.SEARCH_MINUTES).get())); searchPane = new SearchPane(searchList); resultPane = new ResultPane(searchFileTextField, this); autoSearchService.searchesProperty().bind(searchPane.dataProperty()); EventHandler<ActionEvent> reloadAction = e -> { System.out.println("Loading search file: " + searchFileTextField.getText()); List<Search> newList = loadSearchListFromFile(); searchPane.dataProperty().clear(); searchPane.dataProperty().addAll(newList); autoSearchService.restart(); if (searchPane.dataProperty().size() > 0) searchPane.searchTable.getSelectionModel().select(0); }; searchFileTextField.setOnAction(reloadAction); resultPane.loadButton.setOnAction(reloadAction); resultPane.defaultButton.setOnAction(e -> { searchFileTextField.setText(DEFAULT_SEARCH_CSV_FILE); resultPane.loadButton.fire(); }); resultPane.runNowButton.setOnAction(e -> autoSearchService.restart()); // autoSearchService.minsToSleepProperty().bind(resultPane.noOfMinsTextField.textProperty()); setupResultPaneBinding(searchPane, resultPane, autoSearchService); if (searchList.size() > 0) searchPane.searchTable.getSelectionModel().select(0); stage.setOnCloseRequest(we -> { saveSearchList(searchPane); config.setProperty(Config.SEARCH_FILE, searchFileTextField.getText()); config.setProperty(Config.SOUND_FILE, resultPane.soundButton.getUserData().toString()); config.save(); }); config.get(Config.SOUND_FILE).ifPresent(resultPane.soundButton::setUserData); autoSearchService.restart(); // HBox container = new HBox(5, searchPane, resultPane); SplitPane container = new SplitPane(searchPane, resultPane); container.setDividerPositions(0.1); HBox.setHgrow(searchPane, Priority.ALWAYS); HBox.setHgrow(resultPane, Priority.ALWAYS); container.setMaxWidth(Double.MAX_VALUE); // root.getChildren().addAll(container); root.setCenter(container); Scene scene = new Scene(root); stage.getIcons().add(new Image("/48px-Durian.png")); stage.titleProperty().bind(new SimpleStringProperty("poe.trade.assist v5 (Durian) - ") .concat(autoSearchService.messageProperty())); // stage.setWidth(1200); // stage.setHeight(550); stage.setMaximized(true); stage.setScene(scene); stage.show(); searchPane.searchTable.requestFocus(); }
From source file:org.opendolphin.mvndemo.clientlazy.DemoController.java
private void initLazyModle(String[] colNames) { lazyModel.clear();//from ww w . j a v a 2s .c om Factory<SimpleStringProperty> factory = new Factory<SimpleStringProperty>() { public SimpleStringProperty create() { return new SimpleStringProperty("..."); } }; for (String colName : colNames) { Map<String, SimpleStringProperty> colProps = LazyMap .lazyMap(new HashMap<String, SimpleStringProperty>(), factory); lazyModel.add(colProps); } }
From source file:com.github.douglasjunior.simpleCSVEditor.FXMLController.java
private ObservableList<CSVRow> readFile(File csvFile) throws IOException { ObservableList<CSVRow> rows = FXCollections.observableArrayList(); Integer maxColumns = 0;/* ww w. j a v a2 s . c o m*/ try (Reader in = new InputStreamReader(new FileInputStream(csvFile));) { CSVParser parse = csvFormat.parse(in); for (CSVRecord record : parse.getRecords()) { if (maxColumns < record.size()) { maxColumns = record.size(); } CSVRow row = new CSVRow(); for (int i = 0; i < record.size(); i++) { row.getColumns().add(new SimpleStringProperty(record.get(i))); } rows.add(row); } this.numbeColumns = maxColumns; } return rows; }
From source file:com.QuarkLabs.BTCeClientJavaFX.MainController.java
@FXML void initialize() { assert clearLogButton != null : "fx:id=\"clearLogButton\" was not injected: check your FXML file 'mainlayout.fxml'."; assert fundsTable != null : "fx:id=\"fundsTable\" was not injected: check your FXML file 'mainlayout.fxml'."; assert logField != null : "fx:id=\"logField\" was not injected: check your FXML file 'mainlayout.fxml'."; assert buyButton != null : "fx:id=\"buyButton\" was not injected: check your FXML file 'mainlayout.fxml'."; assert sellButton != null : "fx:id=\"sellButton\" was not injected: check your FXML file 'mainlayout.fxml'."; assert showActiveOrdersButton != null : "fx:id=\"showActiveOrdersButton\" was not injected: check your FXML file 'mainlayout.fxml'."; assert tickersTableLastColumn != null : "fx:id=\"tickerTableLastColumn\" was not injected: check your FXML file 'mainlayout.fxml'."; assert tickersTablePairColumn != null : "fx:id=\"tickerTablePairColumn\" was not injected: check your FXML file 'mainlayout.fxml'."; assert tickersTable != null : "fx:id=\"tickersTable\" was not injected: check your FXML file 'mainlayout.fxml'."; assert tickersTableBuyColumn != null : "fx:id=\"tickersTableBuyColumn\" was not injected: check your FXML file 'mainlayout.fxml'."; assert tickersTableFeeColumn != null : "fx:id=\"tickersTableFeeColumn\" was not injected: check your FXML file 'mainlayout.fxml'."; assert tickersTableSellColumn != null : "fx:id=\"tickersTableSellColumn\" was not injected: check your FXML file 'mainlayout.fxml'."; assert tradeAmountValue != null : "fx:id=\"tradeAmountValue\" was not injected: check your FXML file 'mainlayout.fxml'."; assert tradePriceCurrencyType != null : "fx:id=\"tradeCurrencyPriceValue\" was not injected: check your FXML file 'mainlayout.fxml'."; assert tradeCurrencyType != null : "fx:id=\"tradeCurrencyType\" was not injected: check your FXML file 'mainlayout.fxml'."; assert tradePriceValue != null : "fx:id=\"tradePriceValue\" was not injected: check your FXML file 'mainlayout.fxml'."; assert updateFundsButton != null : "fx:id=\"updateFundsButton\" was not injected: check your FXML file 'mainlayout.fxml'."; assert fundsTableCurrencyColumn != null : "fx:id=\"fundsTableCurrencyColumn\" was not injected: check your FXML file 'mainlayout.fxml'."; assert fundsTableValueColumn != null : "fx:id=\"fundsTableValueColumn\" was not injected: check your FXML file 'mainlayout.fxml'."; assert activeOrdersTable != null : "fx:id=\"fundsTableValueColumn\" was not injected: check your FXML file 'mainlayout.fxml'."; assert activeOrdersAmountColumn != null : "fx:id=\"activeOrdersAmountColumn\" was not injected: check your FXML file 'mainlayout.fxml'."; assert activeOrdersPairColumn != null : "fx:id=\"activeOrdersPairColumn\" was not injected: check your FXML file 'mainlayout.fxml'."; assert activeOrdersRateColumn != null : "fx:id=\"activeOrdersRateColumn\" was not injected: check your FXML file 'mainlayout.fxml'."; assert activeOrdersTimeColumn != null : "fx:id=\"activeOrdersTimeColumn\" was not injected: check your FXML file 'mainlayout.fxml'."; assert activeOrdersTypeColumn != null : "fx:id=\"activeOrdersTypeColumn\" was not injected: check your FXML file 'mainlayout.fxml'."; assert activeOrdersCancelColumn != null : "fx:id=\"activeOrdersCancelColumn\" was not injected: check your FXML file 'mainlayout.fxml'."; //Holder for all main API methods of exchange app = new App(); //Loading configs loadExchangeConfig();//from w w w. j av a 2 s. c om //Populate choiceboxes at the trading section tradeCurrencyType.setItems(FXCollections.observableArrayList(currencies)); tradeCurrencyType.setValue(currencies.get(0)); tradePriceCurrencyType.setItems(FXCollections.observableArrayList(currencies)); tradePriceCurrencyType.setValue(currencies.get(0)); //Active Orders table activeOrdersAmountColumn.setCellValueFactory(new PropertyValueFactory<ActiveOrder, Double>("amount")); activeOrdersPairColumn.setCellValueFactory(new PropertyValueFactory<ActiveOrder, String>("pair")); activeOrdersRateColumn.setCellValueFactory(new PropertyValueFactory<ActiveOrder, Double>("rate")); activeOrdersTimeColumn.setCellValueFactory( new Callback<TableColumn.CellDataFeatures<ActiveOrder, String>, ObservableValue<String>>() { @Override public ObservableValue<String> call( TableColumn.CellDataFeatures<ActiveOrder, String> activeOrderStringCellDataFeatures) { ActiveOrder activeOrder = activeOrderStringCellDataFeatures.getValue(); DateFormat dateFormat = DateFormat.getDateTimeInstance(); Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(activeOrder.getTimestamp() * 1000); return new SimpleStringProperty(dateFormat.format(calendar.getTime())); } }); activeOrdersTypeColumn.setCellValueFactory(new PropertyValueFactory<ActiveOrder, String>("type")); activeOrdersTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); activeOrdersCancelColumn .setCellFactory(new Callback<TableColumn<ActiveOrder, Boolean>, TableCell<ActiveOrder, Boolean>>() { @Override public TableCell<ActiveOrder, Boolean> call( TableColumn<ActiveOrder, Boolean> activeOrderBooleanTableColumn) { return new ButtonCell<>(activeOrdersTable); } }); activeOrdersCancelColumn.setCellValueFactory( new Callback<TableColumn.CellDataFeatures<ActiveOrder, Boolean>, ObservableValue<Boolean>>() { @Override public ObservableValue<Boolean> call( TableColumn.CellDataFeatures<ActiveOrder, Boolean> activeOrderBooleanCellDataFeatures) { return new SimpleBooleanProperty(true); } }); //Tickers Table MenuItem showOrdersBook = new MenuItem("Show Orders Book"); MenuItem showPublicTrades = new MenuItem("Show Public Trades"); ContextMenu contextMenu = new ContextMenu(showOrdersBook, showPublicTrades); tickersTable.setItems(tickers); tickersTable.setContextMenu(contextMenu); tickersTableBuyColumn.setCellValueFactory(new PropertyValueFactory<Ticker, Double>("buy")); tickersTableFeeColumn.setCellValueFactory(new PropertyValueFactory<Ticker, Double>("fee")); tickersTableSellColumn.setCellValueFactory(new PropertyValueFactory<Ticker, Double>("sell")); tickersTableLastColumn.setCellValueFactory(new PropertyValueFactory<Ticker, Double>("last")); tickersTablePairColumn.setCellValueFactory(new PropertyValueFactory<Ticker, String>("pair")); tickersTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); tickersTable.setRowFactory(new Callback<TableView<Ticker>, TableRow<Ticker>>() { @Override public TableRow<Ticker> call(TableView<Ticker> tickerTableView) { return new TableRow<Ticker>() { @Override protected void updateItem(Ticker ticker, boolean b) { super.updateItem(ticker, b); if (!b) { if (tickersData.containsKey(ticker.getPair())) { if (ticker.getLast() < tickersData.get(ticker.getPair()).getLast()) { setStyle("-fx-control-inner-background: rgba(186, 0, 0, 0.5);"); } else if (ticker.getLast() == tickersData.get(ticker.getPair()).getLast()) { setStyle("-fx-control-inner-background: rgba(215, 193, 44, 0.5);"); } else { setStyle("-fx-control-inner-background: rgba(0, 147, 0, 0.5);"); } } } } }; } }); //Menu item to show Orders Book showOrdersBook.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent actionEvent) { Ticker selectedTicker = tickersTable.getSelectionModel().getSelectedItem(); Parent root; try { FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource(PATH_TO_ORDERS_BOOK_LAYOUT), resources); root = (Parent) fxmlLoader.load(); OrdersBookController ordersBookController = fxmlLoader.getController(); ordersBookController.injectPair(selectedTicker.getPair()); Stage stage = new Stage(); stage.setTitle("Orders Book for " + selectedTicker.getPair().replace("_", "/").toUpperCase()); stage.setScene(new Scene(root)); stage.setResizable(false); stage.show(); } catch (IOException e) { e.printStackTrace(); } } }); //Menu item to show Public Trades showPublicTrades.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent actionEvent) { Ticker selectedTicker = tickersTable.getSelectionModel().getSelectedItem(); Parent root; try { FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource(PATH_TO_TRADES_LAYOUT), resources); root = (Parent) fxmlLoader.load(); PublicTradesController publicTradesController = fxmlLoader.getController(); publicTradesController.injectPair(selectedTicker.getPair()); Stage stage = new Stage(); stage.setTitle("Public Trades for " + selectedTicker.getPair().replace("_", "/").toUpperCase()); stage.setScene(new Scene(root)); stage.setResizable(false); stage.show(); } catch (IOException e) { e.printStackTrace(); } } }); //Funds Table fundsTableCurrencyColumn.setCellValueFactory(new PropertyValueFactory<Fund, String>("currency")); fundsTableValueColumn.setCellValueFactory(new PropertyValueFactory<Fund, Double>("value")); fundsTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); fundsTable.setItems(fundsData); //Task to load tickers data from server final javafx.concurrent.Service loadTickersService = new javafx.concurrent.Service() { @Override protected Task createTask() { Task<JSONObject> loadTickers = new Task<JSONObject>() { @Override protected JSONObject call() throws Exception { String[] pairsArray = new String[pairs.size()]; pairsArray = pairs.toArray(pairsArray); return App.getPairInfo(pairsArray); } }; loadTickers.setOnFailed(new EventHandler<WorkerStateEvent>() { @Override public void handle(WorkerStateEvent workerStateEvent) { logField.appendText(workerStateEvent.getSource().getException().getMessage() + "\r\n"); } }); loadTickers.setOnSucceeded(new EventHandler<WorkerStateEvent>() { @Override public void handle(WorkerStateEvent workerStateEvent) { JSONObject jsonObject = (JSONObject) workerStateEvent.getSource().getValue(); //ugly hack to store old values //dump old values to tickersData //TODO think about better solution if (tickers.size() != 0) { for (Ticker x : tickers) { tickersData.put(x.getPair(), x); } } tickers.clear(); for (Iterator iterator = jsonObject.keys(); iterator.hasNext();) { String key = (String) iterator.next(); JSONObject data = jsonObject.getJSONObject(key); Ticker ticker = new Ticker(); ticker.setPair(key); ticker.setUpdated(data.optLong("updated")); ticker.setAvg(data.optDouble("avg")); ticker.setBuy(data.optDouble("buy")); ticker.setSell(data.optDouble("sell")); ticker.setHigh(data.optDouble("high")); ticker.setLast(data.optDouble("last")); ticker.setLow(data.optDouble("low")); ticker.setVol(data.optDouble("vol")); ticker.setVolCur(data.optDouble("vol_cur")); tickers.add(ticker); } } }); return loadTickers; } }; //Update tickers every 15 seconds //TODO better solution is required Timeline timeline = new Timeline(new KeyFrame(Duration.ZERO, new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent actionEvent) { loadTickersService.restart(); } }), new KeyFrame(Duration.seconds(15))); timeline.setCycleCount(Timeline.INDEFINITE); timeline.playFromStart(); }
From source file:de.ks.idnadrev.information.chart.ChartDataEditor.java
public void addColumnHeader(String title) { columnHeaders.add(new SimpleStringProperty(title)); }
From source file:com.rvantwisk.cnctools.controllers.CNCToolsController.java
private void addProjectDefaults() { Project p = new Project("Round stock 30mm", "Creates a round stock of 100mx30mm. Feedrate 2400"); projectModel.addProject(p);/* w w w.jav a 2 s .c o m*/ TaskRunnable mt = new TaskRunnable("Make Round", "Make square stock round (invalid milltask)", "com.rvantwisk.cnctools.operations.createRoundStock.CreateRoundStockController", "CreateRoundStock.fxml"); ToolParameter nt = Factory.newTool(); nt.setName("6MM end Mill"); mt.setMilltaskModel(new RoundStockModel(new SimpleStringProperty(""), DimensionProperty.DimMM(30.0), DimensionProperty.DimMM(20.0), DimensionProperty.DimMM(100.0))); p.millTasksProperty().add(mt); mt = new TaskRunnable("Make Square", "Make round stock square", "com.rvantwisk.cnctools.operations.createRoundStock.CreateRoundStockController", "CreateRoundStock.fxml"); nt = Factory.newTool(); nt.setName("8MM end Mill"); nt.radialDepthProperty().set(DimensionProperty.DimMM(4.0)); nt.axialDepthProperty().set(DimensionProperty.DimMM(4.0)); nt.setToolType(new EndMill(new DimensionProperty(8.0, Dimensions.Dim.MM))); mt.setMilltaskModel(new RoundStockModel(new SimpleStringProperty(""), DimensionProperty.DimMM(30.0), DimensionProperty.DimMM(20.0), DimensionProperty.DimMM(100.0))); p.millTasksProperty().add(mt); p = new Project("Facing 30mmx30mm", "Facing of wood. Feedrate 2400"); mt = new TaskRunnable("Make Round Form Square", "Make feed edge", "com.rvantwisk.cnctools.operations.createRoundStock.CreateRoundStockController", "CreateRoundStock.fxml"); nt = Factory.newTool(); nt.setName("10mm end Mill"); nt.radialDepthProperty().set(DimensionProperty.DimMM(5.0)); nt.axialDepthProperty().set(DimensionProperty.DimMM(5.0)); nt.setToolType(new EndMill(new DimensionProperty(10.0, Dimensions.Dim.MM))); mt.setMilltaskModel(new RoundStockModel(new SimpleStringProperty(""), DimensionProperty.DimMM(30.0), DimensionProperty.DimMM(20.0), DimensionProperty.DimMM(100.0))); p.millTasksProperty().add(mt); projectModel.addProject(p); }
From source file:acmi.l2.clientmod.l2smr.Controller.java
private void initializeUnr() { mapsDirProperty().addListener((observable, oldValue, newValue) -> { unrChooser.getSelectionModel().clearSelection(); unrChooser.getItems().clear();//from w ww. j a va 2 s . c o m unrChooser.setDisable(true); if (newValue == null) return; unrChooser.getItems().addAll(Arrays.stream(newValue.listFiles(MAP_FILE_FILTER)).map(File::getName) .collect(Collectors.toList())); unrChooser.setDisable(false); AutoCompleteComboBox.autoCompleteComboBox(unrChooser, AutoCompleteComboBox.AutoCompleteMode.CONTAINING); }); this.unrChooser.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { table.getSelectionModel().clearSelection(); filterPane.setDisable(true); actors.set(null); actorStaticMeshChooser.getItems().clear(); System.gc(); if (newValue == null) return; try (UnrealPackage up = new UnrealPackage(new File(getMapsDir(), newValue), true)) { longTask(progress -> { List<UnrealPackage.ImportEntry> staticMeshes = up.getImportTable().parallelStream() .filter(ie -> ie.getFullClassName().equalsIgnoreCase("Engine.StaticMesh")) .sorted((ie1, ie2) -> String.CASE_INSENSITIVE_ORDER .compare(ie1.getObjectInnerFullName(), ie2.getObjectInnerFullName())) .collect(Collectors.toList()); Platform.runLater(() -> { actorStaticMeshChooser.getItems().setAll(staticMeshes); AutoCompleteComboBox.autoCompleteComboBox(actorStaticMeshChooser, AutoCompleteComboBox.AutoCompleteMode.CONTAINING); }); List<Actor> actors = up .getExportTable().parallelStream().filter(e -> UnrealPackage.ObjectFlag .getFlags(e.getObjectFlags()).contains(UnrealPackage.ObjectFlag.HasStack)) .map(entry -> { try { return new Actor(entry.getIndex(), entry.getObjectInnerFullName(), entry.getObjectRawDataExternally(), up); } catch (Throwable e) { return null; } }).filter(Objects::nonNull) .filter(actor -> actor.getStaticMeshRef() != 0 && actor.getOffsets().location != 0) .collect(Collectors.toList()); Platform.runLater(() -> Controller.this.actors.set(FXCollections.observableArrayList(actors))); }, e -> onException("Import failed", e)); } catch (Exception e) { onException("Read failed", e); } resetFilter(); filterPane.setDisable(false); }); this.actorColumn.setCellValueFactory(actorStringCellDataFeatures -> new SimpleStringProperty( actorStringCellDataFeatures.getValue().getActorName())); this.staticMeshColumn.setCellValueFactory(actorStringCellDataFeatures -> new SimpleStringProperty( actorStringCellDataFeatures.getValue().getStaticMesh())); this.table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); this.table.getSelectionModel().selectedItemProperty().addListener((observable) -> updateSMAPane()); this.table.setOnMouseClicked(event -> { if (event.getButton() == MouseButton.PRIMARY && event.getClickCount() == 2) { String obj = table.getSelectionModel().getSelectedItem().getStaticMesh(); String file = obj.substring(0, obj.indexOf('.')) + ".usx"; showUmodel(obj, file); } }); }
From source file:com.adobe.ags.curly.controller.ActionRunner.java
private void applyVariablesToMap(Map<String, String> variables, Map<String, String> target) { Set<String> variableTokens = ActionUtils.getVariableNames(action); Set removeSet = new HashSet<>(); Map<String, String> newValues = new HashMap<>(); target.forEach((paramName, paramValue) -> { StringProperty paramNameProperty = new SimpleStringProperty(paramName); variableTokens.forEach((String originalName) -> { String[] variableNameParts = originalName.split("\\|"); String variableName = variableNameParts[0]; String variableNameMatchPattern = Pattern.quote("${" + originalName + "}"); String val = variables.get(variableName); if (val == null) { val = ""; }/*w w w. j a v a2 s .co m*/ String variableValue = Matcher.quoteReplacement(val); //---- String newParamValue = newValues.containsKey(paramNameProperty.get()) ? newValues.get(paramNameProperty.get()) : paramValue; String newParamName = paramNameProperty.get().replaceAll(variableNameMatchPattern, variableValue); paramNameProperty.set(newParamName); newParamValue = newParamValue.replaceAll(variableNameMatchPattern, variableValue); if (!newParamName.equals(paramName) || !newParamValue.equals(paramValue)) { removeSet.add(paramNameProperty.get()); removeSet.add(paramName); newValues.put(newParamName, newParamValue); } }); }); target.keySet().removeAll(removeSet); target.putAll(newValues); }
From source file:Main.java
private void bindLabelsToSliders() { xLabel.textProperty().bind(new SimpleStringProperty("x:").concat(xSlider.valueProperty().asString("%.2f"))); yLabel.textProperty().bind(new SimpleStringProperty("y:").concat(ySlider.valueProperty().asString("%.2f"))); widthLabel.textProperty()//from w ww. jav a2s. co m .bind(new SimpleStringProperty("width:").concat(widthSlider.valueProperty().asString("%.2f"))); heightLabel.textProperty() .bind(new SimpleStringProperty("height:").concat(heightSlider.valueProperty().asString("%.2f"))); opacityLabel.textProperty() .bind(new SimpleStringProperty("opacity:").concat(opacitySlider.valueProperty().asString("%.2f"))); strokeLabel.textProperty() .bind(new SimpleStringProperty("stroke:").concat(strokeSlider.valueProperty().asString("%.2f"))); translateXLabel.textProperty().bind( new SimpleStringProperty("TranslateX:").concat(translateXSlider.valueProperty().asString("%.2f"))); translateYLabel.textProperty().bind( new SimpleStringProperty("TranslateY:").concat(translateYSlider.valueProperty().asString("%.2f"))); rotateLabel.textProperty().bind(new SimpleStringProperty("Rotate:") .concat(rotateSlider.valueProperty().asString("%.2f")).concat(" deg")); scaleXLabel.textProperty() .bind(new SimpleStringProperty("ScaleX:").concat(scaleXSlider.valueProperty().asString("%.2f"))); scaleYLabel.textProperty() .bind(new SimpleStringProperty("ScaleY:").concat(scaleYSlider.valueProperty().asString("%.2f"))); shearXLabel.textProperty() .bind(new SimpleStringProperty("ShearX:").concat(shearXSlider.valueProperty().asString("%.2f"))); shearYLabel.textProperty() .bind(new SimpleStringProperty("ShearY:").concat(shearYSlider.valueProperty().asString("%.2f"))); }
From source file:com.adobe.ags.curly.controller.ActionRunner.java
private void applyMultiVariablesToMap(Map<String, String> variables, Map<String, List<String>> target) { Set<String> variableTokens = ActionUtils.getVariableNames(action); Map<String, List<String>> newValues = new HashMap<>(); Set removeSet = new HashSet<>(); target.forEach((paramName, paramValues) -> { StringProperty paramNameProperty = new SimpleStringProperty(paramName); variableTokens.forEach((String originalName) -> { String[] variableNameParts = originalName.split("\\|"); String variableName = variableNameParts[0]; String variableNameMatchPattern = Pattern.quote("${" + originalName + "}"); String val = variables.get(variableName); if (val == null) { val = ""; }// ww w . j a v a 2s . co m String variableValue = Matcher.quoteReplacement(val); String newParamName = paramNameProperty.get().replaceAll(variableNameMatchPattern, variableValue); removeSet.add(paramNameProperty.get()); removeSet.add(paramName); if (newValues.get(paramNameProperty.get()) == null) { newValues.put(paramNameProperty.get(), new ArrayList<>(paramValues.size())); } if (newValues.get(newParamName) == null) { newValues.put(newParamName, new ArrayList<>(paramValues.size())); } List<String> newParamValues = newValues.get(paramNameProperty.get()); for (int i = 0; i < paramValues.size(); i++) { String newParamValue = newParamValues != null && newParamValues.size() > i && newParamValues.get(i) != null ? newParamValues.get(i) : paramValues.get(i); // fix for removing JCR values (setting them to an empty // string deletes them from the JCR) if (null == newParamValue) { newParamValue = ""; } newParamValue = newParamValue.replaceAll(variableNameMatchPattern, variableValue); if (newParamName.contains("/") && newParamValue.equals("@" + newParamName)) { // The upload name should actually be the file name, not the full path of the file. removeSet.add(newParamName); newValues.remove(newParamName); newParamName = newParamName.substring(newParamName.lastIndexOf("/") + 1); newValues.put(newParamName, newParamValues); } if (newValues.get(newParamName).size() == i) { newValues.get(newParamName).add(newParamValue); } else { newValues.get(newParamName).set(i, newParamValue); } } if (!paramNameProperty.get().equals(newParamName)) { newValues.remove(paramNameProperty.get()); } paramNameProperty.set(newParamName); }); }); target.keySet().removeAll(removeSet); target.putAll(newValues); }