Example usage for javafx.collections FXCollections observableArrayList

List of usage examples for javafx.collections FXCollections observableArrayList

Introduction

In this page you can find the example usage for javafx.collections FXCollections observableArrayList.

Prototype

public static <E> ObservableList<E> observableArrayList(Collection<? extends E> col) 

Source Link

Document

Creates a new observable array list and adds a content of collection col to it.

Usage

From source file:org.sleuthkit.autopsy.imageanalyzer.grouping.GroupSortBy.java

/**
 * get a list of the values of this enum
 *
 * @return//  w  ww  .  j a v  a 2 s.  c o m
 */
public static ObservableList<GroupSortBy> getValues() {
    return FXCollections.observableArrayList(Arrays.asList(values()));

}

From source file:eu.ggnet.dwoss.receipt.shipment.ShipmentUpdateStage.java

private void init(Shipment s) {

    okButton.setOnAction((ActionEvent event) -> {
        shipment = getShipment();//  w  w  w  .  ja v a  2  s  .  com
        if (isValid())
            close();
    });

    cancelButton.setOnAction((ActionEvent event) -> {
        close();
    });

    idField = new TextField(Long.toString(s.getId()));
    idField.setDisable(true);
    shipIdField = new TextField(s.getShipmentId());

    Callback<ListView<TradeName>, ListCell<TradeName>> cb = new Callback<ListView<TradeName>, ListCell<TradeName>>() {
        @Override
        public ListCell<TradeName> call(ListView<TradeName> param) {
            return new ListCell<TradeName>() {
                @Override
                protected void updateItem(TradeName item, boolean empty) {
                    super.updateItem(item, empty);
                    if (item == null || empty)
                        setText("Hersteller whlen...");
                    else
                        setText(item.getName());
                }
            };
        }
    };

    Set<TradeName> contractors = Client.lookup(MandatorSupporter.class).loadContractors().all();
    ownerBox = new ComboBox<>(FXCollections.observableArrayList(contractors));
    ownerBox.setMaxWidth(MAX_VALUE);
    ownerBox.setCellFactory(cb);
    ownerBox.getSelectionModel().selectedItemProperty().addListener(
            (ObservableValue<? extends TradeName> observable, TradeName oldValue, TradeName newValue) -> {
                if (newValue == null)
                    return;
                shipment.setContractor(newValue);
                manufacturerBox.getSelectionModel().select(newValue.getManufacturer());
            });

    ObservableList<TradeName> manufacturers = FXCollections.observableArrayList(TradeName.getManufacturers());
    manufacturerBox = new ComboBox<>(manufacturers);
    manufacturerBox.setMaxWidth(MAX_VALUE);
    manufacturerBox.setCellFactory(cb);
    SingleSelectionModel<TradeName> sm = ownerBox.getSelectionModel();
    if (s.getContractor() == null)
        sm.selectFirst();
    else
        sm.select(s.getContractor());
    if (shipment.getDefaultManufacturer() != null)
        manufacturerBox.getSelectionModel().select(shipment.getDefaultManufacturer());

    statusBox = new ComboBox<>(FXCollections.observableArrayList(Shipment.Status.values()));
    statusBox.setMaxWidth(MAX_VALUE);
    statusBox.getSelectionModel().select(s.getStatus() == null ? OPENED : s.getStatus());

    GridPane grid = new GridPane();
    grid.addRow(1, new Label("ID:"), idField);
    grid.addRow(2, new Label("Shipment ID:"), shipIdField);
    grid.addRow(3, new Label("Besitzer:"), ownerBox);
    grid.addRow(4, new Label("Hersteller:"), manufacturerBox);
    grid.addRow(5, new Label("Status"), statusBox);
    grid.setMaxWidth(MAX_VALUE);
    grid.vgapProperty().set(2.);
    grid.getColumnConstraints().add(0,
            new ColumnConstraints(100, 100, Double.MAX_VALUE, Priority.SOMETIMES, HPos.LEFT, false));
    grid.getColumnConstraints().add(1,
            new ColumnConstraints(100, 150, Double.MAX_VALUE, Priority.ALWAYS, HPos.LEFT, true));

    HBox hButtonBox = new HBox(okButton, cancelButton);
    hButtonBox.alignmentProperty().set(Pos.TOP_RIGHT);

    errorLabel.setWrapText(true);
    BorderPane rootPane = new BorderPane(grid, errorLabel, null, hButtonBox, null);

    this.setTitle(s.getId() > 0 ? "Shipment bearbeiten" : "Shipment anlegen");
    this.setScene(new Scene(rootPane));
    this.setResizable(false);
}

From source file:com.hengyi.japp.print.client.domain.SapT001.java

public void setSapYmmzhixs(List<SapYmmzhix> sapYmmzhixs) {
    this.sapYmmzhixs.set(FXCollections.observableArrayList(sapYmmzhixs));
}

From source file:herudi.controller.microMarketController.java

private void selectData() {
    if (listData == null) {
        listData = FXCollections.observableArrayList(crud.selectData());
    } else {//from w ww. j  ava  2 s . c  o  m
        listData.clear();
        listData.addAll(crud.selectData());
    }
    tableData.setItems(listData);
}

From source file:com.hengyi.japp.print.client.domain.SapT001.java

public void setSapYmmtonggs(List<SapYmmtongg> sapYmmtonggs) {
    this.sapYmmtonggs.set(FXCollections.observableArrayList(sapYmmtonggs));
}

From source file:dsfixgui.view.DSFSavesPane.java

private void initialize() {

    //Basic layout
    this.setFitToWidth(true);

    spacerColumn = new ColumnConstraints();
    spacerColumn.setFillWidth(true);/*from  w ww  . j  a  v a2 s . c  o  m*/
    spacerColumn.setPercentWidth(3.0);
    primaryColumn = new ColumnConstraints();
    primaryColumn.setFillWidth(true);
    primaryColumn.setPercentWidth(95.0);
    primaryPane = new GridPane();
    primaryPane.getColumnConstraints().addAll(spacerColumn, primaryColumn);
    primaryVBox = new VBox();
    primaryVBox.getStyleClass().add("spacing_15");
    primaryPane.add(primaryVBox, 1, 0);
    titleLabel = new Label(SAVE_BACKUP.toUpperCase() + " " + SETTINGS.toUpperCase());
    titleLabel.getStyleClass().add("settings_title");
    titleBar = new HBox();
    titleBar.setAlignment(Pos.CENTER);
    titleBar.getChildren().add(titleLabel);
    restoreDefaultsBar = new HBox();
    restoreDefaultsBar.setAlignment(Pos.CENTER);
    restoreDefaultsBar.setSpacing(5.0);
    applySettingsButton = new Button(APPLY_SETTINGS);
    restoreDefaultsButton = new Button(RESTORE_DEFAULTS);
    applySettingsButton.getStyleClass().add("translate_y_4");
    restoreDefaultsButton.getStyleClass().add("translate_y_4");
    restoreDefaultsBar.getChildren().addAll(applySettingsButton, restoreDefaultsButton);
    spacerHBox = new HBox();
    spacerHBox.setMinHeight(10.0);
    bottomSpacerHBox = new HBox();
    bottomSpacerHBox.setMinHeight(10.0);

    /////////////////////SETTINGS PANES/////////////////////
    //
    //
    //Toggle Save Backups
    saveBackupsPane = new FlowPane();
    saveBackupsPane.getStyleClass().add("settings_pane");
    saveBackupsLabel = new Label(SAVE_BACKUPS_LABEL + "  ");
    saveBackupsLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    saveBackupsPicker = new ComboBox(FXCollections.observableArrayList(DISABLE_ENABLE));
    if (config.enableBackups.get() == 0) {
        saveBackupsPicker.setValue(saveBackupsPicker.getItems().get(0));
    } else {
        saveBackupsPicker.setValue(saveBackupsPicker.getItems().get(1));
    }
    saveBackupsPane.getChildren().addAll(saveBackupsLabel, saveBackupsPicker);
    //
    //Save Backup Interval
    saveIntervalPane = new FlowPane();
    saveIntervalPane.getStyleClass().add("settings_pane");
    saveIntervalLabel = new Label(SAVE_BACKUPS_INTERVAL_LABEL + " ");
    saveIntervalLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    saveIntervalLabel.setTooltip(new Tooltip(SAVE_INTERVAL_TT));
    saveIntervalField = new TextField("" + config.backupInterval.get());
    saveIntervalField.getStyleClass().add("settings_text_field");
    saveIntervalPane.getChildren().addAll(saveIntervalLabel, saveIntervalField);
    //
    //Max Save Backups
    maxSavesPane = new FlowPane();
    maxSavesPane.getStyleClass().add("settings_pane");
    maxSavesLabel = new Label(MAX_BACKUPS_LABEL + " ");
    maxSavesLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    maxSavesField = new TextField("" + config.maxBackups.get());
    maxSavesField.getStyleClass().add("settings_text_field");
    maxSavesPane.getChildren().addAll(maxSavesLabel, maxSavesField);

    if (config.enableBackups.get() == 0) {
        saveIntervalField.setDisable(true);
        maxSavesField.setDisable(true);
    }

    primaryVBox.getChildren().addAll(titleBar, restoreDefaultsBar, spacerHBox, saveBackupsPane,
            saveIntervalPane, maxSavesPane, bottomSpacerHBox);
    initializeEventHandlers();

    this.setContent(primaryPane);
}

From source file:com.hengyi.japp.print.client.domain.SapT001.java

public void setSapYmmmachs(List<SapYmmmach> sapYmmmachs) {
    this.sapYmmmachs.set(FXCollections.observableArrayList(sapYmmmachs));
}

From source file:ch.unibas.fittingwizard.presentation.addmolecule.CoordinatesPage.java

private void fillCoordinatesTable() {
    coordinatesTable.setItems(FXCollections.observableArrayList(xyzFile.getAtoms()));
}

From source file:de.hs.mannheim.modUro.controller.diagram.ModeltypeDiagramController.java

/**
 * Initializes Choicebox Content.//from  w ww.j a v a 2  s  .  c  o m
 */
private void initializeChoiceboxContent() {
    List<String> name = modeltypeDiagram.getMetricTypeNames();

    int left = 0;
    int right = 0;

    for (String val : name) {
        if (val.equals(FitnessName.ARRANGEMENT_FITNESS.getName())) {
            left = name.indexOf(FitnessName.ARRANGEMENT_FITNESS.getName());
        }

        if (val.equals(FitnessName.VOLUME_FITNESS.getName())) {
            right = name.indexOf(FitnessName.VOLUME_FITNESS.getName());
        }
    }

    leftMetricType.setItems(FXCollections.observableArrayList(name));
    rightMetricType.setItems(FXCollections.observableArrayList(name));

    leftMetricType.getSelectionModel().select(left);
    rightMetricType.getSelectionModel().select(right);

    leftLastSelectedIndex = left;
    rightLastSelectedIndex = right;

    leftLastSelectedMetrictypename = name.get(leftLastSelectedIndex);
    rightLastSelectedMetrictypename = name.get(rightLastSelectedIndex);

    setLeftChartContent(name.get(left));
    setRightChartContent(name.get(right));
}

From source file:org.cirdles.ambapo.userInterface.AmbapoUIController.java

/**
 * Initializes the controller class.//from  w  w w .  j av  a2s  . c o m
 */
@Override
public void initialize(URL url, ResourceBundle rb) {
    // TODO
    ObservableList<String> datumChoices = FXCollections.observableArrayList(Datum.DATUMS);

    //A, B, I, O, Y, and Z aren't valid zone letters
    ObservableList<Character> zoneLetters = FXCollections.observableArrayList(UTM.ZONE_LETTERS);

    ObservableList<Character> hemispheres = FXCollections.observableArrayList('*', 'N', 'S');

    ObservableList<Integer> zoneNumbers = FXCollections.observableArrayList(UTM.ZONE_NUMBERS);

    ObservableList<String> bulkConversionChoices = FXCollections.observableArrayList("From UTM to LatLong",
            "From LatLong to UTM", "From LatLong to LatLong");

    bulkConversionChooser.setItems(bulkConversionChoices);
    bulkConversionChooser.getSelectionModel().selectFirst();

    datumChooserUTMAndLatLong.setItems(datumChoices);
    datumChooserLatLongTo.setItems(datumChoices);
    datumChooserLatLongFrom.setItems(datumChoices);

    datumChooserUTMAndLatLong.setValue(Datum.WGS84.getDatum());
    datumChooserLatLongTo.setValue(Datum.WGS84.getDatum());
    datumChooserLatLongFrom.setValue(Datum.WGS84.getDatum());

    zoneLetterChooser.setItems(zoneLetters);
    zoneLetterChooser.getSelectionModel().selectFirst();

    hemisphereChooser.setItems(hemispheres);
    hemisphereChooser.getSelectionModel().selectFirst();

    zoneNumberChooser.setItems(zoneNumbers);
    zoneNumberChooser.getSelectionModel().selectFirst();

    this.conversionFileHandler = new ConversionFileHandler();

    openConvertedFileButton.setDisable(true);
    convertButton.setDisable(true);

    setupListeners();
}