All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.adoptopenjdk.jitwatch.ui.report.cell.TextWrapTableCell Maven / Gradle / Ivy

/*
 * Copyright (c) 2013-2016 Chris Newland.
 * Licensed under https://github.com/AdoptOpenJDK/jitwatch/blob/master/LICENSE-BSD
 * Instructions: https://github.com/AdoptOpenJDK/jitwatch/wiki
 */
package org.adoptopenjdk.jitwatch.ui.report.cell;

import static org.adoptopenjdk.jitwatch.core.JITWatchConstants.S_NEWLINE;

import org.adoptopenjdk.jitwatch.ui.report.IReportRowBean;

import javafx.scene.control.TableCell;
import javafx.scene.control.TextArea;

public class TextWrapTableCell extends TableCell
{
	private TextArea textArea;

	public TextWrapTableCell()
	{
		textArea = new TextArea();
		textArea.setWrapText(true);
		textArea.setEditable(false);

		setGraphic(textArea);
	}

	@Override
	protected void updateItem(String text, boolean empty)
	{
		if (text != null)
		{
			int rows = text.split(S_NEWLINE).length;

			textArea.setText(text);
			textArea.setPrefHeight(100 + rows * 10);
			textArea.setVisible(true);
		}
		else
		{
			textArea.setVisible(false);
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy