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:Main.java

public static ObservableList<String> unmodifiableList(String... array) {
    return FXCollections.observableArrayList(Collections.unmodifiableList(Arrays.asList(array)));
}

From source file:org.phoenicis.javafx.views.scriptui.StepRepresentationMenu.java

@Override
protected void drawStepContent() {
    super.drawStepContent();

    listViewWidget.setItems(FXCollections.observableArrayList(menuItems));
    if (defaultValue != null) {
        int idx = menuItems.indexOf(defaultValue);
        if (idx != -1) {
            listViewWidget.getSelectionModel().select(idx);
            listViewWidget.getFocusModel().focus(idx);
            listViewWidget.scrollTo(idx);
        }/* w ww.ja v  a  2s. c  o m*/
        if (StringUtils.isBlank(defaultValue)) {
            setNextButtonEnabled(false);
            listViewWidget.getSelectionModel().selectedItemProperty()
                    .addListener((observable, oldValue, newValue) -> {
                        if (StringUtils.isBlank(newValue)) {
                            setNextButtonEnabled(false);
                        } else {
                            setNextButtonEnabled(true);
                        }
                    });
        }
    }

    this.addToContentPane(listViewWidget);

}

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

public void fetchSapYmmbancis() throws Exception {
    if (sapYmmbancis.get() != null)
        return;//from   w w  w .j a  v  a 2 s  . c o  m
    String json = destination.path("sapT001s").path(getBukrs()).path("sapYmmbancis")
            .request(APPLICATION_JSON_TYPE).get(String.class);
    List<SapYmmbanci> list = objectMapper.readValue(json,
            TypeFactory.defaultInstance().constructCollectionType(List.class, SapYmmbanci.class));
    sapYmmbancis.set(FXCollections.observableArrayList(list));
}

From source file:br.com.ajaio.midas.desktop.controller.DashBoardController.java

private void populaTabelaConta() {
    contas = contaService.findByUsuario(usuarioLogado);
    ArrayList<Conta> contasDM = new ArrayList<Conta>();
    for (ContaEntity c : contas) {
        Conta conta = new Conta(c);
        contasDM.add(conta);/*from w  w w . jav  a2  s.  c om*/
    }
    final ObservableList<Conta> data = FXCollections.observableArrayList(contasDM);
    TableColumn<Conta, String> contaNomeColumn = new TableColumn<Conta, String>();
    contaNomeColumn.setCellValueFactory(new PropertyValueFactory<Conta, String>("nome"));
    tbContas.setItems(data);
    tbContas.getColumns().addAll(contaNomeColumn);
}

From source file:org.apache.cayenne.modeler.layout.SplashLayout.java

public void initialize() {
    //        final List<String> arr = ModelerPreferences.getLastProjFiles();

    //        URL url = CayenneModeler.class.getResource("/cayenne-analytic.xml");

    final ObservableList<String> projects = FXCollections
            .observableArrayList(ModelerPreferences.getLastProjFiles());

    projectListView.setItems(projects);//from w w  w . ja v a  2  s.  c o  m
    projectListView.getSelectionModel().select(0);

    newProjectButton.setGraphic(GlyphsDude.createIcon(FontAwesomeIcon.PLUS_SQUARE, "16px"));
    openProjectButton.setGraphic(GlyphsDude.createIcon(FontAwesomeIcon.FOLDER_OPEN, "16px"));
}

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

public void fetchSapZpackages() throws Exception {
    if (sapZpackages.get() != null)
        return;/*from   w  w w .ja  v a 2 s .c om*/
    String json = destination.path("sapT001s").path(getBukrs()).path("sapZpackages")
            .request(APPLICATION_JSON_TYPE).get(String.class);
    List<SapZpackage> list = objectMapper.readValue(json,
            TypeFactory.defaultInstance().constructCollectionType(List.class, SapZpackage.class));
    sapZpackages.set(FXCollections.observableArrayList(list));
}

From source file:de.perdian.apps.tagtiger.fx.handlers.batchupdate.UpdateFileNamesFromTagsActionEventHandler.java

@Override
protected BatchUpdateDialog createDialog() {

    ObservableList<UpdateFileNamesFromTagsItem> items = FXCollections.observableArrayList(
            this.getOtherFiles().stream().map(UpdateFileNamesFromTagsItem::new).collect(Collectors.toList()));
    StringProperty patternFieldProperty = new SimpleStringProperty();

    List<String> patternItems = Arrays.asList("${track} ${title}");
    ComboBox<String> patternBox = new ComboBox<>(FXCollections.observableArrayList(patternItems));
    patternBox.setEditable(true);// w  ww.  j  av  a  2  s.co m
    patternBox.setMaxWidth(Double.MAX_VALUE);
    Bindings.bindBidirectional(patternFieldProperty, patternBox.editorProperty().get().textProperty());
    HBox.setHgrow(patternBox, Priority.ALWAYS);

    Button executeButton = new Button(this.getLocalization().executeRename(),
            new ImageView(new Image(UpdateFileNamesFromTagsActionEventHandler.class.getClassLoader()
                    .getResourceAsStream("icons/16/save.png"))));
    executeButton.setDisable(true);
    patternFieldProperty
            .addListener((o, oldValue, newValue) -> executeButton.setDisable(newValue.length() <= 0));

    HBox patternFieldPane = new HBox(10, patternBox, executeButton);
    patternFieldPane.setPadding(new Insets(5, 5, 5, 5));

    TitledPane patternFieldTitlePane = new TitledPane(this.getLocalization().fileNamePattern(),
            patternFieldPane);
    patternFieldTitlePane.setCollapsible(false);

    TableView<?> newFileNamesPane = this.createNewFileNamesPane(items);
    newFileNamesPane.setPrefHeight(400);
    VBox.setVgrow(newFileNamesPane, Priority.ALWAYS);

    VBox actionPane = new VBox(10, patternFieldTitlePane, newFileNamesPane);

    // Create the dialog and finish
    BatchUpdateDialog dialog = new BatchUpdateDialog();
    dialog.setDialogPrefWidth(800);
    dialog.setDialogTitle(this.getLocalization().updateFileNames());
    dialog.setActionPane(actionPane);
    dialog.setLegendPane(this.createLegendPane());

    // Add listeners
    this.getOtherFiles().addListener(
            new WeakListChangeListener<>((Change<? extends TaggableFile> change) -> items.setAll(change
                    .getList().stream().map(UpdateFileNamesFromTagsItem::new).collect(Collectors.toList()))));
    patternFieldProperty.addListener((o, oldValue, newValue) -> this.computeNewFileNames(items, newValue));
    executeButton.setOnAction(event -> {
        this.updateNewFileNames(items);
        ((Stage) executeButton.getScene().getWindow()).close();
    });

    return dialog;

}

From source file:com.bekwam.resignator.ActiveConfiguration.java

public void setRecentProfiles(List<String> rps) {
    recentProfiles.setValue(FXCollections.observableArrayList(rps));
}

From source file:jobhunter.gui.dialog.SubscriptionForm.java

public Optional<Action> show() {
    Dialog dlg = new Dialog(null, getTranslation("message.add.subscription"));

    final GridPane content = new GridPane();
    content.setHgap(10);/*from w w  w.  j  a  va 2s.  c om*/
    content.setVgap(10);

    ObservableList<String> portals = FXCollections.observableArrayList(PreferencesController.getPortalsList());

    portalField.setItems(portals);
    portalField.setPrefWidth(400.0);
    portalField.setEditable(true);

    portalField.setValue(subscription.getPortal());
    portalField.valueProperty().addListener((observable, old, neu) -> {
        subscription.setPortal(neu);
        save.disabledProperty().set(!isValid());
    });

    urlField.setText(subscription.getUri());
    urlField.textProperty().addListener((observable, old, neu) -> {
        subscription.setURI(neu);
        save.disabledProperty().set(!isValid());
    });

    titleField.setText(subscription.getTitle());
    titleField.textProperty().addListener((observable, old, neu) -> {
        subscription.setTitle(neu);
        save.disabledProperty().set(!isValid());
    });

    historyField.setText(subscription.getHistory().toString());
    historyField.textProperty().addListener((observable, old, neu) -> {
        subscription.setHistory(Integer.valueOf(neu));
        save.disabledProperty().set(!isValid());
    });

    content.add(new Label(getTranslation("label.title")), 0, 0);
    content.add(titleField, 1, 0);
    GridPane.setHgrow(titleField, Priority.ALWAYS);

    content.add(new Label(getTranslation("label.portal")), 0, 1);
    content.add(portalField, 1, 1);

    content.add(new Label(getTranslation("label.feed.url")), 0, 2);
    content.add(urlField, 1, 2);
    GridPane.setHgrow(urlField, Priority.ALWAYS);

    content.add(new Label(getTranslation("label.history")), 0, 3);
    content.add(historyField, 1, 3);
    GridPane.setHgrow(historyField, Priority.ALWAYS);

    dlg.setResizable(false);
    dlg.setIconifiable(false);
    dlg.setContent(content);
    dlg.getActions().addAll(save, Dialog.Actions.CANCEL);

    Platform.runLater(() -> titleField.requestFocus());

    l.debug("Showing dialog");
    return Optional.of(dlg.show());
}

From source file:dpfmanager.shell.interfaces.gui.component.report.ReportsModel.java

public ReportsModel(Context context) {
    this.context = context;
    bundle = DPFManagerProperties.getBundle();
    reload = true;// w w  w .  j av  a2  s.co m
    data = FXCollections.observableArrayList(new ArrayList<>());
}