java类javafx.beans.property.ReadOnlyStringWrapper的实例源码

SourceTreeTable.java 文件源码 项目:shuffleboard 阅读 36 收藏 0 点赞 0 评论 0
/**
 * Creates a new source tree table. It comes pre-populated with a key and a value column.
 */
public SourceTreeTable() {
  keyColumn.prefWidthProperty().bind(widthProperty().divide(2).subtract(2));
  valueColumn.prefWidthProperty().bind(widthProperty().divide(2).subtract(2));

  keyColumn.setCellValueFactory(
      f -> new ReadOnlyStringWrapper(getEntryForCellData(f).getViewName()));
  valueColumn.setCellValueFactory(
      f -> new ReadOnlyObjectWrapper(getEntryForCellData(f).getValueView()));
  Label placeholder = new Label();
  placeholder.textProperty().bind(EasyBind.monadic(sourceType)
      .map(SourceType::getName)
      .map(n -> "No data available. Is there a connection to " + n + "?")
      .orElse("No data available. Is the source connected?"));
  setPlaceholder(placeholder);

  getColumns().addAll(keyColumn, valueColumn);
}
ItemSelectorController.java 文件源码 项目:osrs-equipment-builder 阅读 42 收藏 0 点赞 0 评论 0
@FXML
private void initialize() {

    nameColumn.setCellValueFactory(cd -> cd.getValue().nameProperty());
    slotColumn.setCellValueFactory(cd ->
        new ReadOnlyStringWrapper(cd.getValue().slotProperty().get().toString()));

    astabColumn.setCellValueFactory(cd -> cd.getValue().statsProperty(ArmorStats.ASTAB).asObject());
    aslashColumn.setCellValueFactory(cd -> cd.getValue().statsProperty(ArmorStats.ASLASH).asObject());
    acrushColumn.setCellValueFactory(cd -> cd.getValue().statsProperty(ArmorStats.ACRUSH).asObject());
    arangeColumn.setCellValueFactory(cd -> cd.getValue().statsProperty(ArmorStats.ARANGE).asObject());
    amagicColumn.setCellValueFactory(cd -> cd.getValue().statsProperty(ArmorStats.AMAGIC).asObject());

    dstabColumn.setCellValueFactory(cd -> cd.getValue().statsProperty(ArmorStats.DSTAB).asObject());
    dslashColumn.setCellValueFactory(cd -> cd.getValue().statsProperty(ArmorStats.DSLASH).asObject());
    dcrushColumn.setCellValueFactory(cd -> cd.getValue().statsProperty(ArmorStats.DCRUSH).asObject());
    drangeColumn.setCellValueFactory(cd -> cd.getValue().statsProperty(ArmorStats.DRANGE).asObject());
    dmagicColumn.setCellValueFactory(cd -> cd.getValue().statsProperty(ArmorStats.DMAGIC).asObject());

    strColumn.setCellValueFactory(cd -> cd.getValue().statsProperty(ArmorStats.STR).asObject());
    rstrColumn.setCellValueFactory(cd -> cd.getValue().statsProperty(ArmorStats.RSTR).asObject());
    mdmgColumn.setCellValueFactory(cd -> cd.getValue().statsProperty(ArmorStats.MDMG).asObject());
    prayColumn.setCellValueFactory(cd -> cd.getValue().statsProperty(ArmorStats.PRAYER).asObject());


}
Columnizer.java 文件源码 项目:fx-log 阅读 34 收藏 0 点赞 0 评论 0
/**
 * Returns the columns associated to this columnizer. They can directly be added to a {@link TableView}.
 * <p>
 * The visibility and width of the returned columns are bound to the column definitions of this Columnizer, so that
 * they are stored in the config.
 *
 * @return the columns associated to this columnizer
 */
@NotNull
public List<TableColumn<LogEntry, String>> getColumns() {
    List<TableColumn<LogEntry, String>> columns = new ArrayList<>();
    for (ColumnDefinition columnDefinition : columnDefinitions) {
        TableColumn<LogEntry, String> col = new TableColumn<>();
        // we need to keep the original text to avoid breaking the table visibility menu
        col.textProperty().bind(columnDefinition.headerLabelProperty());
        col.setGraphic(columnDefinition.createBoundHeaderLabel());
        col.setVisible(columnDefinition.isVisible());
        col.setPrefWidth(columnDefinition.getWidth());
        columnDefinition.visibleProperty().bindBidirectional(col.visibleProperty());
        columnDefinition.widthProperty().bind(col.widthProperty());
        col.setCellValueFactory(data -> {
            LogEntry log = data.getValue();
            String cellValue = log.getColumnValues().get(columnDefinition.getCapturingGroupName());
            return new ReadOnlyStringWrapper(cellValue);
        });
        columns.add(col);
    }
    return columns;
}
MasterView.java 文件源码 项目:dolphin-platform-master-detail-example 阅读 36 收藏 0 点赞 0 评论 0
public MasterView(ClientContext clientContext) {
    super(clientContext, Constants.MASTER_CONTROLLER_NAME);
    listView = new ListView<>();
    listView.setCellFactory(c -> new StockItemListCell());
    rootNode = new StackPane(listView);

    selectedStockIdent = new ReadOnlyStringWrapper();
    listView.getSelectionModel().selectedItemProperty().addListener((obs, oldVal, newVal) -> {
        if (newVal == null) {
            selectedStockIdent.set(null);
            getModel().setSelectedStockIdent(null);
        } else {
            selectedStockIdent.set(newVal.getStockIdent());
            getModel().setSelectedStockIdent(newVal.getStockIdent());
        }
    });
}
WidgetInfoDialog.java 文件源码 项目:org.csstudio.display.builder 阅读 32 收藏 0 点赞 0 评论 0
private Tab createMacros(Macros orig_macros)
{
    final Macros macros = (orig_macros == null) ? new Macros() : orig_macros;
    // Use text field to allow copying the name and value
    // Table uses list of macro names as input
    // Name column just displays the macro name,..
    final TableColumn<String, String> name = new TableColumn<>(Messages.WidgetInfoDialog_Name);
    name.setCellFactory(TextFieldTableCell.forTableColumn());
    name.setCellValueFactory(param -> new ReadOnlyStringWrapper(param.getValue()));

    // .. value column fetches the macro value
    final TableColumn<String, String> value = new TableColumn<>(Messages.WidgetInfoDialog_Value);
    value.setCellFactory(TextFieldTableCell.forTableColumn());
    value.setCellValueFactory(param -> new ReadOnlyStringWrapper(macros.getValue(param.getValue())));

    final TableView<String> table =
        new TableView<>(FXCollections.observableArrayList(macros.getNames()));
    table.getColumns().add(name);
    table.getColumns().add(value);
    table.setEditable(true);
    table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);

    return new Tab(Messages.WidgetInfoDialog_TabMacros, table);
}
ConnectionManagerTest.java 文件源码 项目:curly 阅读 33 收藏 0 点赞 0 评论 0
@Test
public void getAuthenticatedConnection() throws IOException {
    webserver.requireLogin = true;
    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);
}
ArchiveContentTableView.java 文件源码 项目:daris 阅读 33 收藏 0 点赞 0 评论 0
@Override
protected void addTableColumns(TableView<ArchiveEntry> table) {
    TableColumn<ArchiveEntry, String> ordinalColumn = new TableColumn<ArchiveEntry, String>(
            "Ordinal");
    ordinalColumn.setCellValueFactory(cellData -> {
        return new ReadOnlyStringWrapper(
                Integer.toString(cellData.getValue().ordinal()));
    });
    table.getColumns().add(ordinalColumn);
    TableColumn<ArchiveEntry, String> sizeColumn = new TableColumn<ArchiveEntry, String>(
            "Size(Bytes)");
    sizeColumn.setCellValueFactory(cellData -> {
        long size = cellData.getValue().size();
        return new ReadOnlyStringWrapper(
                size < 0 ? null : Long.toString(size));
    });
    table.getColumns().add(sizeColumn);
    TableColumn<ArchiveEntry, String> nameColumn = new TableColumn<ArchiveEntry, String>(
            "Name");
    nameColumn.setCellValueFactory(cellData -> {
        return new ReadOnlyStringWrapper(cellData.getValue().name());
    });
    table.getColumns().add(nameColumn);
}
InstrumentationController.java 文件源码 项目:Planchester 阅读 40 收藏 0 点赞 0 评论 0
public void getAllMusicalWorks() {
    tableAvailableMusicalWorks.setCellValueFactory(param -> new ReadOnlyStringWrapper(param.getValue()));
    tableSelectedMusicalWorks.setCellValueFactory(param -> new ReadOnlyStringWrapper(param.getValue()));

    List<MusicalWorkDTO> musicalWorks = MusicalWorkAdministratonManager.getAllMusicalWorks();

    for(MusicalWorkDTO mwDTO : musicalWorks) {
        tableAvailable.getItems().add(mwDTO.getName());
    }

    this.musicalWorks = musicalWorks;
}
CreateController.java 文件源码 项目:Planchester 阅读 33 收藏 0 点赞 0 评论 0
@FXML
public void initialize() {
    initializeMandatoryFields();

    selectedMusicalWorks.setCellValueFactory(param -> new ReadOnlyStringWrapper(param.getValue()));

    points.textProperty().addListener((observable, oldValue, newValue) -> {
        if (!newValue.matches("\\d*[\\,.]?\\d*?")) {
            points.setText(newValue.replaceAll("[^\\d*[\\,.]?\\d*?]", ""));
        }
    });
}
MainWindowController.java 文件源码 项目:VennDraw 阅读 30 收藏 0 点赞 0 评论 0
@Override
public void initialize(URL location, ResourceBundle resources) {
    menuBar.setUseSystemMenuBar(true);

    if (System.getProperty("os.name").toLowerCase().contains("mac")) {
        quitMenu.setVisible(false);
    }

    tableCombinationColumn.setCellValueFactory(param -> new ReadOnlyStringWrapper(String.join(", ", param.getValue().getKey())));
    tableNumberOfItems.setCellValueFactory(param -> new ReadOnlyObjectWrapper<>(param.getValue().getValue().size()));
    tableItems.setCellValueFactory(param -> new ReadOnlyStringWrapper(String.join(", ", param.getValue().getValue())));

    ContextMenu tableContextMenu = new ContextMenu();
    MenuItem copyMenuItem = new MenuItem("Copy items");
    copyMenuItem.setOnAction(event -> {
        String text = combinationTable.getSelectionModel().getSelectedItems().stream().flatMap(it -> it.getValue().stream()).collect(Collectors.joining("\n"));
        ClipboardContent content = new ClipboardContent();
        content.putString(text);
        Clipboard.getSystemClipboard().setContent(content);
    });
    tableContextMenu.getItems().add(copyMenuItem);
    combinationTable.setContextMenu(tableContextMenu);


    splitter.getDividers().get(0).positionProperty().addListener((observable, oldValue, newValue) -> {
        refreshVennFigure();
    });
    splitter2.getDividers().get(0).positionProperty().addListener((observable, oldValue, newValue) -> {
        refreshVennFigure();
    });
    splitter2.boundsInLocalProperty().addListener((observable, oldValue, newValue) -> {
        refreshVennFigure();
    });

    addGroup().setElements(Arrays.asList("A", "B", "C"));
    addGroup().setElements(Arrays.asList("B", "C", "D"));
    groupViewControllerList.get(0).getTitledPane().setExpanded(true);
    modified = false;
}
MessageDisplay.java 文件源码 项目:xltsearch 阅读 39 收藏 0 点赞 0 评论 0
@FXML
private void initialize() {
    // replaces CONSTRAINED_RESIZE_POLICY
    summaryCol.prefWidthProperty().bind(
        table.widthProperty()
        .subtract(timeCol.widthProperty())
        .subtract(levelCol.widthProperty())
        .subtract(fromCol.widthProperty())
    );

    table.itemsProperty().bind(MessageLogger.messagesProperty());

    final DateFormat df = DateFormat.getTimeInstance();
    timeCol.setCellValueFactory((r) ->
        new ReadOnlyStringWrapper(df.format(new Date(r.getValue().timestamp))));
    levelCol.setCellValueFactory((r) ->
        new ReadOnlyStringWrapper(r.getValue().level.toString()));
    fromCol.setCellValueFactory((r) ->
        new ReadOnlyStringWrapper(r.getValue().from));
    summaryCol.setCellValueFactory((r) ->
        new ReadOnlyStringWrapper(r.getValue().summary));

    table.getSelectionModel().selectedItemProperty().addListener((o, oldValue, newValue) -> {
        if (newValue != null) {
            detailsField.setText(newValue.summary + '\n' + newValue.details);
        } else {
            detailsField.setText("");
        }
    });

    logLevel.getItems().setAll(Message.Level.values());
    logLevel.getSelectionModel().select(MessageLogger.logLevelProperty().get());
    logLevel.getSelectionModel().selectedItemProperty().addListener(
        (o, oldValue, newValue) -> MessageLogger.logLevelProperty().set(newValue));
}
ToDoListController.java 文件源码 项目:ProgrammingExam 阅读 30 收藏 0 点赞 0 评论 0
private void loadToDoLists() {
    toDoList = FXCollections.observableArrayList();
    toDoList.addAll(toDoDAO.getToDoList());

    toDoTitel.setCellValueFactory(cellData -> new ReadOnlyStringWrapper(((String) cellData.getValue().getTitle())));
    toDoCategory.setCellValueFactory(cellData -> new ReadOnlyStringWrapper(((String) cellData.getValue().getCategory())));
    toDoDescription.setCellValueFactory(cellData -> new ReadOnlyStringWrapper(((String) cellData.getValue().getDescription())));
    toDoDateCreated.setCellValueFactory(cellData -> new ReadOnlyStringWrapper(new SimpleDateFormat("yyyy-MM-dd").format(cellData.getValue().getDateCreated())));

    // toDoTable.setItems(null);
    toDoTable.setItems(toDoList);

}
ObservableEntity.java 文件源码 项目:clarity-analyzer 阅读 45 收藏 0 点赞 0 评论 0
public ObservableEntity(Entity entity) {
    this.entity = entity;
    index = new ReadOnlyStringWrapper(String.valueOf(entity.getIndex()));
    name = new ReadOnlyStringWrapper(entity.getDtClass().getDtName());
    List<FieldPath> fieldPaths = entity.getDtClass().collectFieldPaths(entity.getState());
    for (FieldPath fieldPath : fieldPaths) {
        indices.add(fieldPath);
        properties.add(new ObservableEntityProperty(entity, fieldPath));
    }
}
StartWindowView.java 文件源码 项目:Cachoeira 阅读 34 收藏 0 点赞 0 评论 0
private Node createTable() {
    recentProjectsTable.setPrefWidth(TABLE_WIDTH);
    TableColumn<File, String> recentProjectsPathColumn = new TableColumn<>("Recent Projects");
    recentProjectsPathColumn.setCellValueFactory(cellData -> new ReadOnlyStringWrapper(cellData.getValue().getPath()));
    recentProjectsTable.getColumns().add(recentProjectsPathColumn);
    recentProjectsTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    return recentProjectsTable;
}
LanguageSelection.java 文件源码 项目:bco.bcozy 阅读 42 收藏 0 点赞 0 评论 0
/**
 * Returns an Observable Property which contains the localized string for the given identifier.
 *
 * @param identifier the identifier
 * @return a property with the localized string
 */
public static ReadOnlyStringProperty getProperty(final String identifier) {
    ReadOnlyStringWrapper localizedProperty = new ReadOnlyStringWrapper();

    addObserverFor(identifier, (locale, text) -> localizedProperty.set(text));

    return localizedProperty.getReadOnlyProperty();
}
WidgetInfoDialog.java 文件源码 项目:org.csstudio.display.builder 阅读 27 收藏 0 点赞 0 评论 0
private Tab createProperties(final Widget widget)
 {
     // Use text field to allow copying the name (for use in scripts)
     // and value, but not the localized description and category
     // which are just for information
     final TableColumn<WidgetProperty<?>, String> cat = new TableColumn<>(Messages.WidgetInfoDialog_Category);
     cat.setCellValueFactory(param -> new ReadOnlyStringWrapper(param.getValue().getCategory().getDescription()));

     final TableColumn<WidgetProperty<?>, String> descr = new TableColumn<>(Messages.WidgetInfoDialog_Property);
     descr.setCellValueFactory(param -> new ReadOnlyStringWrapper(param.getValue().getDescription()));

     final TableColumn<WidgetProperty<?>, String> name = new TableColumn<>(Messages.WidgetInfoDialog_Name);
     name.setCellFactory(TextFieldTableCell.forTableColumn());
     name.setCellValueFactory(param -> new ReadOnlyStringWrapper(param.getValue().getName()));

     final TableColumn<WidgetProperty<?>, String> value = new TableColumn<>(Messages.WidgetInfoDialog_Value);
     value.setCellFactory(TextFieldTableCell.forTableColumn());
     value.setCellValueFactory(param -> new ReadOnlyStringWrapper(Objects.toString(param.getValue().getValue())));

     final TableView<WidgetProperty<?>> table =
         new TableView<>(FXCollections.observableArrayList(widget.getProperties()));
     table.getColumns().add(cat);
     table.getColumns().add(descr);
     table.getColumns().add(name);
     table.getColumns().add(value);
     table.setEditable(true);
     table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);

     return new Tab(Messages.WidgetInfoDialog_TabProperties, table);
}
BatchRunner.java 文件源码 项目:curly 阅读 29 收藏 0 点赞 0 评论 0
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);
}
BatchRunnerResult.java 文件源码 项目:curly 阅读 38 收藏 0 点赞 0 评论 0
public BatchRunnerResult() {
    reportRow().add(new ReadOnlyStringWrapper("Batch run"));

    StringBinding successOrNot = Bindings.when(completelySuccessful())
            .then(ApplicationState.getMessage(COMPLETED_SUCCESSFUL))
            .otherwise(ApplicationState.getMessage(COMPLETED_UNSUCCESSFUL));
    reportRow().add(Bindings.when(completed())
            .then(successOrNot).otherwise(ApplicationState.getMessage(INCOMPLETE)));

    reportRow().add(Bindings.createStringBinding(()->
            String.format("%.0f%%",100.0*percentComplete().get()),percentComplete()));
    reportRow().add(getDuration());
}
ActionGroupRunnerResult.java 文件源码 项目:curly 阅读 33 收藏 0 点赞 0 评论 0
private void buildRow(Map<String, String> variables, Set<String> reportColumns) {
    StringBinding successOrNot = Bindings.when(completelySuccessful())
            .then(ApplicationState.getMessage(COMPLETED_SUCCESSFUL))
            .otherwise(ApplicationState.getMessage(COMPLETED_UNSUCCESSFUL));
    reportRow().add(new ReadOnlyStringWrapper(task));
    reportRow().add(Bindings.when(Bindings.greaterThanOrEqual(percentComplete(), 1))
            .then(successOrNot)
            .otherwise(ApplicationState.getMessage(INCOMPLETE)));
    reportRow().add(Bindings.createStringBinding(()->
            String.format("%.0f%%",100.0*percentComplete().get()),percentComplete()));
    reportRow().add(getDuration());
    reportColumns.forEach((colName) -> reportRow().add(new SimpleStringProperty(variables.get(colName))));
}
ErrorBehaviorTest.java 文件源码 项目:curly 阅读 37 收藏 0 点赞 0 评论 0
@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();
}
Form.java 文件源码 项目:daris 阅读 47 收藏 0 点赞 0 评论 0
public void render() {
    if (_ttv == null) {
        _ttv = new TreeTableView<FormItem<?>>(
                new FormTreeItem(this, null, _rootItem));
        _ttv.getRoot().setExpanded(true);
        _ttv.setShowRoot(false);

        TreeTableColumn<FormItem<?>, String> nameColumn = new TreeTableColumn<FormItem<?>, String>(
                "Name");
        nameColumn.setPrefWidth(250);
        nameColumn.setCellValueFactory(param -> {
            String displayName = param.getValue().getValue().displayName();
            return new ReadOnlyStringWrapper(displayName);
        });
        nameColumn.setStyle("-fx-font-weight: bold;");

        TreeTableColumn<FormItem<?>, FormItem<?>> valueColumn = new TreeTableColumn<FormItem<?>, FormItem<?>>(
                "Value");
        valueColumn.setPrefWidth(500);
        valueColumn.setCellValueFactory(param -> {
            return param.getValue().valueProperty();
        });
        valueColumn.setCellFactory(column -> {
            return new FormTreeTableCell();
        });
        _ttv.getColumns().add(nameColumn);
        _ttv.getColumns().add(valueColumn);
        _stackPane.getChildren().setAll(_ttv);

        FormTreeItem rootTreeItem = (FormTreeItem) _ttv.getRoot();
        ObservableList<FormItem<?>> items = _rootItem.getItems();
        if (items != null) {
            for (FormItem<?> item : items) {
                addTreeItem(rootTreeItem, item);
            }
        }
    }
}
CreateRoundMatchesPage.java 文件源码 项目:tournament 阅读 35 收藏 0 点赞 0 评论 0
@FXML
private void initialize() {
    matchHomeTeamColumn.setCellValueFactory(cellData -> new ReadOnlyStringWrapper(
            PlayerUtil.formatPlayerList(cellData.getValue().getHomeTeam()," / ")));
    matchAwayTeamColumn.setCellValueFactory(cellData -> new ReadOnlyStringWrapper(
            PlayerUtil.formatPlayerList(cellData.getValue().getAwayTeam()," / ")));
}
EditTourController.java 文件源码 项目:Planchester 阅读 40 收藏 0 点赞 0 评论 0
@FXML
@Override
public void initialize() {

    checkMandatoryFields();

    selectedMusicalWorks.setCellValueFactory(param -> new ReadOnlyStringWrapper(param.getValue()));

    initAppointment = EventScheduleController.getSelectedAppointment();
    initEventDutyDTO = EventScheduleController.getEventForAppointment(initAppointment);

    actualRehearsalList = EventScheduleManager.getAllRehearsalsOfEventDuty(initEventDutyDTO);
    newRehearsalList = actualRehearsalList;
    rehearsalTableView.getItems().clear();
    rehearsalTableColumn.setCellValueFactory(param -> new ReadOnlyStringWrapper(param.getValue()));
    for(EventDutyDTO e : newRehearsalList) {
        String rehearsalToAdd = e.getName();
        rehearsalTableView.getItems().add(rehearsalToAdd);
    }

    name.setText(initEventDutyDTO.getName());
    description.setText(initEventDutyDTO.getDescription());
    date.setValue(initEventDutyDTO.getStartTime().toLocalDateTime().toLocalDate());
    endDate.setValue(initEventDutyDTO.getEndTime().toLocalDateTime().toLocalDate());
    eventLocation.setText(initEventDutyDTO.getLocation());
    conductor.setText(initEventDutyDTO.getConductor());
    points.setText(initEventDutyDTO.getPoints() != null ? String.valueOf(initEventDutyDTO.getPoints()) : "0.0");
    if(initEventDutyDTO.getMusicalWorks() != null && !initEventDutyDTO.getMusicalWorks().isEmpty()) {
        musicalWorks = new ArrayList<>();
        for(MusicalWorkDTO musicalWorkDTO : initEventDutyDTO.getMusicalWorks()) {
            musicalWorks.add(musicalWorkDTO);
            musicalWorkTable.getItems().add(musicalWorkDTO.getName());
        }
    }

    initNotEditableFields();

    points.textProperty().addListener((observable, oldValue, newValue) -> {
        if (!newValue.matches("\\d*[\\,.]?\\d*?")) {
            points.setText(newValue.replaceAll("[^\\d*[\\,.]?\\d*?]", ""));
        }
    });
}
EditController.java 文件源码 项目:Planchester 阅读 44 收藏 0 点赞 0 评论 0
@FXML
protected void initialize() {
    checkMandatoryFields();

    selectedMusicalWorks.setCellValueFactory(param -> new ReadOnlyStringWrapper(param.getValue()));

    initAppointment = EventScheduleController.getSelectedAppointment();
    initEventDutyDTO = EventScheduleController.getEventForAppointment(initAppointment);

    actualRehearsalList = EventScheduleManager.getAllRehearsalsOfEventDuty(initEventDutyDTO);
    newRehearsalList = actualRehearsalList;
    rehearsalTableView.getItems().clear();
    rehearsalTableColumn.setCellValueFactory(param -> new ReadOnlyStringWrapper(param.getValue()));
    for(EventDutyDTO e : newRehearsalList) {
        String rehearsalToAdd = e.getName();
        rehearsalTableView.getItems().add(rehearsalToAdd);
    }

    name.setText(initEventDutyDTO.getName());
    description.setText(initEventDutyDTO.getDescription());
    date.setValue(initEventDutyDTO.getStartTime().toLocalDateTime().toLocalDate());
    startTime.setValue(initEventDutyDTO.getStartTime().toLocalDateTime().toLocalTime());
    endTime.setValue(initEventDutyDTO.getEndTime().toLocalDateTime().toLocalTime());
    eventLocation.setText(initEventDutyDTO.getLocation());
    conductor.setText(initEventDutyDTO.getConductor());
    points.setText(initEventDutyDTO.getPoints() != null ? String.valueOf(initEventDutyDTO.getPoints()) : null);
    if(initEventDutyDTO.getMusicalWorks() != null && !initEventDutyDTO.getMusicalWorks().isEmpty()) {
        musicalWorks = new ArrayList<>();
        for(MusicalWorkDTO musicalWorkDTO : initEventDutyDTO.getMusicalWorks()) {
            musicalWorks.add(musicalWorkDTO);
            musicalWorkTable.getItems().add(musicalWorkDTO.getName());
        }
    }
    initNotEditableFields();

    points.textProperty().addListener((observable, oldValue, newValue) -> {
        if (!newValue.matches("\\d*[\\,.]?\\d*?")) {
            points.setText(newValue.replaceAll("[^\\d*[\\,.]?\\d*?]", " "));
        }
    });
}
DutyDispositionController.java 文件源码 项目:Planchester 阅读 38 收藏 0 点赞 0 评论 0
@FXML public void initialize() {
    tableColumn1.setCellValueFactory(param -> new ReadOnlyStringWrapper(param.getValue()));
    tableColumn2.setCellValueFactory(param -> new ReadOnlyStringWrapper(param.getValue()));
    tableColumn3.setCellValueFactory(param -> new ReadOnlyStringWrapper(param.getValue()));
    tableColumn4.setCellValueFactory(param -> new ReadOnlyStringWrapper(param.getValue()));
}
DutyDetailController.java 文件源码 项目:Planchester 阅读 32 收藏 0 点赞 0 评论 0
@FXML public void initialize() {
    selectedMusicalWorks.setCellValueFactory(param -> new ReadOnlyStringWrapper(param.getValue()));
}
DutyDetailTourController.java 文件源码 项目:Planchester 阅读 27 收藏 0 点赞 0 评论 0
@FXML public void initialize() {
    selectedMusicalWorks.setCellValueFactory(param -> new ReadOnlyStringWrapper(param.getValue()));
}
AttributeItem.java 文件源码 项目:opc-ua-client 阅读 33 收藏 0 点赞 0 评论 0
private AttributeItem(String attribute, String value, boolean editable) {
  attributeWrapper = new ReadOnlyStringWrapper(attribute);
  valueWrapper = new ReadOnlyStringWrapper(value);
  this.editable = editable;
}
EventsViewPresenter.java 文件源码 项目:opc-ua-client 阅读 28 收藏 0 点赞 0 评论 0
@Override
public void initialize(URL url, ResourceBundle rb) {
  this.rb = rb;

  table.setRowFactory(new MonitoredEventRowFactory<MonitoredEvent>());

  id.setCellValueFactory(p -> new ReadOnlyStringWrapper(
      String.format("%s (%s)", p.getValue().getSubscription().getSubscriptionId(), p.getValue().getMonitoredItem().getMonitoredItemId())));

  mode.setCellValueFactory(p -> new ReadOnlyStringWrapper(p.getValue().getMonitoredItem().getMonitoringMode().toString()));

  variable.setCellValueFactory(p -> p.getValue().nameProperty());

  value.setCellValueFactory(p -> p.getValue().valueProperty());

  samplingrate.setCellValueFactory(p -> new ReadOnlyObjectWrapper<Double>(p.getValue().getSubscription().getRevisedPublishingInterval()));

  quality.setCellValueFactory(p -> new ReadOnlyStringWrapper(OpcUaConverter.toString(p.getValue().getMonitoredItem().getStatusCode())));

  timestamp.setCellValueFactory(p -> p.getValue().timestampProperty());

  lasterror.setCellValueFactory(p -> p.getValue().lasterrorProperty());

  table.setItems(monitoredItems);

  table.setOnDragOver(event -> {
    event.acceptTransferModes(TransferMode.COPY);
    event.consume();
  });

  table.setOnDragEntered(event -> {
    if (event.getDragboard().hasString()) {
      table.setBlendMode(BlendMode.DARKEN);
    }
  });
  table.setOnDragExited(event -> {
    if (event.getDragboard().hasString()) {
      table.setBlendMode(null);
    }
  });
  table.setOnDragDropped(event -> {
    if (event.getDragboard().hasString()) {
      table.setBlendMode(null);
      event.acceptTransferModes(TransferMode.COPY);
      state.subscribeTreeItemList().add(state.selectedTreeItemProperty().get());
      event.setDropCompleted(true);
    }
  });

  table.setOnMousePressed(event -> {
    if (event.isPrimaryButtonDown() && event.getClickCount() == 2) {
      MonitoredEvent item = table.getSelectionModel().getSelectedItem();
      if (item != null) {
        state.showAttributeItemProperty().set(item.getReferenceDescription());
      }
    }

  });
  state.subscribeTreeItemList().addListener((ListChangeListener.Change<? extends ReferenceDescription> c) -> {
    while (c.next()) {
      if (c.wasAdded()) {
        c.getAddedSubList().stream().forEach(this::subscribe);
      }
    }
  });
  bindContextMenu();

  state.connectedProperty().addListener((l, a, b) -> {
    if (b && !monitoredItems.isEmpty()) {
      List<ReferenceDescription> items = monitoredItems.stream().map(MonitoredEvent::getReferenceDescription).collect(Collectors.toList());
      monitoredItems.clear();
      subscribe(items);
    }
  });
}
DataTreeViewPresenter.java 文件源码 项目:opc-ua-client 阅读 36 收藏 0 点赞 0 评论 0
@Override
public void initialize(URL url, ResourceBundle rb) {

  tableTree.setRowFactory(new DataTreeNodeRowFactory<ReferenceDescription>());

  display.setCellValueFactory(p -> new ReadOnlyObjectWrapper<ReferenceDescription>(p.getValue().getValue()));


  display.setCellFactory(new DataTreeNodeCellFactory());

  browse.setCellValueFactory(p -> new ReadOnlyStringWrapper(p.getValue().getValue().getBrowseName().toParseableString()));

  node.setCellValueFactory(
      p -> new ReadOnlyStringWrapper(p.getValue().getValue().getNodeId() != null ? p.getValue().getValue().getNodeId().toParseableString() : ""));

  tableTree.rootProperty().bind(state.rootNodeProperty());
  tableTree.getSelectionModel().selectedItemProperty().addListener((l, a, b) -> nodeChanged(b));

  bindContextMenu();

  // copy key not registered in ContenxtMenu
  registerKeys();
}


问题


面经


文章

微信
公众号

扫码关注公众号