javafx.collections.ObservableList Java Examples

The following examples show how to use javafx.collections.ObservableList. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ColorInputPane.java    From constellation with Apache License 2.0 8 votes vote down vote up
private ComboBox<ConstellationColor> makeNamedCombo() {
    final ObservableList<ConstellationColor> namedColors = FXCollections.observableArrayList();
    for (final ConstellationColor c : ConstellationColor.NAMED_COLOR_LIST) {
        namedColors.add(c);
    }
    final ComboBox<ConstellationColor> namedCombo = new ComboBox<>(namedColors);
    namedCombo.setValue(ConstellationColor.WHITE);
    final Callback<ListView<ConstellationColor>, ListCell<ConstellationColor>> cellFactory = (final ListView<ConstellationColor> p) -> new ListCell<ConstellationColor>() {
        @Override
        protected void updateItem(final ConstellationColor item, boolean empty) {
            super.updateItem(item, empty);
            if (item != null) {
                final Rectangle r = new Rectangle(12, 12, item.getJavaFXColor());
                r.setStroke(Color.BLACK);
                setText(item.getName());
                setGraphic(r);
            }
        }
    };
    namedCombo.setCellFactory(cellFactory);
    namedCombo.setButtonCell(cellFactory.call(null));

    return namedCombo;
}
 
Example #2
Source File: ConversationController.java    From BetonQuest-Editor with GNU General Public License v3.0 7 votes vote down vote up
/**
 * Sets the list of conversation which can be displayed in this tab.
 * 
 * @param conversations list of conversations
 */
public static void setConversations(ObservableList<Conversation> conversations) {
	instance.conversation.setItems(conversations);
	if (instance.currentConversation != null && conversations.contains(instance.currentConversation)) {
		instance.displayConversation(instance.currentConversation);
	} else {
		instance.displayConversation();
	}
	instance.npc.textProperty().addListener((observable, oldValue, newValue) -> {
	    if (newValue == null || newValue.isEmpty()) {
	    	instance.npc.setStyle("-fx-background-color: red");
	    } else {
	    	instance.npc.setStyle(null);
	    }
	});
}
 
Example #3
Source File: FileBrowserController.java    From ariADDna with Apache License 2.0 6 votes vote down vote up
/**
 * Method for generate file items for fileBrowser and add it into container(temporary realization)
 */
private void showContent() {
    ObservableList<FileItem> list = FXCollections.observableArrayList();
    GridView<FileItem> myGrid = new GridView<>(list);
    myGrid.setCellFactory(gridView -> new GridCell<FileItem>() {
        @Override
        public void updateItem(FileItem item, boolean empty) {
            if (empty || item == null) {
                setText(null);
                setGraphic(null);
            } else {
                //setText(item.getName());
                setGraphic(item);
            }

        }
    });
    list.addAll(new FileItem("icon", "Folder1"),
            new FileItem("icon", "Documents"),
            new FileItem("icon", "WorkFiles"),
            new FileItem("icon", "Projects"));
    container.getChildren().add(myGrid);
}
 
Example #4
Source File: DesktopController.java    From CPUSim with GNU General Public License v3.0 6 votes vote down vote up
/**
 * updates the Save and Load RAM menus so that the the contain a menu item
 * for each RAM in the current machine
 */
private void updateRamMenus() {
    ObservableList<RAM> rams = (ObservableList<RAM>) mediator.getMachine()
            .getModule("rams");
    saveRamMenu.getItems().clear();
    openRamMenu.getItems().clear();

    for (RAM ram : rams) {
        final RAM finalRam = ram;
        MenuItem saveMenuItem = new MenuItem("from " + ram.getName() + "...");
        saveMenuItem.setOnAction(e -> saveRam(finalRam));
        saveRamMenu.getItems().add(saveMenuItem);

        MenuItem openMenuItem = new MenuItem("into " + ram.getName() + "...");
        openMenuItem.setOnAction(e -> openRam(finalRam));
        openRamMenu.getItems().add(openMenuItem);
    }
}
 
Example #5
Source File: GridRenderer.java    From chart-fx with Apache License 2.0 6 votes vote down vote up
protected void drawHorizontalMajorGridLines(final GraphicsContext gc, final Axis yAxis,
        final double xAxisWidthSnapped, final double yAxisHeight) {
    if (!horMajorGridStyleNode.isVisible() && !horMinorGridStyleNode.isVisible()) {
        return;
    }
    final double zeroSnapped = snap(0);
    applyGraphicsStyleFromLineStyle(gc, horMajorGridStyleNode);
    ObservableList<TickMark> tickMarks = yAxis.getTickMarks();
    for (int i = 0; i < tickMarks.size(); i++) {
        double y = snap(yAxis.getDisplayPosition(tickMarks.get(i).getValue()));
        if (y >= 0 && y < yAxisHeight) {
            // gc.strokeLine(zeroSnapped, y, xAxisWidthSnapped, y);
            DashPatternStyle.strokeDashedLine(gc, zeroSnapped, y, xAxisWidthSnapped, y);
        }
    }
}
 
Example #6
Source File: NodeTree.java    From jmonkeybuilder with Apache License 2.0 6 votes vote down vote up
/**
 * Select the item.
 */
@FxThread
private void updateSelection(@NotNull final ObservableValue<? extends TreeItem<TreeNode<?>>> observable,
                             @Nullable final TreeItem<TreeNode<?>> oldValue,
                             @Nullable final TreeItem<TreeNode<?>> treeItem) {

    final ObservableList<TreeItem<TreeNode<?>>> selectedItems = getTreeView()
            .getSelectionModel()
            .getSelectedItems();

    final Array<Object> objects = LocalObjects.get().nextObjectArray();
    objects.clear();

    for (final TreeItem<TreeNode<?>> selectedItem : selectedItems) {
        if (selectedItem == null) continue;
        objects.add(selectedItem.getValue());
    }

    selectionHandler.accept(objects);
}
 
Example #7
Source File: FileTreeItem.java    From markdown-writer-fx with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public ObservableList<TreeItem<File>> getChildren() {
	if (!childrenInitialized) {
		childrenInitialized = true;

		File f = getValue();
		if (f.isDirectory()) {
			File[] files = f.listFiles(filter);
			if (files != null) {
				Arrays.sort(files, FILE_COMPARATOR);
				ArrayList<TreeItem<File>> children = new ArrayList<>();
				for (File file : files)
					children.add(new FileTreeItem(file, filter));
				super.getChildren().setAll(children);
			}
		}
	}
	return super.getChildren();
}
 
Example #8
Source File: ShikoPunetPunetoret.java    From Automekanik with GNU General Public License v3.0 6 votes vote down vote up
public void mbushNgaStatusi(String emri){
    try {
        String sql = "select * from Punet where punetori = '" + emri + "' order by id asc";
        Connection conn = DriverManager.getConnection(CON_STR, "test", "test");
        Statement stmt = conn.createStatement();
        ResultSet rs = stmt.executeQuery(sql);
        ObservableList<TabelaTeDhenatPunetore> data = FXCollections.observableArrayList();
        Format format = new SimpleDateFormat("dd/MM/yyyy");
        String s = "";
        while (rs.next()) {
            s = format.format(rs.getDate("data"));
            data.add(new TabelaTeDhenatPunetore(rs.getInt("id"), rs.getString("lloji"), s,
                    rs.getFloat("qmimi"), rs.getString("konsumatori"), rs.getString("pershkrimi"), rs.getString("kryer"), rs.getString("makina")));
        }

        rs.close();
        stmt.close();
        conn.close();
        table.setItems(data);
    }catch (Exception ex){ex.printStackTrace();}
}
 
Example #9
Source File: SnapshotTable.java    From phoebus with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Sets new table entries for this table, but do not change the structure of the table.
 *
 * @param entries the entries to set
 */
public void updateTable(List<TableEntry> entries) {
    final ObservableList<TableEntry> items = getItems();
    final boolean notHide = !controller.isHideEqualItems();
    items.clear();
    entries.forEach(e -> {
        // there is no harm if this is executed more than once, because only one line is allowed for these
        // two properties (see SingleListenerBooleanProperty for more details)
        e.selectedProperty()
            .addListener((a, o, n) -> selectAllCheckBox.setSelected(n ? selectAllCheckBox.isSelected() : false));
        e.liveStoredEqualProperty().addListener((a, o, n) -> {
            if (controller.isHideEqualItems()) {
                if (n) {
                    getItems().remove(e);
                } else {
                    getItems().add(e);
                }
            }
        });
        if (notHide || !e.liveStoredEqualProperty().get()) {
            items.add(e);
        }
    });
}
 
Example #10
Source File: FxUtils.java    From LogFX with GNU General Public License v3.0 5 votes vote down vote up
public static void addIfNotPresent( ObservableList<String> styleClasses,
                                    String... cssClasses ) {
    for ( String cssClass : cssClasses ) {
        if ( !styleClasses.contains( cssClass ) ) {
            styleClasses.add( cssClass );
        }
    }
}
 
Example #11
Source File: ExpChartController.java    From logbook-kai with MIT License 5 votes vote down vote up
/**
 * 選択肢が変更された時の処理
 */
private void change() {
    TypeOption type = this.type.getSelectionModel().getSelectedItem();
    ScaleOption scale = this.term.getSelectionModel().getSelectedItem();

    ZonedDateTime baseDate = scale.convert(ZonedDateTime.now(), type);
    ZonedDateTime min = scale.min(baseDate);
    ZonedDateTime max = scale.max(baseDate);

    Map<ZonedDateTime, Double> data = this.load(type, scale, min, max);

    XYChart.Series<String, Number> series = new XYChart.Series<>();
    series.setName(type.toString());

    boolean stacked = this.stacked.isSelected();
    ObservableList<String> categories = FXCollections.observableArrayList();
    double current = 0D;
    for (Entry<ZonedDateTime, Double> entry : data.entrySet()) {
        String key = scale.getFormat().format(entry.getKey().withZoneSameInstant(ZoneId.of("Asia/Tokyo")));
        if (stacked) {
            current += entry.getValue();
        } else {
            current = entry.getValue();
        }
        categories.add(key);
        series.getData().add(new XYChart.Data<>(key, current));
    }
    this.chart.setTitle(type + "(" + scale + ")");
    this.chart.getData().clear();
    this.xAxis.getCategories().clear();
    this.xAxis.setCategories(categories);
    this.chart.getData().add(series);
}
 
Example #12
Source File: DefaultRenderColorScheme.java    From chart-fx with Apache License 2.0 5 votes vote down vote up
public static final ObservableList<Paint> getStandardFillStyle() {
    final ObservableList<Paint> values = FXCollections.observableArrayList();
    for (Color colour : fillColorProperty().get()) {
        values.add(FillPatternStyleHelper.getDefaultHatch(colour.brighter(), hatchShiftByIndexProperty().get()));
    }
    return values;
}
 
Example #13
Source File: NodeTree.java    From jmonkeybuilder with Apache License 2.0 5 votes vote down vote up
/**
 * Notify about adding the element.
 *
 * @param parent the parent.
 * @param child  the child.
 * @param index  the index.
 */
@FxThread
public void notifyAdded(@Nullable final Object parent, @Nullable final Object child, final int index) {

    if (child == null || parent == null) {
        return;
    }

    final TreeView<TreeNode<?>> treeView = getTreeView();
    final TreeItem<TreeNode<?>> parentItem = findItemForValue(treeView, parent);
    if (parentItem == null || findItemForValue(parentItem, child) != null) {
        return;
    }

    final TreeNode<?> childNode = FACTORY_REGISTRY.createFor(child);
    if (childNode == null) {
        return;
    }

    final TreeNode<?> parentNode = parentItem.getValue();
    parentNode.notifyChildPreAdd(childNode);

    final TreeItem<TreeNode<?>> childItem = new TreeItem<>(childNode);
    final ObservableList<TreeItem<TreeNode<?>>> children = parentItem.getChildren();

    if (index == -1) {
        children.add(childItem);
    } else {
        children.add(index, childItem);
    }

    parentItem.setExpanded(true);
    parentNode.notifyChildAdded(childNode);

    fill(childItem, false, -1);
}
 
Example #14
Source File: DirTreeItem.java    From classpy with MIT License 5 votes vote down vote up
@Override
public ObservableList<TreeItem<DirTreeNode>> getChildren() {
    if (isFirstTimeChildren) {
        isFirstTimeChildren = false;
        System.out.println("get children of " + getValue());

        // First getChildren() call, so we actually go off and 
        // determine the children of the File contained in this TreeItem.
        super.getChildren().setAll(buildChildren());
    }
    
    return super.getChildren();
}
 
Example #15
Source File: NavigationTabs.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
/** @return Index of the selected tab. -1 if there are no buttons or nothing selected */
public int getSelectedTab()
{
    final ObservableList<Node> siblings = buttons.getChildren();
    for (int i=0; i<siblings.size(); ++i)
        if (((ToggleButton) siblings.get(i)).isSelected())
            return i;
    return -1;
}
 
Example #16
Source File: ApplicationController.java    From AsciidocFX with Apache License 2.0 5 votes vote down vote up
public void applyCurrentTheme(Stage... stages) {

        ObservableList<EditorConfigBean.Theme> editorTheme = editorConfigBean.getEditorTheme();

        if (editorTheme.isEmpty()) {
            return;
        }

        EditorConfigBean.Theme theme = editorTheme.get(0);
        String themeUri = theme.themeUri();

        if (isNull(themeUri)) {
            return;
        }

        threadService.runActionLater(() -> {
            try {

                String aceTheme = theme.getAceTheme();
//                editorConfigBean.updateAceTheme(aceTheme);

                for (Stage stage : stages) {
                    if (nonNull(stage) && nonNull(stage.getScene())) {
                        ObservableList<String> stylesheets = stage.getScene().getStylesheets();
                        stylesheets.clear();
                        stylesheets.add(themeUri);
                    }
                }

                terminalConfigBean.changeTheme(theme);

            } catch (Exception e) {
                logger.error("Error occured while setting new theme {}", theme);
            }
        });
    }
 
Example #17
Source File: NavigationServiceTest.java    From PeerWasp with MIT License 5 votes vote down vote up
@Test
public void testNavigate() throws IOException {
	ObservableList<Node> pages = getPages();
	assertNotNull(pages);

	/* first page */
	String page_1 = "/testpage1.fxml";
	navigationService.navigate(page_1);
	Mockito.verify(fxmlLoaderProvider, Mockito.times(1)).create(page_1);
	Mockito.verify(fxmlLoader, Mockito.times(1)).load();
	Mockito.verify(controller, Mockito.times(1)).setContent(elements[0]);
	assertTrue(pages.size() == 1);
	assertEquals(pages.get(0), elements[0]);

	/* second page */
	String page_2 = "/testpage2.fxml";
	navigationService.navigate(page_2);
	Mockito.verify(fxmlLoaderProvider, Mockito.times(1)).create(page_2);
	Mockito.verify(fxmlLoader, Mockito.times(2)).load();
	Mockito.verify(controller, Mockito.times(1)).setContent(elements[1]);
	assertTrue(pages.size() == 2);
	assertEquals(pages.get(0), elements[0]);
	assertEquals(pages.get(1), elements[1]);

	/* third page */
	String page_3 = "/testpage3.fxml";
	navigationService.navigate(page_3);
	Mockito.verify(fxmlLoaderProvider, Mockito.times(1)).create(page_3);
	Mockito.verify(fxmlLoader, Mockito.times(3)).load();
	Mockito.verify(controller, Mockito.times(1)).setContent(elements[2]);
	assertTrue(pages.size() == 3);
	assertEquals(pages.get(0), elements[0]);
	assertEquals(pages.get(1), elements[1]);
	assertEquals(pages.get(2), elements[2]);
}
 
Example #18
Source File: IOTableController.java    From CPUSim with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Set the clones to the new array passed as a parameter.
 * Does not check for validity.
 *
 * @param newClones Object array containing new set of clones
 */
public void setClones(ObservableList newClones)
{
    IO[] ios = new IO[newClones.size()];
    for (int i = 0; i < newClones.size(); i++) {
        ios[i] = (IO) newClones.get(i);
    }
    clones = ios;
}
 
Example #19
Source File: MainAction.java    From DevToolBox with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void deleteRedisKeyAction() {
    ObservableList list = mc.redisValueTable.getSelectionModel().getSelectedItems();
    if (list.isEmpty()) {
        Toast.makeText("请选择要删除的记录").show(mc.pane.getScene().getWindow());
        return;
    }
    StringBuilder key = new StringBuilder();
    int i = 0;
    for (Object object : list) {
        Map mp = (Map) object;
        key.append(mp.get("key"));
        if (i != list.size() - 1) {
            key.append(",");
        }
        i++;
    }
    Alert a = new Alert(Alert.AlertType.CONFIRMATION);
    a.setTitle("确认删除");
    a.setContentText("确认要删除[" + key + "]这些键值吗?");
    a.initOwner(mc.pane.getScene().getWindow());
    Optional<ButtonType> o = a.showAndWait();
    if (o.get().getButtonData().equals(ButtonBar.ButtonData.OK_DONE)) {
        String[] keys = key.toString().split(",");
        String name = (String) mc.redisDatabaseList.getSelectionModel().getSelectedItem();
        RedisUtil.deleteKeys(name, keys);
        Toast.makeText("删除成功", Duration.seconds(1)).show(mc.pane.getScene().getWindow());
        mc.paginationForValue.getPageFactory().call(0);
    }
}
 
Example #20
Source File: StatisticsPane.java    From logbook-kai with MIT License 5 votes vote down vote up
/**
 * レベル分布
 * @param ships 対象艦
 */
private void setBubble(List<Ship> ships) {
    this.bubble.getData().clear();

    Map<TypeGroup, List<Integer>> value = ships.stream()
            .collect(Collectors.groupingBy(TypeGroup::toTypeGroup,
                    Collectors.mapping(Ship::getLv, Collectors.toList())));

    for (TypeGroup group : TypeGroup.values()) {
        List<Integer> levels = value.get(group);
        if (levels != null) {
            double average = levels.stream()
                    .mapToInt(Integer::intValue)
                    .average()
                    .orElse(0);
            int size = levels.size();
            levels.sort(Integer::compareTo);
            double median = (size % 2 == 0)
                    ? (double) (levels.get(size / 2) + levels.get(Math.max(size / 2 - 1, 0))) / 2
                    : (double) levels.get(size / 2);

            ObservableList<XYChart.Data<Double, Double>> datas = FXCollections.observableArrayList();
            datas.add(new XYChart.Data<>(average, median, ((double) size) / 5));
            XYChart.Series<Double, Double> series = new XYChart.Series<>(group.name(), datas);
            this.bubble.getData().add(series);
        }
    }
}
 
Example #21
Source File: ResourceView.java    From sis with Apache License 2.0 5 votes vote down vote up
private void setContent(final Node content) {
    final ObservableList<Node> items = pane.getItems();
    if (items.size() >= 2) {
        items.set(1, content);
    } else {
        items.add(content);
    }
}
 
Example #22
Source File: PolygonRegion.java    From ShootOFF with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void changeHeight(final double heightDelta) {
	final ObservableList<Double> points = getPoints();
	final List<Double> pointsY = new ArrayList<>();

	for (int i = 1; i < points.size(); i += 2) {
		pointsY.add(points.get(i));
	}

	final double height = Collections.max(pointsY);
	final double scaleFactor = (height + heightDelta) / height;

	setScaleY(getScaleY() * scaleFactor);
}
 
Example #23
Source File: EditDataSet.java    From chart-fx with Apache License 2.0 5 votes vote down vote up
protected void performSelection() {
    if (!(getChart() instanceof XYChart)) {
        return;
    }
    final XYChart xyChart = (XYChart) getChart();

    if (!isShiftDown()) {
        markedPoints.clear();
    }

    findDataPoint(xyChart.getFirstAxis(Orientation.HORIZONTAL), xyChart.getFirstAxis(Orientation.VERTICAL),
            xyChart.getDatasets());

    for (final Renderer rend : xyChart.getRenderers()) {
        final ObservableList<Axis> axes = rend.getAxes();
        findDataPoint(getFirstAxis(axes, Orientation.HORIZONTAL), getFirstAxis(axes, Orientation.VERTICAL),
                rend.getDatasets());
    }

    if (markedPoints.isEmpty()) {
        editEnable.set(false);
    } else {
        editEnable.set(true);
    }

    updateMarker();
}
 
Example #24
Source File: ColoringTypeParameter.java    From mzmine3 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public ComboBox<ColoringType> createEditingComponent() {
  ObservableList<ColoringType> choicesList = FXCollections.observableArrayList();
  choicesList.add(ColoringType.NOCOLORING);
  choicesList.add(ColoringType.COLORBYFILE);
  for (UserParameter<?, ?> p : MZmineCore.getProjectManager().getCurrentProject()
      .getParameters()) {
    choicesList.add(new ColoringType(p));
  }
  ComboBox<ColoringType> editor = new ComboBox<ColoringType>(choicesList);
  if (value != null)
    editor.getSelectionModel().select(value);
  return editor;
}
 
Example #25
Source File: DemoLcdClock.java    From Enzo with Apache License 2.0 5 votes vote down vote up
private static void calcNoOfNodes(Node node) {
    if (node instanceof Parent) {
        if (((Parent) node).getChildrenUnmodifiable().size() != 0) {
            ObservableList<Node> tempChildren = ((Parent) node).getChildrenUnmodifiable();
            noOfNodes += tempChildren.size();
            for (Node n : tempChildren) {
                calcNoOfNodes(n);
                //System.out.println(n.getStyleClass().toString());
            }
        }
    }
}
 
Example #26
Source File: VirtualFlowTest.java    From Flowless with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void idempotentSetLengthOffsetTest() {
    // create VirtualFlow with 1 big cell
    Rectangle rect = new Rectangle(500, 500);
    ObservableList<Rectangle> items = FXCollections.singletonObservableList(rect);
    VirtualFlow<Rectangle, Cell<Rectangle, Rectangle>> vf = VirtualFlow.createVertical(items, Cell::wrapNode);
    vf.resize(100, 100); // size of VirtualFlow less than that of the cell
    vf.layout();

    vf.setLengthOffset(10.0);
    vf.setLengthOffset(10.0);
    vf.layout();
    assertEquals(-10.0, rect.getBoundsInParent().getMinY(), 0.01);
}
 
Example #27
Source File: UnSavedHistoryStage.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
private void onManageFavourites() {
    FavouriteHistoryStage favouriteHistoryStage = new FavouriteHistoryStage(new RunHistoryInfo("favourites"));
    favouriteHistoryStage.getStage().showAndWait();
    ObservableList<JSONObject> items = historyView.getItems();
    items.clear();
    items.addAll(runHistoryInfo.getTests());
}
 
Example #28
Source File: OtherController.java    From BetonQuest-Editor with GNU General Public License v3.0 5 votes vote down vote up
public static void setJournal(ObservableList<JournalEntry> journal) {
	instance.journalList.setCellFactory(param -> new DraggableListCell<>());
	instance.journalList.setItems(journal);
	instance.journalList.getSelectionModel().selectedItemProperty().addListener(event -> {
		instance.selectEntry();
	});
	instance.journalList.setOnMouseClicked(event -> {
		if (event.getButton() == MouseButton.PRIMARY && event.getClickCount() == 2) {
			instance.editEntry();
		}
	});
}
 
Example #29
Source File: OfferBookChartViewModelTest.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
@Test
public void testMaxCharactersForBuyPriceWithNoOffers() {
    OfferBook offerBook = mock(OfferBook.class);
    final ObservableList<OfferBookListItem> offerBookListItems = FXCollections.observableArrayList();

    when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems);

    final OfferBookChartViewModel model = new OfferBookChartViewModel(offerBook, empty, null, null, null);
    assertEquals(0, model.maxPlacesForBuyPrice.intValue());
}
 
Example #30
Source File: AlbumsController.java    From MusicPlayer with MIT License 5 votes vote down vote up
private void populateSongTable(VBox cell, Album selectedAlbum) { 	
	// Retrieves albums songs and stores them as an observable list.
	ObservableList<Song> albumSongs = FXCollections.observableArrayList(selectedAlbum.getSongs());
	
    playingColumn.setCellFactory(x -> new PlayingTableCell<Song, Boolean>());
    titleColumn.setCellFactory(x -> new ControlPanelTableCell<Song, String>());
    lengthColumn.setCellFactory(x -> new ClippedTableCell<Song, String>());
    playsColumn.setCellFactory(x -> new ClippedTableCell<Song, Integer>());

    // Sets each column item.
    playingColumn.setCellValueFactory(new PropertyValueFactory<Song, Boolean>("playing"));
    titleColumn.setCellValueFactory(new PropertyValueFactory<Song, String>("title"));
    lengthColumn.setCellValueFactory(new PropertyValueFactory<Song, String>("length"));
    playsColumn.setCellValueFactory(new PropertyValueFactory<Song, Integer>("playCount"));
    
    // Adds songs to table.
    songTable.setItems(albumSongs);
    double height = (albumSongs.size() + 1) * 50 + 2;
    Animation songTableLoadAnimation = new Transition() {
    	{
    		setCycleDuration(Duration.millis(250));
            setInterpolator(Interpolator.EASE_BOTH);
    	}
    	
    	protected void interpolate(double frac) {
    		songTable.setMinHeight(frac * height);
            songTable.setPrefHeight(frac * height);
    	}
    };
    songTableLoadAnimation.play();
}