/** * 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); }
@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()); }
/** * 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; }
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()); } }); }
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); }
@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); }
@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); }
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; }
@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*?]", "")); } }); }
@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; }
@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)); }
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); }
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)); } }
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; }
/** * 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(); }
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); }
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); }
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()); }
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)))); }
@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(); }
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); } } } }
@FXML private void initialize() { matchHomeTeamColumn.setCellValueFactory(cellData -> new ReadOnlyStringWrapper( PlayerUtil.formatPlayerList(cellData.getValue().getHomeTeam()," / "))); matchAwayTeamColumn.setCellValueFactory(cellData -> new ReadOnlyStringWrapper( PlayerUtil.formatPlayerList(cellData.getValue().getAwayTeam()," / "))); }
@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*?]", "")); } }); }
@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*?]", " ")); } }); }
@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())); }
@FXML public void initialize() { selectedMusicalWorks.setCellValueFactory(param -> new ReadOnlyStringWrapper(param.getValue())); }
private AttributeItem(String attribute, String value, boolean editable) { attributeWrapper = new ReadOnlyStringWrapper(attribute); valueWrapper = new ReadOnlyStringWrapper(value); this.editable = editable; }
@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); } }); }
@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(); }
@FXML private void initialize() { // replaces CONSTRAINED_RESIZE_POLICY scoreCol.prefWidthProperty().bind( resultsTable.widthProperty() .subtract(fileNameCol.widthProperty()) .subtract(titleCol.widthProperty()) ); searchButton.defaultButtonProperty().bind(searchButton.focusedProperty()); limitField.setText(Integer.toString(DEFAULT_LIMIT)); // DIALOGS configurator = new Configurator(); messageDisplay = new MessageDisplay(); // UI BINDINGS configurator.catalogProperty().bind(catalog); catalog.addListener((o, oldValue, newValue) -> { folderPathLabel.setText(newValue.getPath()); // bind information controls to new catalog indexDetailsLabel.textProperty().unbind(); indexDetailsLabel.textProperty().bind(newValue.indexDetailsProperty()); searchMessageLabel.textProperty().unbind(); searchMessageLabel.textProperty().bind(newValue.searchDetailsProperty()); resultsTable.itemsProperty().unbind(); resultsTable.itemsProperty().bind(newValue.searchResultsProperty()); indexMessageLabel.textProperty().unbind(); indexMessageLabel.textProperty().bind(newValue.indexMessageProperty()); indexProgress.progressProperty().unbind(); indexProgress.progressProperty().bind(newValue.indexProgressProperty()); }); fileNameCol.setCellValueFactory((r) -> new ReadOnlyStringWrapper(r.getValue().file.getName())); titleCol.setCellValueFactory((r) -> new ReadOnlyStringWrapper(r.getValue().title)); scoreCol.setCellValueFactory((r) -> new ReadOnlyStringWrapper(String.format("%.0f", r.getValue().score*100))); // CALLBACKS resultsTable.getSelectionModel().selectedItemProperty().addListener( (o, oldValue, newValue) -> { if (newValue != null) { detailsField.setText(newValue.details); } else { detailsField.setText(""); } }); resultsTable.setOnKeyPressed((event) -> { SearchResult result = resultsTable.getSelectionModel().getSelectedItem(); if (result != null && event.getCode() == KeyCode.ENTER) { catalog.get().openFile(result.file); } }); resultsTable.setRowFactory((tv) -> { final TableRow<SearchResult> row = new TableRow<>(); // open file on double-click row.setOnMouseClicked((event) -> { if (!row.isEmpty() && event.getClickCount() == 2) { catalog.get().openFile(row.getItem().file); } }); // enable drag-and-drop row.setOnDragDetected((event) -> { if (!row.isEmpty()) { Dragboard db = row.startDragAndDrop(TransferMode.COPY, TransferMode.LINK); ClipboardContent content = new ClipboardContent(); content.putFiles(Collections.singletonList(row.getItem().file)); db.setContent(content); event.consume(); } }); return row; }); }
public TransportationFDD(String name, TransportationTypeHandle handle) { this.name = new ReadOnlyStringWrapper(name); this.handle = handle; }
public BuildCheckBox(String name, boolean on) { this.name = new ReadOnlyStringWrapper(name); setOn(on); }
public BuildConfigurationCheckBox(BuildConfiguration buildConfiguration, boolean on) { name = new ReadOnlyStringWrapper(buildConfiguration.getName()); this.on.addListener(observable -> buildConfiguration.setRelevantTransitively(isOn())); setOn(on); }
public void initialize(java.net.URL location, java.util.ResourceBundle resources) { preferences = Preferences.userNodeForPackage(this.getClass()); replayController = new ReplayController(); BooleanBinding runnerIsNull = Bindings.createBooleanBinding(() -> replayController.getRunner() == null, replayController.runnerProperty()); buttonPlay.disableProperty().bind(runnerIsNull.or(replayController.playingProperty())); buttonPause.disableProperty().bind(runnerIsNull.or(replayController.playingProperty().not())); slider.disableProperty().bind(runnerIsNull); replayController.changingProperty().bind(slider.valueChangingProperty()); labelTick.textProperty().bindBidirectional(replayController.tickProperty(), new NumberStringConverter()); labelLastTick.textProperty().bindBidirectional(replayController.lastTickProperty(), new NumberStringConverter()); slider.maxProperty().bind(replayController.lastTickProperty()); replayController.tickProperty().addListener((observable, oldValue, newValue) -> { if (!slider.isValueChanging()) { slider.setValue(newValue.intValue()); } }); slider.valueProperty().addListener((observable, oldValue, newValue) -> { replayController.getRunner().setDemandedTick(newValue.intValue()); }); TableColumn<ObservableEntity, String> entityTableIdColumn = (TableColumn<ObservableEntity, String>) entityTable.getColumns().get(0); entityTableIdColumn.setCellValueFactory(param -> param.getValue() != null ? param.getValue().indexProperty() : new ReadOnlyStringWrapper("")); TableColumn<ObservableEntity, String> entityTableNameColumn = (TableColumn<ObservableEntity, String>) entityTable.getColumns().get(1); entityTableNameColumn.setCellValueFactory(param -> param.getValue() != null ? param.getValue().nameProperty() : new ReadOnlyStringWrapper("")); entityTable.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { log.info("entity table selection from {} to {}", oldValue, newValue); detailTable.setItems(newValue); }); TableColumn<ObservableEntityProperty, String> idColumn = (TableColumn<ObservableEntityProperty, String>) detailTable.getColumns().get(0); idColumn.setCellValueFactory(param -> param.getValue().indexProperty()); TableColumn<ObservableEntityProperty, String> nameColumn = (TableColumn<ObservableEntityProperty, String>) detailTable.getColumns().get(1); nameColumn.setCellValueFactory(param -> param.getValue().nameProperty()); TableColumn<ObservableEntityProperty, String> valueColumn = (TableColumn<ObservableEntityProperty, String>) detailTable.getColumns().get(2); valueColumn.setCellValueFactory(param -> param.getValue().valueProperty()); entityNameFilter.textProperty().addListener(observable -> { if (filteredEntityList != null) { filteredEntityList.setPredicate(allFilterFunc); filteredEntityList.setPredicate(filterFunc); } }); mapControl = new MapControl(); mapCanvasPane.getChildren().add(mapControl); mapCanvasPane.setTopAnchor(mapControl, 0.0); mapCanvasPane.setBottomAnchor(mapControl, 0.0); mapCanvasPane.setLeftAnchor(mapControl, 0.0); mapCanvasPane.setRightAnchor(mapControl, 0.0); mapCanvasPane.widthProperty().addListener(evt -> resizeMapControl()); mapCanvasPane.heightProperty().addListener(evt -> resizeMapControl()); }
public ObservableEntity(int index) { this.entity = null; this.index = new ReadOnlyStringWrapper(String.valueOf(index)); this.name = new ReadOnlyStringWrapper(""); }
private Tab createPVs(final Collection<NameStateValue> pvs) { // Use text field to allow users to copy the name, value to clipboard final TableColumn<NameStateValue, String> name = new TableColumn<>(Messages.WidgetInfoDialog_Name); name.setCellFactory(TextFieldTableCell.forTableColumn()); name.setCellValueFactory(param -> new ReadOnlyStringWrapper(param.getValue().name)); final TableColumn<NameStateValue, String> state = new TableColumn<>(Messages.WidgetInfoDialog_State); state.setCellFactory(TextFieldTableCell.forTableColumn()); state.setCellValueFactory(param -> new ReadOnlyStringWrapper(param.getValue().state)); final TableColumn<NameStateValue, String> value = new TableColumn<>(Messages.WidgetInfoDialog_Value); value.setCellFactory(TextFieldTableCell.forTableColumn()); value.setCellValueFactory(param -> { String text; final VType vtype = param.getValue().value; if (vtype == null) text = Messages.WidgetInfoDialog_Disconnected; else { // Formatting arrays can be very slow, // so only show the basic type info if (vtype instanceof VNumberArray) text = vtype.toString(); else text = VTypeUtil.getValueString(vtype, true); if (vtype instanceof Alarm) { final Alarm alarm = (Alarm) vtype; if (alarm.getAlarmSeverity() != AlarmSeverity.NONE) text = text + " [" + alarm.getAlarmSeverity().toString() + ", " + alarm.getAlarmName() + "]"; } } return new ReadOnlyStringWrapper(text); }); final ObservableList<NameStateValue> pv_data = FXCollections.observableArrayList(pvs); pv_data.sort((a, b) -> a.name.compareTo(b.name)); final TableView<NameStateValue> table = new TableView<>(pv_data); table.getColumns().add(name); table.getColumns().add(state); table.getColumns().add(value); table.setEditable(true); table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); return new Tab(Messages.WidgetInfoDialog_TabPVs, table); }
private void setUpTableView() { tableScore.setFixedCellSize(25); columnName.setStyle("-fx-alignment: CENTER"); columnName.setCellValueFactory(cellData -> new ReadOnlyStringWrapper(cellData.getValue().getBiodata().getName())); columnEducationScore.setStyle("-fx-alignment: CENTER"); columnEducationScore.setCellValueFactory(cellData -> new ReadOnlyStringWrapper(cellData.getValue().getEducationScore() + "")); columnWorkScore.setStyle("-fx-alignment: CENTER"); columnWorkScore.setCellValueFactory(cellData -> new ReadOnlyStringWrapper(cellData.getValue().getWorkScore() + "")); columnSkillScore.setStyle("-fx-alignment: CENTER"); columnSkillScore.setCellValueFactory(cellData -> new ReadOnlyStringWrapper(cellData.getValue().getSkillScore() + "")); columnLanguageScore.setStyle("-fx-alignment: CENTER"); columnLanguageScore.setCellValueFactory(cellData -> new ReadOnlyStringWrapper(cellData.getValue().getLanguageScore() + "")); columnTotalScore.setStyle("-fx-alignment: CENTER"); columnTotalScore.setCellValueFactory(cellData -> new ReadOnlyStringWrapper(cellData.getValue().getScore() + "")); columnView.setStyle("-fx-alignment: CENTER"); columnView.setCellFactory(new Callback<TableColumn, TableCell>() { @Override public TableCell call(TableColumn param) { final TableCell cell = new TableCell() { @Override protected void updateItem(Object item, boolean empty) { super.updateItem(item, empty); if (empty) { setGraphic(null); setText(null); } else { ImageButton btnViewCV = new ImageButton("/search.png", BTN_VIEW_SIZE); btnViewCV.setOnAction(event -> { Report selectedReport = (Report) getTableView().getItems().get(getIndex()); CV selectedCV = selectedReport.getParsedCV(); showCVDetailLayout(selectedCV); }); setGraphic(btnViewCV); setText(null); } } }; return cell; } }); }
public AboutDialog() { _pkgs = new SimpleListProperty<PackageRef>( FXCollections.observableArrayList()); HBox hbox1 = new HBox(); hbox1.setAlignment(Pos.CENTER); Label title = new Label("DaRIS Explorer"); title.setFont(new Font("Arial", 20)); title.setStyle("-fx-font-weight:bold"); title.setTextAlignment(TextAlignment.CENTER); hbox1.getChildren().add(title); HBox hbox2 = new HBox(); hbox2.setAlignment(Pos.CENTER); Label version = new Label("Vesion: " + Version.VERSION); version.setTextAlignment(TextAlignment.CENTER); hbox2.getChildren().add(version); _table = new TableView<PackageRef>(); _table.setEditable(false); TableColumn<PackageRef, String> nameCol = new TableColumn<PackageRef, String>( "Package"); nameCol.setCellValueFactory(cellData -> { return new ReadOnlyStringWrapper(cellData.getValue().name()); }); nameCol.setPrefWidth(250.0); TableColumn<PackageRef, String> versionCol = new TableColumn<PackageRef, String>( "Version"); versionCol.setCellValueFactory(cellData -> { return new ReadOnlyStringWrapper(cellData.getValue().version()); }); versionCol.setPrefWidth(80.0); _table.getColumns().add(nameCol); _table.getColumns().add(versionCol); _table.itemsProperty().bind(_pkgs); HBox hbox3 = new HBox(); hbox3.setAlignment(Pos.CENTER_RIGHT); Button button = new Button("OK"); button.setOnAction(event -> { if (_stage != null) { _stage.close(); } }); hbox3.getChildren().add(button); VBox vbox = new VBox(); vbox.setFillWidth(true); vbox.setSpacing(5); vbox.setPadding(new Insets(20, 20, 20, 20)); vbox.getChildren().addAll(hbox1, hbox2, _table, hbox3); _scene = new Scene(vbox, 420, 360); new PackageList().send(pkgs -> { Platform.runLater(() -> { _pkgs.setAll(pkgs); }); }); }
public TestEntry(final String channelName) { name = new ReadOnlyStringWrapper(channelName); online = new SimpleObjectProperty<>(EntryState.UNKNOWN); }