Example usage for javafx.beans.property ReadOnlyStringWrapper ReadOnlyStringWrapper

List of usage examples for javafx.beans.property ReadOnlyStringWrapper ReadOnlyStringWrapper

Introduction

In this page you can find the example usage for javafx.beans.property ReadOnlyStringWrapper ReadOnlyStringWrapper.

Prototype

public ReadOnlyStringWrapper(String initialValue) 

Source Link

Document

The constructor of ReadOnlyStringWrapper

Usage

From source file:Main.java

@Override
public void start(Stage stage) {
    final Scene scene = new Scene(new Group(), 200, 400);
    Group sceneRoot = (Group) scene.getRoot();

    TreeItem<String> childNode1 = new TreeItem<>("Node 1");
    TreeItem<String> childNode2 = new TreeItem<>("Node 2");
    TreeItem<String> childNode3 = new TreeItem<>("Node 3");

    TreeItem<String> root = new TreeItem<>("Root");
    root.setExpanded(true);//from www.j a v a 2 s  .c  o  m

    root.getChildren().setAll(childNode1, childNode2, childNode3);

    TreeTableColumn<String, String> column = new TreeTableColumn<>("Column");
    column.setPrefWidth(150);

    column.setCellValueFactory(
            (CellDataFeatures<String, String> p) -> new ReadOnlyStringWrapper(p.getValue().getValue()));

    TreeTableView<String> treeTableView = new TreeTableView<>(root);
    treeTableView.getColumns().add(column);
    sceneRoot.getChildren().add(treeTableView);
    stage.setScene(scene);
    stage.show();
}

From source file:com.adobe.ags.curly.test.ConnectionManagerTest.java

@Test
public void getAuthenticatedConnection() throws IOException {
    webserver.requireLogin = true;//from   w  ww .jav a  2 s.  co  m
    AuthHandler handler = new AuthHandler(new ReadOnlyStringWrapper("localhost:" + webserver.port),
            new ReadOnlyBooleanWrapper(false), new ReadOnlyStringWrapper(TEST_USER),
            new ReadOnlyStringWrapper(TEST_PASSWORD));
    CloseableHttpClient client = handler.getAuthenticatedClient();
    assertNotNull(client);
    HttpUriRequest request = new HttpGet("http://localhost:" + webserver.port + "/testUri");
    client.execute(request);
    Header authHeader = webserver.lastRequest.getFirstHeader("Authorization");
    assertNotNull(authHeader);
    String compareToken = "Basic "
            + Base64.getEncoder().encodeToString((TEST_USER + ":" + TEST_PASSWORD).getBytes());
    assertEquals("Auth token should be expected format", authHeader.getValue(), compareToken);
}

From source file:com.adobe.ags.curly.controller.BatchRunner.java

public BatchRunner(AuthHandler auth, int concurrency, List<Action> actions, List<Map<String, String>> batchData,
        Map<String, StringProperty> defaultValues, Set<String> displayColumns) {
    clientThread = ThreadLocal.withInitial(auth::getAuthenticatedClient);
    result = new BatchRunnerResult();
    tasks = new ArrayBlockingQueue<>(batchData.size());
    this.concurrency = concurrency;
    defaultValues.put("server", new ReadOnlyStringWrapper(auth.getUrlBase()));
    buildWorkerPool = () -> buildTasks(actions, batchData, defaultValues, displayColumns);
}

From source file:com.adobe.ags.curly.test.ErrorBehaviorTest.java

@Before
public void setUp() {
    ApplicationState.getInstance().runningProperty().set(true);
    handler = new AuthHandler(new ReadOnlyStringWrapper("localhost:" + webserver.port),
            new ReadOnlyBooleanWrapper(false), new ReadOnlyStringWrapper(TEST_USER),
            new ReadOnlyStringWrapper(TEST_PASSWORD));
    client = handler.getAuthenticatedClient();
}

From source file:com.bdb.weather.display.summary.RainSummary.java

@SuppressWarnings("LeakingThisInConstructor")
public RainSummary(SummaryInterval interval, SummarySupporter supporter) {
    this.setPrefSize(500, 300);
    this.interval = interval;
    this.supporter = supporter;
    dataTable = new TableView();
    Node component = createChartElements();

    TableColumn<SummaryRecord, String> col = new TableColumn<>("Date");
    col.setCellValueFactory(/*w  ww. j av  a 2 s.  c o m*/
            (rec) -> new ReadOnlyStringWrapper(DisplayConstants.formatDate(rec.getValue().getDate())));
    dataTable.getColumns().add(col);

    TableColumn<SummaryRecord, Depth> rainfallColumn = new TableColumn<>("Rainfall");
    rainfallColumn.setCellValueFactory((rec) -> new ReadOnlyObjectWrapper(rec.getValue().getTotalRainfall()));
    dataTable.getColumns().add(rainfallColumn);

    TableColumn<SummaryRecord, Depth> etColumn = new TableColumn<>("ET");
    etColumn.setCellValueFactory((rec) -> new ReadOnlyObjectWrapper(rec.getValue().getTotalET()));
    dataTable.getColumns().add(etColumn);

    this.setTabContents(component, dataTable);
}

From source file:Main.java

@Override
public void start(Stage stage) {
    root.setExpanded(true);/*from  w w w  . jav a 2s.c  o m*/
    employees.stream().forEach((employee) -> {
        root.getChildren().add(new TreeItem<>(employee));
    });
    Scene scene = new Scene(new Group(), 400, 400);
    Group sceneRoot = (Group) scene.getRoot();

    TreeTableColumn<Employee, String> empColumn = new TreeTableColumn<>("Employee");
    empColumn.setPrefWidth(150);
    empColumn.setCellValueFactory(
            (TreeTableColumn.CellDataFeatures<Employee, String> param) -> new ReadOnlyStringWrapper(
                    param.getValue().getValue().getName()));

    TreeTableColumn<Employee, String> emailColumn = new TreeTableColumn<>("Email");
    emailColumn.setPrefWidth(190);
    emailColumn.setCellValueFactory(
            (TreeTableColumn.CellDataFeatures<Employee, String> param) -> new ReadOnlyStringWrapper(
                    param.getValue().getValue().getEmail()));

    TreeTableView<Employee> treeTableView = new TreeTableView<>(root);
    treeTableView.getColumns().setAll(empColumn, emailColumn);

    treeTableView.setTableMenuButtonVisible(true);

    sceneRoot.getChildren().add(treeTableView);
    stage.setScene(scene);
    stage.show();
}

From source file:com.bdb.weather.display.windrose.WindRosePane.java

/**
 * Constructor.//w  w w  . jav a2  s .  c  o m
 */
public WindRosePane() {
    this.setPrefSize(300, 300);
    ChartFactory.getChartTheme().apply(chart);
    chartViewer.setMinHeight(10);
    chartViewer.setMinWidth(10);
    chartViewer.setPrefSize(300, 300);

    dataTable = new TableView();

    FlowPane summaryPanel = new FlowPane();

    summaryPanel.getChildren().add(new LabeledFieldPane<>("Date:", timeField));
    timeField.setEditable(false);
    summaryPanel.getChildren().add(new LabeledFieldPane<>("% Winds are calm:", calmField));
    calmField.setEditable(false);

    summaryPanel.getChildren().add(new Label("Speeds are in " + Speed.getDefaultUnit()));

    BorderPane p = new BorderPane();

    p.setCenter(dataTable);
    p.setTop(summaryPanel);
    this.setTabContents(chartViewer, p);

    TableColumn<WindSlice, String> headingColumn = new TableColumn<>("Heading");
    headingColumn.setCellValueFactory((rec) -> new ReadOnlyStringWrapper(
            Heading.headingForSlice(rec.getValue().getHeadingIndex(), 16).getCompassLabel()));
    dataTable.getColumns().add(headingColumn);

    TableColumn<WindSlice, String> percentOfWindColumn = new TableColumn<>("% of Wind");
    percentOfWindColumn.setCellValueFactory(
            (rec) -> new ReadOnlyStringWrapper(String.format("%.1f", rec.getValue().getPercentageOfWind())));
    dataTable.getColumns().add(percentOfWindColumn);

    TableColumn<WindSlice, Speed> avgSpeedColumn = new TableColumn<>("Avg Speed");
    avgSpeedColumn.setCellValueFactory((rec) -> new ReadOnlyObjectWrapper<>(rec.getValue().getAvgSpeed()));
    dataTable.getColumns().add(avgSpeedColumn);

    TableColumn<WindSlice, Speed> maxSpeedColumn = new TableColumn<>("Max Speed");
    maxSpeedColumn.setCellValueFactory((rec) -> new ReadOnlyObjectWrapper<>(rec.getValue().getMaxSpeed()));
    dataTable.getColumns().add(maxSpeedColumn);

}

From source file:analyzer.code.FXMLAnalyzerController.java

@FXML
private void calculateMetricButtonAction(ActionEvent event) {
    List<String> nameFiles = nameFile;
    ArrayList<List<String>> metrs;
    if (curLang == C) {
        analyzer.setMetricSettings(metricSettings.get(curLang));
    }/*from  ww w .ja va2s  .com*/
    //??  ?  
    for (String src : source) {
        analyzer.solutMetrics(src);
    }

    //   
    metrs = analyzer.getResult();

    //?       ??
    nameFile.add(" ");

    // 
    tableMetric.refresh();
    tableMetric.getItems().clear();
    tableMetric.getColumns().clear();
    tableDescript.refresh();
    tableDescript.getItems().clear();
    tableDescript.getColumns().clear();

    //? ?  
    for (int i = 0; i < source.size() + 1; i++) {
        tableMetric.getItems().add(i);
        tableDescript.getItems().add(i);
    }

    //? ? ?  
    TableColumn<Integer, String> nameFl = new TableColumn<>("Name File");
    nameFl.setCellValueFactory(cellData -> {
        Integer rowIndex = cellData.getValue();
        return new ReadOnlyStringWrapper(nameFiles.get(rowIndex));
    });
    tableMetric.getColumns().add(nameFl); //? ?  

    //  ? ? 
    EnumNameMetricC[] enumName = EnumNameMetricC.values();
    for (int i = 0; i < metrs.size(); i++) {
        List<String> list = metrs.get(i);
        TableColumn<Integer, String> nameColumn = new TableColumn<>(enumName[i].getName());
        nameColumn.setCellValueFactory(cellData -> {
            Integer rowIndex = cellData.getValue();
            return new ReadOnlyStringWrapper(list.get(rowIndex));
        });
        tableMetric.getColumns().add(nameColumn);
    }

    if (curLang == C) {
        tableDescript.getColumns().add(nameFl);

        TableColumn<Integer, String> columnDesc = new TableColumn<>("Count Operators");
        columnDesc.setCellValueFactory(cellData -> {
            Integer rowIndex = cellData.getValue();
            return new ReadOnlyStringWrapper(CountOperators.getMark(metricSettings.get(curLang).get(0).getMin(),
                    metricSettings.get(curLang).get(0).getMax(), Double.valueOf(metrs.get(0).get(rowIndex))));
        });
        tableDescript.getColumns().add(columnDesc);

        TableColumn<Integer, String> columnDesc1 = new TableColumn<>("Level Nest");
        columnDesc1.setCellValueFactory(cellData -> {
            Integer rowIndex = cellData.getValue();
            return new ReadOnlyStringWrapper(LevelNesting.getMark(metricSettings.get(curLang).get(1).getMin(),
                    metricSettings.get(curLang).get(1).getMax(), Double.valueOf(metrs.get(1).get(rowIndex))));
        });
        tableDescript.getColumns().add(columnDesc1);

        TableColumn<Integer, String> columnDesc2 = new TableColumn<>("Middle Len Ident");
        columnDesc2.setCellValueFactory(cellData -> {
            Integer rowIndex = cellData.getValue();
            return new ReadOnlyStringWrapper(MiddleLenIdent.getMark(metricSettings.get(curLang).get(2).getMin(),
                    metricSettings.get(curLang).get(2).getMax(), Double.valueOf(metrs.get(2).get(rowIndex))));
        });
        tableDescript.getColumns().add(columnDesc2);

        double mark = analyzer.getMark();
        labelMark.setText(": " + String.format(Locale.US, "%.2f", mark) + "  5");
        labelMark.setVisible(true);
    }
}

From source file:com.ggvaidya.scinames.summary.HigherStabilityView.java

private TableColumn<String, String> createTableColumn(String colName, Function<String, String> func) {
    TableColumn<String, String> tableColumn = new TableColumn<>(colName);
    tableColumn.setCellValueFactory(features -> new ReadOnlyStringWrapper(func.apply(features.getValue())));

    tableColumn.setPrefWidth(100.0);/*from   w w  w .ja  v a  2  s.  c  o  m*/

    return tableColumn;
}

From source file:com.ggvaidya.scinames.summary.NameStabilityView.java

private TableColumn<Dataset, String> createTableColumn(String colName, Function<Dataset, String> func) {
    TableColumn<Dataset, String> tableColumn = new TableColumn<>(colName);
    tableColumn.setCellValueFactory(features -> new ReadOnlyStringWrapper(func.apply(features.getValue())));

    tableColumn.setPrefWidth(100.0);/*  ww  w  .java  2  s  .c  o m*/

    return tableColumn;
}