0
リスト内のオブジェクトのステータスを更新すると、リストビュー内のlistCellオブジェクトのアイコンが変更されます。 progressとok pngは必要に応じて動作しますが、他のpngに変更すると、listCellオブジェクトは削除されます。画像の更新時にリストセルが消えます
ステータスが進捗状況からクリティカルに変わると、リストセルは削除されますが、代わりにok.pngを使用すると削除されません。だから、それはイメージのあるもののようです。それは働いていない理由の理由を発見
package MMaaSCollector.windows;
import java.io.IOException;
import MMaaSCollector.Log;
import MMaaSCollector.systems.Host;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane;
public class HostCellData {
@FXML private AnchorPane bg;
@FXML private Label displayName;
@FXML private Label type;
@FXML private ImageView status = new ImageView();
public HostCellData()
{
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/MMaaSCollector/windows/HostListCell.fxml"));
fxmlLoader.setController(this);
try
{
fxmlLoader.load();
}
catch (IOException e)
{
throw new RuntimeException(e);
}
}
public void setInfo(Host host, double width) {
displayName.setText(host.getDisplayName());
type.setText(host.getType());
bg.setPrefWidth(width-17.0-17.0);
if (host.isStatusGathering()) {
Image progress = new Image("/MMaaSCollector/images/progress.gif");
status.setImage(progress);
Log.debugInfo(host.getDisplayName() + " has progress indicator.", 96);
} else if (host.isStatusFailed()) {
Image failed = new Image("/MMaaSCollector/images/fail.png");
status.setImage(failed);
Log.debugInfo(host.getDisplayName() + " has failed indicator.", 96);
} else if (host.isStatusOK()) {
Image ok = new Image("/MMaaSCollector/images/ok.png");
status.setImage(ok);
Log.debugInfo(host.getDisplayName() + " has ok indicator.", 96);
} else if (host.isStatusInfo()) {
Image info = new Image("/MMaaSCollector/images/info.png");
status.setImage(info);
Log.debugInfo(host.getDisplayName() + " has info indicator.", 96);
} else if (host.isStatusLow()) {
Image low = new Image("/MMaaSCollector/images/low.png");
status.setImage(low);
Log.debugInfo(host.getDisplayName() + " has low indicator.", 96);
} else if (host.isStatusWarning()) {
Image warning = new Image("/MMaaSCollector/images/warning.png");
status.setImage(warning);
Log.debugInfo(host.getDisplayName() + " has warning indicator.", 96);
} else if (host.isStatusCritical()) {
Image critical = new Image("/MMaaSCollector/images/critical.png");
status.setImage(critical);
Log.debugInfo(host.getDisplayName() + " critical indicator.", 96);
}
}
public AnchorPane getBg() {
return bg;
}
}
これはすべてのコードですか? – Elltz