Search in sources :

Example 11 with ReadOnlyStringWrapper

use of javafx.beans.property.ReadOnlyStringWrapper in project Smartcity-Smarthouse by TechnionYP5777.

the class SensorConfigurationController method initialize.

@Override
public void initialize(final URL location, final ResourceBundle __) {
    nameColumn.setCellValueFactory(cellData -> new ReadOnlyStringWrapper(cellData.getValue().getName()));
    typeColumn.setCellValueFactory(cellData -> new ReadOnlyStringWrapper(cellData.getValue().getType().getFieldDescription()));
    deleteColumn.setCellValueFactory(param -> new SimpleBooleanProperty(param.getValue() != null));
    deleteColumn.setCellFactory(p -> {
        final ButtonCell $ = new ButtonCell();
        $.setAlignment(Pos.CENTER);
        return $;
    });
    backButton.setOnAction(__1 -> mainController.loadSensorList());
    HBox.setHgrow(addNameField, Priority.ALWAYS);
    HBox.setHgrow(addTypeField, Priority.ALWAYS);
    HBox.setHgrow(saveButton, Priority.ALWAYS);
    addTypeField.setPromptText("Sensor Type");
    addTypeField.getItems().addAll(Types.values());
    final int btnCount = buttonBox.getChildren().size();
    addNameField.prefWidthProperty().bind(buttonBox.widthProperty().divide(btnCount));
    addTypeField.prefWidthProperty().bind(buttonBox.widthProperty().divide(btnCount));
    saveButton.prefWidthProperty().bind(buttonBox.widthProperty().divide(btnCount));
    saveButton.setOnAction(__1 -> addField());
    deleteButton.setOnAction(__1 -> {
        mainController.removeSensor(currentSensor);
        mainController.loadSensorList();
    });
    messageButton.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(final ActionEvent __1) {
            try {
                final FXMLLoader fxmlLoader = new FXMLLoader(this.getClass().getResource("message_ui.fxml"));
                final Parent root1 = (Parent) fxmlLoader.load();
                ((MessageViewController) fxmlLoader.getController()).setCurrentSensor(currentSensor);
                final Stage stage = new Stage();
                stage.setScene(new Scene(root1));
                stage.show();
            } catch (final Exception $) {
                System.out.println($);
            }
        }
    });
}
Also used : SimpleBooleanProperty(javafx.beans.property.SimpleBooleanProperty) ReadOnlyStringWrapper(javafx.beans.property.ReadOnlyStringWrapper) Parent(javafx.scene.Parent) ActionEvent(javafx.event.ActionEvent) Stage(javafx.stage.Stage) Scene(javafx.scene.Scene) FXMLLoader(javafx.fxml.FXMLLoader)

Example 12 with ReadOnlyStringWrapper

use of javafx.beans.property.ReadOnlyStringWrapper in project org.csstudio.display.builder by kasemir.

the class WidgetInfoDialog method createMacros.

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);
}
Also used : Tab(javafx.scene.control.Tab) ReadOnlyStringWrapper(javafx.beans.property.ReadOnlyStringWrapper) Macros(org.csstudio.display.builder.model.macros.Macros) TableColumn(javafx.scene.control.TableColumn) TableView(javafx.scene.control.TableView)

Example 13 with ReadOnlyStringWrapper

use of javafx.beans.property.ReadOnlyStringWrapper in project loinc2hpo by monarch-initiative.

the class AnnotateTabController method initadvancedAnnotationTable.

private void initadvancedAnnotationTable() {
    advancedAnnotationSystem.setSortable(true);
    advancedAnnotationSystem.setCellValueFactory(cdf -> new ReadOnlyStringWrapper(cdf.getValue().getCode().getSystem()));
    advancedAnnotationCode.setSortable(true);
    advancedAnnotationCode.setCellValueFactory(cdf -> new ReadOnlyStringWrapper(cdf.getValue().getCode().getCode()));
    advancedAnnotationHpo.setSortable(true);
    advancedAnnotationHpo.setCellValueFactory(cdf -> new ReadOnlyStringWrapper(cdf.getValue().getHpo_term()));
    advancedAnnotationTable.setItems(tempAdvancedAnnotations);
}
Also used : ReadOnlyStringWrapper(javafx.beans.property.ReadOnlyStringWrapper)

Example 14 with ReadOnlyStringWrapper

use of javafx.beans.property.ReadOnlyStringWrapper in project loinc2hpo by monarch-initiative.

the class AnnotateTabController method initTableStructure.

private void initTableStructure() {
    loincIdTableColumn.setSortable(true);
    loincIdTableColumn.setCellValueFactory(cdf -> new ReadOnlyStringWrapper(cdf.getValue().getLOINC_Number().toString()));
    componentTableColumn.setSortable(true);
    componentTableColumn.setCellValueFactory(cdf -> new ReadOnlyStringWrapper(cdf.getValue().getComponent()));
    propertyTableColumn.setSortable(true);
    propertyTableColumn.setCellValueFactory(cdf -> new ReadOnlyStringWrapper(cdf.getValue().getProperty()));
    timeAspectTableColumn.setSortable(true);
    timeAspectTableColumn.setCellValueFactory(cdf -> new ReadOnlyStringWrapper(cdf.getValue().getTimeAspect()));
    methodTableColumn.setSortable(true);
    methodTableColumn.setCellValueFactory(cdf -> new ReadOnlyStringWrapper(cdf.getValue().getMethod()));
    scaleTableColumn.setSortable(true);
    scaleTableColumn.setCellValueFactory(cdf -> new ReadOnlyStringWrapper(cdf.getValue().getScale()));
    systemTableColumn.setSortable(true);
    systemTableColumn.setCellValueFactory(cdf -> new ReadOnlyStringWrapper(cdf.getValue().getSystem()));
    nameTableColumn.setSortable(true);
    nameTableColumn.setCellValueFactory(cdf -> new ReadOnlyStringWrapper(cdf.getValue().getLongName()));
    // hpoListView.setOrientation(Orientation.HORIZONTAL);
    accordion.setExpandedPane(loincTableTitledpane);
}
Also used : ReadOnlyStringWrapper(javafx.beans.property.ReadOnlyStringWrapper)

Example 15 with ReadOnlyStringWrapper

use of javafx.beans.property.ReadOnlyStringWrapper in project loinc2hpo by monarch-initiative.

the class Loinc2HpoAnnotationsTabController method initialize.

@FXML
private void initialize() {
    logger.trace("Calling initialize");
    loincAnnotationTableView.setEditable(false);
    loincNumberColumn.setSortable(true);
    loincNumberColumn.setCellValueFactory(cdf -> new ReadOnlyStringWrapper(cdf.getValue().getLoincId().toString()));
    loincScaleColumn.setSortable(true);
    loincScaleColumn.setCellValueFactory(cdf -> new ReadOnlyStringWrapper(cdf.getValue().getLoincScale().toString()));
    belowNormalHpoColumn.setSortable(true);
    belowNormalHpoColumn.setCellValueFactory(cdf -> cdf.getValue() == null ? new ReadOnlyStringWrapper("\" \"") : new ReadOnlyStringWrapper(model.termId2HpoName(cdf.getValue().getBelowNormalHpoTermId())));
    notAbnormalHpoColumn.setSortable(true);
    notAbnormalHpoColumn.setCellValueFactory(cdf -> cdf.getValue() == null ? new ReadOnlyStringWrapper("\" \"") : new ReadOnlyStringWrapper(model.termId2HpoName(cdf.getValue().getNotAbnormalHpoTermName())));
    aboveNormalHpoColumn.setSortable(true);
    aboveNormalHpoColumn.setCellValueFactory(cdf -> cdf.getValue() == null ? new ReadOnlyStringWrapper("\" \"") : new ReadOnlyStringWrapper(model.termId2HpoName(cdf.getValue().getAboveNormalHpoTermName())));
    loincFlagColumn.setSortable(true);
    loincFlagColumn.setCellValueFactory(cdf -> cdf.getValue() != null && cdf.getValue().getFlag() ? new ReadOnlyStringWrapper("Y") : new ReadOnlyStringWrapper(""));
    noteColumn.setSortable(true);
    noteColumn.setCellValueFactory(cdf -> cdf.getValue() == null ? new ReadOnlyStringWrapper("") : new ReadOnlyStringWrapper(cdf.getValue().getNote()));
    updateSummary();
}
Also used : ReadOnlyStringWrapper(javafx.beans.property.ReadOnlyStringWrapper) FXML(javafx.fxml.FXML)

Aggregations

ReadOnlyStringWrapper (javafx.beans.property.ReadOnlyStringWrapper)20 TableColumn (javafx.scene.control.TableColumn)7 TableView (javafx.scene.control.TableView)5 SimpleBooleanProperty (javafx.beans.property.SimpleBooleanProperty)4 ObservableList (javafx.collections.ObservableList)3 Tab (javafx.scene.control.Tab)3 SimpleObjectProperty (javafx.beans.property.SimpleObjectProperty)2 FXCollections (javafx.collections.FXCollections)2 ActionEvent (javafx.event.ActionEvent)2 FXML (javafx.fxml.FXML)2 Pos (javafx.geometry.Pos)2 Button (javafx.scene.control.Button)2 TreeItem (javafx.scene.control.TreeItem)2 TreeTableColumn (javafx.scene.control.TreeTableColumn)2 CellDataFeatures (javafx.scene.control.TreeTableColumn.CellDataFeatures)2 VBox (javafx.scene.layout.VBox)2 DiffEntry (com.insightfullogic.honest_profiler.core.aggregation.result.diff.DiffEntry)1 GuiController (il.ac.technion.cs.smarthouse.gui_controller.GuiController)1 GenericSensor (il.ac.technion.cs.smarthouse.sensors.simulator.GenericSensor)1 SensorsSimulator (il.ac.technion.cs.smarthouse.sensors.simulator.SensorsSimulator)1