Skip to content

Commit

Permalink
renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
Ljaysoft committed Aug 24, 2016
1 parent 25bbaaa commit 732ec4f
Showing 1 changed file with 9 additions and 5 deletions.
Expand Up @@ -27,10 +27,10 @@ public class PokemonTableController extends AnchorPane {
private ClassLoader classLoader = getClass().getClassLoader(); private ClassLoader classLoader = getClass().getClassLoader();


@FXML @FXML
private TableView pokemonTableView; private ScrollPane scrollPane;


@FXML @FXML
private ScrollPane scrollPane; private TableView pokemonTableView;


private List<TableColumn<PokemonModel, ?>> columns = new ArrayList<>(); private List<TableColumn<PokemonModel, ?>> columns = new ArrayList<>();


Expand All @@ -52,7 +52,7 @@ public PokemonTableController(AnchorPane pane) {
@FXML @FXML
private void initialize() { private void initialize() {
pokemonTableView.getColumns().clear(); pokemonTableView.getColumns().clear();
setColumns(); initColumns();
pokemonTableView.getColumns().addAll(columns); pokemonTableView.getColumns().addAll(columns);
pokemonTableView.setItems(PokemonBagManager.getAllPokemon()); pokemonTableView.setItems(PokemonBagManager.getAllPokemon());
pokemonTableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); pokemonTableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
Expand Down Expand Up @@ -91,17 +91,21 @@ public ObservableList getColumns() {
return pokemonTableView.getColumns(); return pokemonTableView.getColumns();
} }


private void setColumns() { public ObservableList getSelectedItems(){
return pokemonTableView.getSelectionModel().getSelectedItems();
}

private void initColumns() {
columns.clear(); columns.clear();


ArrayList<ColumnID> columnOrder = getColumnOrderFromConfig(); ArrayList<ColumnID> columnOrder = getColumnOrderFromConfig();
// set default values
if (columnOrder.isEmpty()) { if (columnOrder.isEmpty()) {
ColumnID[] ids = ColumnID.values(); ColumnID[] ids = ColumnID.values();
for (int i = 0; i < ids.length; i++) { for (int i = 0; i < ids.length; i++) {
columnOrder.add(ids[i]); columnOrder.add(ids[i]);
} }
} }

columnOrder.forEach(c -> { columnOrder.forEach(c -> {
TableColumn<PokemonModel, Property> col = new TableColumn<>(c.getTitle()); TableColumn<PokemonModel, Property> col = new TableColumn<>(c.getTitle());
switch (c) { switch (c) {
Expand Down

0 comments on commit 732ec4f

Please sign in to comment.