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:com.danilafe.sbaccountmanager.StarboundServerAccountManager.java

private void openAccountManager() {
    //Window Crap
    Stage accountManagerStage = new Stage();
    accountManagerStage.setTitle("Starbound Server Account Manager");

    GridPane gp = new GridPane();
    gp.setAlignment(Pos.CENTER);//from www. j a  v  a  2s. co  m
    gp.setVgap(10);
    gp.setHgap(10);
    gp.setPadding(new Insets(25, 25, 25, 25));

    Text title = new Text("Starbound Account Manager");
    title.setFont(Font.font("Century Gothic", FontWeight.NORMAL, 20));
    gp.add(title, 0, 0, 2, 1);

    ListView<String> user_list = new ListView<String>();
    ObservableList<String> user_list_o = FXCollections.observableArrayList(users);
    user_list.setItems(user_list_o);
    user_list.setPrefHeight(50);

    ListView<String> banned_users_list = new ListView<String>();
    ObservableList<String> banned_users_list_o = FXCollections.observableArrayList(banned_usernames);
    banned_users_list.setItems(banned_users_list_o);
    banned_users_list.setPrefHeight(50);

    ListView<String> banned_ips_list = new ListView<String>();
    ObservableList<String> banned_ips_list_o = FXCollections.observableArrayList(banned_ips);
    banned_ips_list.setItems(banned_ips_list_o);
    banned_ips_list.setPrefHeight(50);

    ListView<String> banned_playernames_list = new ListView<String>();
    ObservableList<String> banned_playernames_list_o = FXCollections.observableArrayList(banned_playernames);
    banned_playernames_list.setItems(banned_playernames_list_o);
    banned_playernames_list.setPrefHeight(50);

    Label user_list_l = new Label("Current Users");
    Label banned_users_list_l = new Label("Banned Users");
    Label banned_ips_list_l = new Label("Banned IP's");
    Label banned_playernames_list_l = new Label("Banned Player Names");

    Button add_user = new Button("Add User");
    Button add_banned_user = new Button("Add Banned User");
    Button add_banned_ip = new Button("Add Banned IP");
    Button add_banned_playername = new Button("Add Banner Playername");

    Button remove_user = new Button("Remove User");
    Button remove_banned_user = new Button("Remove Banned User");
    Button remove_banned_ip = new Button("Remove Banned IP");
    Button remove_banned_playername = new Button("Remove Banner Playername");

    HBox userbox = new HBox();
    userbox.setAlignment(Pos.BOTTOM_LEFT);
    userbox.getChildren().addAll(add_user, remove_user);
    userbox.setSpacing(5);

    HBox b_userbox = new HBox();
    b_userbox.setAlignment(Pos.BOTTOM_LEFT);
    b_userbox.getChildren().addAll(add_banned_user, remove_banned_user);
    b_userbox.setSpacing(5);

    HBox b_ipbox = new HBox();
    b_ipbox.setAlignment(Pos.BOTTOM_LEFT);
    b_ipbox.getChildren().addAll(add_banned_ip, remove_banned_ip);
    b_ipbox.setSpacing(5);

    HBox b_playerbox = new HBox();
    b_playerbox.setAlignment(Pos.BOTTOM_LEFT);
    b_playerbox.getChildren().addAll(add_banned_playername, remove_banned_playername);
    b_playerbox.setSpacing(5);

    Button save = new Button("Save Config");
    save.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            save();
        }

    });

    add_user.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            createAccount(user_list);
        }

    });
    add_banned_user.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            createBannedUser(banned_users_list);
        }

    });
    add_banned_ip.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            createBannedIP(banned_ips_list);
        }

    });
    add_banned_playername.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            createBannedPlayername(banned_playernames_list);
        }

    });

    remove_user.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            users.remove(user_list.getSelectionModel().getSelectedItem());
            user_list.setItems(FXCollections.observableArrayList(users));
        }

    });
    remove_banned_user.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            banned_usernames.remove(banned_users_list.getSelectionModel().getSelectedItem());
            banned_users_list.setItems(FXCollections.observableArrayList(banned_usernames));
        }

    });
    remove_banned_ip.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            banned_ips.remove(banned_ips_list.getSelectionModel().getSelectedItem());
            banned_ips_list.setItems(FXCollections.observableArrayList(banned_ips));
        }

    });
    remove_banned_playername.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            banned_playernames.remove(banned_playernames_list.getSelectionModel().getSelectedItem());
            banned_playernames_list.setItems(FXCollections.observableArrayList(banned_playernames));
        }

    });

    gp.add(user_list_l, 0, 1);
    gp.add(user_list, 0, 2);
    gp.add(userbox, 0, 3);
    gp.add(banned_users_list_l, 0, 4);
    gp.add(banned_users_list, 0, 5);
    gp.add(b_userbox, 0, 6);
    gp.add(banned_ips_list_l, 0, 7);
    gp.add(banned_ips_list, 0, 8);
    gp.add(b_ipbox, 0, 9);
    gp.add(banned_playernames_list_l, 0, 10);
    gp.add(banned_playernames_list, 0, 11);
    gp.add(b_playerbox, 0, 12);
    gp.add(save, 0, 13);

    Scene sc = new Scene(gp, 800 / 2, 600);
    accountManagerStage.setScene(sc);
    accountManagerStage.show();

}

From source file:de.micromata.mgc.javafx.launcher.gui.generic.JdbcConfigTabController.java

@Override
public void initializeWithModel() {
    extendedChildPane = extendedPane.getChildren().get(0);
    availableDrivers = SystemService.get().getJdbcDrivers();
    List<String> items = new ArrayList<>();

    for (JdbProviderService sb : availableDrivers) {
        items.add(sb.getName());//from  w  ww .j  a  v  a  2  s .com
    }
    drivername.setItems(FXCollections.observableArrayList(items));
    drivername.setOnAction(event -> {
        JdbProviderService dd = getSelectedDriver();
        if (dd != null) {
            url.setText(dd.getSampleUrl(model.getName()));
        }
    });
    extendedSettings.setOnAction(event -> {
        onShowExtended(extendedSettings.isSelected());
    });
    fromModel();
    testJdbcButton.setOnAction(event -> {
        toModel();
        ValContext valContext = new ValContext().createSubContext(model, null);
        model.validate(valContext);
        ValMessageResultBox.showResultBox(valContext, "Connection Databse", "Result of Connecting DB");

    });
    onShowExtended(extendedSettings.isSelected());
}

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

public void setSapYmmbancis(List<SapYmmbanci> sapYmmbancis) {
    this.sapYmmbancis.set(FXCollections.observableArrayList(sapYmmbancis));
}

From source file:com.mycompany.pfinanzaspersonales.BalanceController.java

private void cargarTablaBalance() {

    List<NameValuePair> parametros = new ArrayList<NameValuePair>();

    Object item_anio = cbb_anio.getSelectionModel().getSelectedItem();
    String anio = ((Combobox) item_anio).getId();

    parametros.add(new BasicNameValuePair("anio", anio));
    HttpResponse responseJSON = JSON.request(Config.URL + "usuarios/balance.json", parametros);
    JSONObject jObject = JSON.JSON(responseJSON);
    try {/*from www.  j  a v  a 2 s.c om*/

        c_mes.setCellValueFactory(new PropertyValueFactory<TablaBalance, String>("mes"));
        c_ingresos.setCellValueFactory(new PropertyValueFactory<TablaBalance, String>("ingreso"));
        c_gastos.setCellValueFactory(new PropertyValueFactory<TablaBalance, String>("gasto"));
        c_resumen.setCellValueFactory(new PropertyValueFactory<TablaBalance, String>("resumen"));

        tabla_balance_ = new ArrayList<TablaBalance>();

        if (!jObject.get("data").equals(null)) {
            JSONArray jsonArr = jObject.getJSONArray("data");
            for (int i = 0; i < jsonArr.length(); i++) {
                JSONObject data_json = jsonArr.getJSONObject(i);
                tabla_balance_.add(new TablaBalance(data_json.get("mes").toString(),
                        data_json.get("total_ingresos").toString(), data_json.get("total_gastos").toString(),
                        data_json.get("resumen").toString()));
            }
        }

        tabla_balance.setItems(FXCollections.observableArrayList(tabla_balance_));

    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.github.drbookings.model.data.manager.MainManager.java

MainManager() {
    roomProvider = new RoomProvider();
    guestProvider = new GuestProvider();
    cleaningProvider = new CleaningProvider();
    bookingOriginProvider = new BookingOriginProvider();
    bookings = new ArrayList<>();
    cleaningEntries = ArrayListMultimap.create();
    bookingEntries = ArrayListMultimap.create();
    uiData = new SimpleListProperty<>(FXCollections.observableArrayList(DateBean.extractor()));
    uiDataMap = new LinkedHashMap<>();

}

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

public void setSapT001ws(List<SapT001w> sapT001ws) {
    this.sapT001ws.set(FXCollections.observableArrayList(sapT001ws));
}

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

public void setSapZpackages(List<SapZpackage> sapZpackages) {
    this.sapZpackages.set(FXCollections.observableArrayList(sapZpackages));
}

From source file:com.mycompany.pfinanzaspersonales.BalanceController.java

private void cargarAnio() {
    HttpResponse response = JSON.request(Config.URL + "usuarios/anios.json");
    JSONObject jObject = JSON.JSON(response);
    try {//from  w w w. java2  s  .c  o  m

        combobox = new ArrayList<Combobox>();
        JSONArray jsonArr = jObject.getJSONArray("data");
        for (int i = 0; i < jsonArr.length(); i++) {
            JSONObject data_json = jsonArr.getJSONObject(i);
            combobox.add(new Combobox(data_json.get("anio").toString(), data_json.get("anio").toString()));
        }
        cbb_anio.setItems(FXCollections.observableArrayList(combobox));

    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.ubershy.streamsis.actions.ConfirmedDelayedActions.java

/**
 * Instantiates a new DelayedActions.//  w w  w . j av a  2 s .c o  m
 *
 * @param actions
 *            the list of {@link Action Actions} to execute with delay
 * @param checker
 *            the {@link Checker} to confirm before actual execution
 * @param delay
 *            the execution delay in milliseconds
 */
public ConfirmedDelayedActions(ArrayList<Action> actions, int delay, Checker checker) {
    super(actions, delay);
    this.checker = FXCollections.observableArrayList(checker);
}

From source file:com.ggvaidya.scinames.ui.BulkChangeEditorController.java

public void setBulkChangeEditor(BulkChangeEditor bce) {
    bulkChangeEditor = bce;//w  w  w  .j  a va 2s . co m
    project = bce.getProjectView().getProject();

    List<DatasetColumn> columns = project.getDatasets().stream().flatMap(ds -> ds.getColumns().stream())
            .distinct().collect(Collectors.toList());
    comboBoxNameIdentifiers.setItems(FXCollections.observableArrayList(columns));

    comboBoxMethods.getSelectionModel().selectedItemProperty().addListener((a, b, c) -> {
        ChangeGenerator generator = comboBoxMethods.getSelectionModel().getSelectedItem();

        if (generator.needsDatasetColumn()) {
            // Activate it if this method needs a column
            comboBoxNameIdentifiers.setDisable(false);
        } else {
            // Otherwise 
            comboBoxNameIdentifiers.setDisable(true);
        }
    });

    ObservableList<Dataset> datasets = FXCollections.observableArrayList();
    datasets.add(ALL);
    datasets.addAll(project.getDatasets());
    datasetsComboBox.setItems(datasets);
    datasetsComboBox.getSelectionModel().clearAndSelect(0);

    setupChangesTableView();
    // findChanges();
}